-
Notifications
You must be signed in to change notification settings - Fork 134
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
Disable removal of org user
role if user has others
#2427
Conversation
Hey irfanhabib! Thanks for submitting this pull request! I'm here to inform the recipients of the pull request that you and the commit authors have already signed the CLA. |
Codecov Report
@@ Coverage Diff @@
## v2-master #2427 +/- ##
=============================================
- Coverage 70.81% 70.74% -0.07%
=============================================
Files 589 589
Lines 24760 24790 +30
Branches 5578 5593 +15
=============================================
+ Hits 17534 17538 +4
- Misses 7226 7252 +26 |
map( (entity: CfUser) => this.cfUserService.hasRoles(entity)) | ||
); | ||
} else { | ||
chipConfig.hideClearButton$ = this.canRemovePermission(perm.cfGuid, perm.orgGuid, perm.spaceGuid).pipe( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The permissions check still need to be applied. ATM a non-manager can remove an org user role if it's the only role that user has
// If there are other roles than Org User, disable clear button | ||
chipConfig.hideClearButton$ = this.userEntity.pipe( | ||
filter(p => !!p), | ||
map( (entity: CfUser) => this.cfUserService.hasRoles(entity)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This check needs to be specific per org. ATM a user cannot remove an org with a user role if there are other orgs with roles.
const orgRoles = this.getOrgRolesFromUser(user); | ||
const spaceRoles = this.getSpaceRolesFromUser(user); | ||
|
||
let hasRoles = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be good to return early if the hasRoles flag becomes true
No description provided.