Skip to content

Commit 4aef498

Browse files
committed
feat(rbac_nested): Reverse order users are assigned into nested groups to get the first user under deepest nesting
Signed-off-by: Pavel Macík <[email protected]>
1 parent 76ebccf commit 4aef498

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

ci-scripts/rhdh-setup/create_resource.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -417,10 +417,12 @@ create_user() {
417417
;;
418418
"$RBAC_POLICY_NESTED_GROUPS")
419419
[[ $grp -eq 0 ]] && grp=${GROUP_COUNT}
420-
if [[ $grp -eq 1 || $grp -gt ${RBAC_POLICY_SIZE} ]]; then
420+
if [[ $grp -eq $RBAC_POLICY_SIZE ]]; then
421+
groups="$groups\"g1\""
422+
elif [[ $grp -gt ${RBAC_POLICY_SIZE} ]]; then
421423
groups="$groups\"g${grp}\""
422424
else
423-
group_name="g$((grp - 1))_1"
425+
group_name="g$((RBAC_POLICY_SIZE - grp))_1"
424426
group_path=$(get_group_path_by_name "$group_name")
425427
groups="$groups\"$group_path\""
426428
fi

0 commit comments

Comments
 (0)