public override bool CanAccessResource(PermissionContext permissionContext) { var user = permissionContext.User; UserRoleFlags userRoles = 0; userRoles |= user.IsOwner ? UserRoleFlags.Owner : 0; userRoles |= user.AdministratorId != null ? UserRoleFlags.Administrator : 0; userRoles |= user.SecretaryId != null ? UserRoleFlags.Secretary : 0; userRoles |= user.DoctorId != null ? UserRoleFlags.Doctor : 0; return((userRoles & this.RoleFlags) != 0); }
public UserRolePermissionAttribute(UserRoleFlags roleFlags) { this.RoleFlags = roleFlags; }
public SelfOrUserRolePermissionAttribute(UserRoleFlags roleFlags) : base(roleFlags) { }