public Permission SetPermission(IRole role, IAction action, bool isAllowed) { Permission permission = PermissionRepository.GetPermissionByRole(role, action); if (permission == null) permission = new Permission(role, action, isAllowed); else permission.IsAllowed = isAllowed; PermissionRepository.SavePermission(permission); return permission; }
public Permission SetPermission(IUser user, IAction action, bool isAllowed) { Permission permission = PermissionRepository.GetPermissionByUser(user, action); if (permission == null) permission = new Permission(user, action, isAllowed); else permission.IsAllowed = isAllowed; PermissionRepository.SavePermission(permission); return permission; }
private void DeletePermission(Permission permission) { if (permission != null) PermissionRepository.DeletePermission(permission); }
public bool HasPermission(PermissionObject permissionObject, Permission permissions) { return(IdentityUser.HasPermission(permissionObject, permissions) || UserId == SystemUserId); }
public void RemovePermission(IRole role, IAction action) { Permission permission = PermissionRepository.GetPermissionByRole(role, action); DeletePermission(permission); }
public void RemovePermission(IUser user, IAction action) { Permission permission = PermissionRepository.GetPermissionByUser(user, action); DeletePermission(permission); }