Skip to content

Commit eba3f41

Browse files
user manager fix
1 parent fcac4ff commit eba3f41

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

api/auth/user/UserRestHandler_ent.go

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,16 @@ func (handler UserRestHandlerImpl) checkRBACForUserCreate(token string, requestS
2525
isAuthorised = handler.enforcer.Enforce(token, casbin.ResourceUser, casbin.ActionCreate, filter.Team)
2626
case filter.Entity == bean2.CLUSTER_ENTITIY:
2727
isAuthorised = handler.userCommonService.CheckRbacForClusterEntity(filter.Cluster, filter.Namespace, filter.Group, filter.Kind, filter.Resource, token, handler.CheckManagerAuth)
28-
case filter.Entity == bean2.CHART_GROUP_ENTITY && len(roleFilters) == 1: //if only chartGroup entity is present in request then access will be judged through super-admin access
29-
isAuthorised = isActionUserSuperAdmin
30-
case filter.Entity == bean2.CHART_GROUP_ENTITY && len(roleFilters) > 1: //if entities apart from chartGroup entity are present, not checking chartGroup access
28+
case filter.Entity == bean2.CHART_GROUP_ENTITY && len(roleFilters) == 1:
29+
// If only chart group in direct permissions, but user is assigning role groups too,
30+
// defer the chart group authorization to the role group check
31+
if len(roleGroups) > 0 {
32+
isAuthorised = true // Will be validated in role group section
33+
} else {
34+
isAuthorised = isActionUserSuperAdmin
35+
}
36+
case filter.Entity == bean2.CHART_GROUP_ENTITY && len(roleFilters) > 1:
37+
// If there are other entities in addition to chart group, ignore chart group check
3138
isAuthorised = true
3239
default:
3340
isAuthorised = false

0 commit comments

Comments
 (0)