RBAC: Remove user permissions in org when user is removed (#53782)

* RBAC: Add orgID to DeleteUserPermissions

* RBAC: Refactor query to delete all permissions in specified org, 0
deletes all permissions

* Delete user permission in org when user is removed

* Remove call to delete permissions in frontend

* Remove user permissions if removed orgs is detected during oauth sync

Co-authored-by: Jo <joao.guerreiro@grafana.com>
This commit is contained in:
Karl Persson
2022-08-17 16:32:02 +02:00
committed by GitHub
parent 6fe2d4724a
commit 57d87389e0
10 changed files with 140 additions and 45 deletions

View File

@@ -158,16 +158,8 @@ class UnThemedOrgRow extends PureComponent<OrgRowProps> {
}
onOrgRemove = async () => {
const { org, user } = this.props;
const { org } = this.props;
this.props.onOrgRemove(org.orgId);
if (contextSrv.licensedAccessControlEnabled()) {
if (
contextSrv.hasPermission(AccessControlAction.ActionUserRolesRemove) &&
contextSrv.hasPermission(AccessControlAction.ActionUserRolesAdd)
) {
user && (await updateUserRoles([], user.id, org.orgId));
}
}
};
onChangeRoleClick = () => {