Skip to content

Commit 9d6af84

Browse files
authored
[rbac] Fix permissions for high-privilege users (#1622)
## What this PR does This patch grants "admin" permissions to super-admins, "use" permissions to admins and super-admins, "view" permissions to "use"-privileged users, admins, and super-admins. Previously lower-privileged roles were not assigned to higher-privileged users, so a viewer could excercise their basic read-only permissions which were not available to high-privilege users. This patch corrects the template function used to generate subjects in rolebindings, fixing the issue. ### Release note ```release-note [rbac] Fix issue of privileged users not having low-privilege read-only permissions. ``` <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Updated access level handling in role-based authorization to ensure proper permission evaluation across tenant environments. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2 parents a861814 + 7ddd9cf commit 9d6af84

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

‎packages/apps/tenant/templates/tenant.yaml‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ metadata:
122122
name: {{ include "tenant.name" . }}-view
123123
namespace: {{ include "tenant.name" . }}
124124
subjects:
125-
{{ include "cozy-lib.rbac.subjectsForTenant" (list "view" (include "tenant.name" .)) | nindent 2 }}
125+
{{ include "cozy-lib.rbac.subjectsForTenantAndAccessLevel" (list "view" (include "tenant.name" .)) | nindent 2 }}
126126
roleRef:
127127
kind: Role
128128
name: {{ include "tenant.name" . }}-view
@@ -200,7 +200,7 @@ metadata:
200200
name: {{ include "tenant.name" . }}-use
201201
namespace: {{ include "tenant.name" . }}
202202
subjects:
203-
{{ include "cozy-lib.rbac.subjectsForTenant" (list "use" (include "tenant.name" .)) | nindent 2 }}
203+
{{ include "cozy-lib.rbac.subjectsForTenantAndAccessLevel" (list "use" (include "tenant.name" .)) | nindent 2 }}
204204
roleRef:
205205
kind: Role
206206
name: {{ include "tenant.name" . }}-use
@@ -299,7 +299,7 @@ metadata:
299299
name: {{ include "tenant.name" . }}-admin
300300
namespace: {{ include "tenant.name" . }}
301301
subjects:
302-
{{ include "cozy-lib.rbac.subjectsForTenant" (list "admin" (include "tenant.name" .)) | nindent 2 }}
302+
{{ include "cozy-lib.rbac.subjectsForTenantAndAccessLevel" (list "admin" (include "tenant.name" .)) | nindent 2 }}
303303
roleRef:
304304
kind: Role
305305
name: {{ include "tenant.name" . }}-admin
@@ -373,7 +373,7 @@ metadata:
373373
name: {{ include "tenant.name" . }}-super-admin
374374
namespace: {{ include "tenant.name" . }}
375375
subjects:
376-
{{ include "cozy-lib.rbac.subjectsForTenant" (list "super-admin" (include "tenant.name" .) ) | nindent 2 }}
376+
{{ include "cozy-lib.rbac.subjectsForTenantAndAccessLevel" (list "super-admin" (include "tenant.name" .) ) | nindent 2 }}
377377
roleRef:
378378
kind: Role
379379
name: {{ include "tenant.name" . }}-super-admin

0 commit comments

Comments
 (0)