private bool IsGroupController(int memberId, int groupId) { // Get members of group where they have a role over the entire group (claim scope) // and that role has the "Default" property which means it is an auto generated role. // This is the role that is given to the creator of the group and can be used to prove that it is the admin (the group controller). return(_actorRoleController .GetActorRolesForEntity(memberId, groupId, ClaimScope.Group) .Any(r => r.Default)); }
public List <Claim> GetActorClaimsForEntity(int actorId, int entityId, ClaimScope scope) { var claims = _actorClaimDbController.GetActorClaimsForEntity(actorId, entityId, scope); var roleClaims = _actorRoleController.GetActorRolesForEntity(actorId, entityId, scope) .SelectMany(r => r.RoleClaims) .Select(rc => rc.Claim) .ToList(); var totalClaims = claims.Concat(roleClaims).Distinct().ToList(); _logger.LogInformation($"{totalClaims.Count} Claims for ActorId: {actorId}, EntityId: {entityId}, {nameof(ClaimScope)}: {scope}"); return(totalClaims); }