@@ -40,9 +40,6 @@ type UserCommonService interface {
40
40
RemoveRolesAndReturnEliminatedPoliciesForGroups (request * bean.RoleGroup , existingRoles map [int ]* repository.RoleGroupRoleMapping , eliminatedRoles map [int ]* repository.RoleGroupRoleMapping , tx * pg.Tx , token string , managerAuth func (resource string , token string , object string ) bool ) ([]casbin.Policy , error )
41
41
CheckRbacForClusterEntity (cluster , namespace , group , kind , resource , token string , managerAuth func (resource , token , object string ) bool ) bool
42
42
GetCapacityForRoleFilter (roleFilters []bean.RoleFilter ) (int , map [int ]int )
43
- BuildRoleFilterKeyForCluster (roleFilterMap map [string ]* bean.RoleFilter , role repository.RoleModel , key string )
44
- BuildRoleFilterKeyForJobs (roleFilterMap map [string ]* bean.RoleFilter , role repository.RoleModel , key string )
45
- BuildRoleFilterKeyForOtherEntity (roleFilterMap map [string ]* bean.RoleFilter , role repository.RoleModel , key string )
46
43
BuildRoleFilterForAllTypes (roleFilterMap map [string ]* bean.RoleFilter , role repository.RoleModel , key string )
47
44
GetUniqueKeyForAllEntity (role repository.RoleModel ) string
48
45
SetDefaultValuesIfNotPresent (request * bean.ListingRequest , isRoleGroup bool )
@@ -201,7 +198,7 @@ func getResolvedValueFromPValDetailObject(pValDetailObj repository.PValDetailObj
201
198
func getPValUpdateMap (team , entityName , env , entity , cluster , namespace , group , kind , resource , workflow string ) map [repository.PValUpdateKey ]string {
202
199
pValUpdateMap := make (map [repository.PValUpdateKey ]string )
203
200
pValUpdateMap [repository .EntityPValUpdateKey ] = entity
204
- if entity == bean .CLUSTER_ENTITIY {
201
+ if entity == bean2 .CLUSTER_ENTITIY {
205
202
pValUpdateMap [repository .ClusterPValUpdateKey ] = cluster
206
203
pValUpdateMap [repository .NamespacePValUpdateKey ] = namespace
207
204
pValUpdateMap [repository .GroupPValUpdateKey ] = group
@@ -242,7 +239,7 @@ func (impl UserCommonServiceImpl) RemoveRolesAndReturnEliminatedPolicies(userInf
242
239
var eliminatedPolicies []casbin.Policy
243
240
// DELETE Removed Items
244
241
for _ , roleFilter := range userInfo .RoleFilters {
245
- if roleFilter .Entity == bean .CLUSTER_ENTITIY {
242
+ if roleFilter .Entity == bean2 .CLUSTER_ENTITIY {
246
243
namespaces := strings .Split (roleFilter .Namespace , "," )
247
244
groups := strings .Split (roleFilter .Group , "," )
248
245
kinds := strings .Split (roleFilter .Kind , "," )
@@ -336,7 +333,7 @@ func (impl UserCommonServiceImpl) RemoveRolesAndReturnEliminatedPolicies(userInf
336
333
if _ , ok := existingRoleIds [roleModel .Id ]; ok {
337
334
delete (eliminatedRoleIds , roleModel .Id )
338
335
}
339
- isChartGroupEntity := roleFilter .Entity == bean .CHART_GROUP_ENTITY
336
+ isChartGroupEntity := roleFilter .Entity == bean2 .CHART_GROUP_ENTITY
340
337
if _ , ok := existingRoleIds [oldRoleModel .Id ]; ok && ! isChartGroupEntity {
341
338
//delete old role mapping from existing but not from eliminated roles (so that it gets deleted)
342
339
delete (existingRoleIds , oldRoleModel .Id )
@@ -362,7 +359,7 @@ func (impl UserCommonServiceImpl) RemoveRolesAndReturnEliminatedPolicies(userInf
362
359
continue
363
360
}
364
361
}
365
- if role .Entity == bean .CLUSTER_ENTITIY {
362
+ if role .Entity == bean2 .CLUSTER_ENTITIY {
366
363
isValidAuth := impl .CheckRbacForClusterEntity (role .Cluster , role .Namespace , role .Group , role .Kind , role .Resource , token , managerAuth )
367
364
if ! isValidAuth {
368
365
continue
@@ -384,7 +381,7 @@ func (impl UserCommonServiceImpl) RemoveRolesAndReturnEliminatedPoliciesForGroup
384
381
//var policies []casbin.Policy
385
382
for _ , roleFilter := range request .RoleFilters {
386
383
entity := roleFilter .Entity
387
- if entity == bean .CLUSTER_ENTITIY {
384
+ if entity == bean2 .CLUSTER_ENTITIY {
388
385
namespaces := strings .Split (roleFilter .Namespace , "," )
389
386
groups := strings .Split (roleFilter .Group , "," )
390
387
kinds := strings .Split (roleFilter .Kind , "," )
@@ -488,7 +485,7 @@ func (impl UserCommonServiceImpl) RemoveRolesAndReturnEliminatedPoliciesForGroup
488
485
if _ , ok := existingRoles [roleModel .Id ]; ok {
489
486
delete (eliminatedRoles , roleModel .Id )
490
487
}
491
- isChartGroupEntity := roleFilter .Entity == bean .CHART_GROUP_ENTITY
488
+ isChartGroupEntity := roleFilter .Entity == bean2 .CHART_GROUP_ENTITY
492
489
if _ , ok := existingRoles [oldRoleModel .Id ]; ok && ! isChartGroupEntity {
493
490
//delete old role mapping from existing but not from eliminated roles (so that it gets deleted)
494
491
delete (existingRoles , oldRoleModel .Id )
@@ -514,7 +511,7 @@ func (impl UserCommonServiceImpl) RemoveRolesAndReturnEliminatedPoliciesForGroup
514
511
continue
515
512
}
516
513
}
517
- if role .Entity == bean .CLUSTER_ENTITIY {
514
+ if role .Entity == bean2 .CLUSTER_ENTITIY {
518
515
isValidAuth := impl .CheckRbacForClusterEntity (role .Cluster , role .Namespace , role .Group , role .Kind , role .Resource , token , managerAuth )
519
516
if ! isValidAuth {
520
517
continue
@@ -608,22 +605,22 @@ func (impl UserCommonServiceImpl) GetCapacityForRoleFilter(roleFilters []bean.Ro
608
605
609
606
func (impl UserCommonServiceImpl ) BuildRoleFilterForAllTypes (roleFilterMap map [string ]* bean.RoleFilter , role repository.RoleModel , key string ) {
610
607
switch role .Entity {
611
- case bean .CLUSTER_ENTITIY :
608
+ case bean2 .CLUSTER_ENTITIY :
612
609
{
613
- impl . BuildRoleFilterKeyForCluster (roleFilterMap , role , key )
610
+ BuildRoleFilterKeyForCluster (roleFilterMap , role , key )
614
611
}
615
612
case bean2 .EntityJobs :
616
613
{
617
- impl . BuildRoleFilterKeyForJobs (roleFilterMap , role , key )
614
+ BuildRoleFilterKeyForJobs (roleFilterMap , role , key )
618
615
}
619
616
default :
620
617
{
621
- impl . BuildRoleFilterKeyForOtherEntity (roleFilterMap , role , key )
618
+ BuildRoleFilterKeyForOtherEntity (roleFilterMap , role , key )
622
619
}
623
620
}
624
621
}
625
622
626
- func ( impl UserCommonServiceImpl ) BuildRoleFilterKeyForCluster (roleFilterMap map [string ]* bean.RoleFilter , role repository.RoleModel , key string ) {
623
+ func BuildRoleFilterKeyForCluster (roleFilterMap map [string ]* bean.RoleFilter , role repository.RoleModel , key string ) {
627
624
namespaceArr := strings .Split (roleFilterMap [key ].Namespace , "," )
628
625
if containsArr (namespaceArr , AllNamespace ) {
629
626
roleFilterMap [key ].Namespace = AllNamespace
@@ -650,7 +647,7 @@ func (impl UserCommonServiceImpl) BuildRoleFilterKeyForCluster(roleFilterMap map
650
647
}
651
648
}
652
649
653
- func ( impl UserCommonServiceImpl ) BuildRoleFilterKeyForJobs (roleFilterMap map [string ]* bean.RoleFilter , role repository.RoleModel , key string ) {
650
+ func BuildRoleFilterKeyForJobs (roleFilterMap map [string ]* bean.RoleFilter , role repository.RoleModel , key string ) {
654
651
envArr := strings .Split (roleFilterMap [key ].Environment , "," )
655
652
if containsArr (envArr , AllEnvironment ) {
656
653
roleFilterMap [key ].Environment = AllEnvironment
@@ -671,7 +668,7 @@ func (impl UserCommonServiceImpl) BuildRoleFilterKeyForJobs(roleFilterMap map[st
671
668
}
672
669
}
673
670
674
- func ( impl UserCommonServiceImpl ) BuildRoleFilterKeyForOtherEntity (roleFilterMap map [string ]* bean.RoleFilter , role repository.RoleModel , key string ) {
671
+ func BuildRoleFilterKeyForOtherEntity (roleFilterMap map [string ]* bean.RoleFilter , role repository.RoleModel , key string ) {
675
672
envArr := strings .Split (roleFilterMap [key ].Environment , "," )
676
673
if containsArr (envArr , AllEnvironment ) {
677
674
roleFilterMap [key ].Environment = AllEnvironment
@@ -692,7 +689,7 @@ func (impl UserCommonServiceImpl) GetUniqueKeyForAllEntity(role repository.RoleM
692
689
} else if role .Entity == bean2 .EntityJobs {
693
690
key = fmt .Sprintf ("%s_%s_%s_%s" , role .Team , role .Action , role .AccessType , role .Entity )
694
691
} else if len (role .Entity ) > 0 {
695
- if role .Entity == bean .CLUSTER_ENTITIY {
692
+ if role .Entity == bean2 .CLUSTER_ENTITIY {
696
693
key = fmt .Sprintf ("%s_%s_%s_%s_%s" , role .Entity , role .Action , role .Cluster ,
697
694
role .Group , role .Kind )
698
695
} else {
0 commit comments