public void RemovePermission(MenuMasterPermission MenuMasterpermission, Role role) { _listAuthentication[MenuMasterpermission].Remove(role); Database database = new Database("PSCPortalConnectionString"); using (DbConnection connection = database.GetConnection()) { DbCommand command = database.GetCommand(connection); #region MenuMasterId DbParameter prMenuMasterId = database.GetParameter(System.Data.DbType.Guid, "@MenuMasterId", _MenuMaster.Id); command.Parameters.Add(prMenuMasterId); #endregion #region MenuMasterPermissionId DbParameter prMenuMasterPermissionId = database.GetParameter(System.Data.DbType.Int32, "@MenuMasterPermissionId", MenuMasterpermission.Id); command.Parameters.Add(prMenuMasterPermissionId); #endregion #region RoleId DbParameter prRoleId = database.GetParameter(System.Data.DbType.Guid, "@RoleId", role.Id); command.Parameters.Add(prRoleId); #endregion command.CommandText = "MenuMasterAuthentication_Delete"; command.CommandType = System.Data.CommandType.StoredProcedure; connection.Open(); command.ExecuteNonQuery(); } }
public static MenuMasterPermission Parse(PERMISSION permission) { MenuMasterPermission result = new MenuMasterPermission(); result._id = (int)permission; return(result); }
public bool IsAllow(MenuMasterPermission.PERMISSION permission) { if (System.Web.HttpContext.Current.User.IsInRole(System.Configuration.ConfigurationManager.AppSettings["GroupAdmin"])) { return(true); } List <Role> listRole = GetRolesForPermission(MenuMasterPermission.Parse(permission)); foreach (Role role in listRole) { if (System.Web.HttpContext.Current.User.IsInRole(role.Name)) { return(true); } } return(false); }
public List <Role> GetRolesForPermission(MenuMasterPermission permission) { return(_listAuthentication[permission]); }