Created
April 6, 2021 12:17
-
-
Save martyncoup/2571f30376350084b8a51ce7017ec860 to your computer and use it in GitHub Desktop.
Checks for group claims in the list of role access
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Get group role assignments | |
var groupClaims = context.Principal.Claims.Where(w => w.Type == "groups").Select(s => s.Value).ToList(); | |
var groupRoles = dbContext.RoleMaps.Where(w => groupClaims.Contains(w.ObjectId)).Join(dbContext.Roles, map => map.RoleId, | |
role => role.Id, (map, role) => new { RoleName = role.Name }).ToList(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment