Skip to content

Commit 9885b84

Browse files
role group fix (#6336)
1 parent 8909404 commit 9885b84

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

pkg/auth/user/UserCommonService.go

+1-10
Original file line numberDiff line numberDiff line change
@@ -412,22 +412,13 @@ func (impl UserCommonServiceImpl) RemoveRolesAndReturnEliminatedPoliciesForGroup
412412
impl.logger.Errorw("Error in fetching roles by filter", "user", request)
413413
return nil, nil, err
414414
}
415-
oldRoleModel, err := impl.userAuthRepository.GetRoleByFilterForAllTypes(entity, "", "", "", "", accessType, roleFilter.Cluster, namespace, group, kind, resource, actionType, true, "")
416-
if err != nil {
417-
impl.logger.Errorw("Error in fetching roles by filter", "user", request)
418-
return nil, nil, err
419-
}
420-
if roleModel.Id == 0 && oldRoleModel.Id == 0 {
415+
if roleModel.Id == 0 {
421416
impl.logger.Warnw("no role found for given filter", "filter", roleFilter)
422417
continue
423418
}
424419
if _, ok := existingRoles[roleModel.Id]; ok {
425420
delete(eliminatedRoles, roleModel.Id)
426421
}
427-
if _, ok := existingRoles[oldRoleModel.Id]; ok {
428-
//delete old role mapping from existing but not from eliminated roles (so that it gets deleted)
429-
delete(existingRoles, oldRoleModel.Id)
430-
}
431422
}
432423
}
433424
}

0 commit comments

Comments
 (0)