Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Additional Role Claims Functionality #465

Closed
wants to merge 3 commits into from
Closed

Add Additional Role Claims Functionality #465

wants to merge 3 commits into from

Conversation

AksharX
Copy link

@AksharX AksharX commented Jan 17, 2020

Add the following functionality to Admin API

  1. Delete all Roles Claims for all Roles that have a specific Claim Type (Input: Role Claim Type)
  2. Add a specific Claim to Roles (Input: List, ClaimType, ClaimValue)
  3. Get all Roles that have a specific Role Claim Type (Input: Role Claim)

I believe this is a good introduction to having more functionality around Role Claims.

@AksharX AksharX requested review from skoruba and removed request for skoruba January 17, 2020 20:43
@skoruba
Copy link
Owner

skoruba commented Jan 20, 2020

Thanks for your PR, I will check it. 👍

@skoruba skoruba self-requested a review January 20, 2020 13:06
@ruzanowski
Copy link

ruzanowski commented Dec 1, 2020

That's good input, however, we might add UI to that 👍
@AksharX possible to resolve conflicts and add simple UI for management to make it fully functional?


var added = await IdentityRepository.AddClaimToRolesAsync(roleIds, roleClaimType, roleClaimValue);

await AuditEventLogger.LogEventAsync(new RoleClaimDeletedFromRolesEvent(roleClaimType, roleIds));

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrong event. Should be: RoleClaimAddedToRolesEvent

Task<TRoleClaimsDto> GetRoleClaimAsync(string roleId, int claimId);

Task<int> DeleteRoleClaimsAsync(TRoleClaimsDto role);

Task<IdentityResult> DeleteRoleAsync(TRoleDto role);

Task<int> DeleteClaimForRolesAsync(List<string> roleIds, string roleClaimType);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IList

{
var rolesQ = from r in DbContext.Set<TRole>()
join rc in DbContext.Set<TRoleClaim>() on r.Id equals rc.RoleId
where rc.ClaimType.Equals(roleClaimType) && roleIds.Contains(r.Id.ToString())
Copy link

@ruzanowski ruzanowski Dec 4, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

roleIds.Contains(r.Id.ToString()) in EFCore3.1 is not translated.

try: roleIds.Contains(((string)(object)r.Id))

More info: dotnet/efcore#20604

@AksharX AksharX closed this Jun 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants