Skip to content

Commit 4c59576

Browse files
fix: rolefilters correction with all applications and particular application selected. (#4820)
* merging issue resolved * all namespace, cluster, kind remove as it is used in key * removing unnecessary code
1 parent ef2bc39 commit 4c59576

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

pkg/auth/user/UserCommonService.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,9 @@ func (impl UserCommonServiceImpl) BuildRoleFilterKeyForJobs(roleFilterMap map[st
638638
roleFilterMap[key].Environment = fmt.Sprintf("%s,%s", roleFilterMap[key].Environment, role.Environment)
639639
}
640640
entityArr := strings.Split(roleFilterMap[key].EntityName, ",")
641-
if !containsArr(entityArr, role.EntityName) {
641+
if containsArr(entityArr, bean2.EmptyStringIndicatingAll) {
642+
roleFilterMap[key].EntityName = bean2.EmptyStringIndicatingAll
643+
} else if !containsArr(entityArr, role.EntityName) {
642644
roleFilterMap[key].EntityName = fmt.Sprintf("%s,%s", roleFilterMap[key].EntityName, role.EntityName)
643645
}
644646
workflowArr := strings.Split(roleFilterMap[key].Workflow, ",")
@@ -657,7 +659,9 @@ func (impl UserCommonServiceImpl) BuildRoleFilterKeyForOtherEntity(roleFilterMap
657659
roleFilterMap[key].Environment = fmt.Sprintf("%s,%s", roleFilterMap[key].Environment, role.Environment)
658660
}
659661
entityArr := strings.Split(roleFilterMap[key].EntityName, ",")
660-
if !containsArr(entityArr, role.EntityName) {
662+
if containsArr(entityArr, bean2.EmptyStringIndicatingAll) {
663+
roleFilterMap[key].EntityName = bean2.EmptyStringIndicatingAll
664+
} else if !containsArr(entityArr, role.EntityName) {
661665
roleFilterMap[key].EntityName = fmt.Sprintf("%s,%s", roleFilterMap[key].EntityName, role.EntityName)
662666
}
663667
}

pkg/auth/user/bean/bean.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ const (
3333
EMPTY_ROLEFILTER_ENTRY_PLACEHOLDER = "NONE"
3434
RoleNotFoundStatusPrefix = "role not fount for any given filter: "
3535
EntityJobs = "jobs"
36+
EmptyStringIndicatingAll = ""
3637
)
3738

3839
const (

0 commit comments

Comments
 (0)