From bb31e7ae88abf7d38833a749bd2a0944102adee3 Mon Sep 17 00:00:00 2001 From: Zack Lee Date: Thu, 3 Oct 2024 21:21:36 +0900 Subject: [PATCH] Disallow Importing Stratification Factors for Users with the 'Reader' Role --- .../projects/upgrade/src/app/core/auth/auth.service.ts | 4 ++++ .../upgrade/src/app/core/auth/store/auth.models.ts | 1 + .../stratification-factor-list.component.html | 1 + .../stratification-factor-list.component.ts | 9 +++++++-- 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/frontend/projects/upgrade/src/app/core/auth/auth.service.ts b/frontend/projects/upgrade/src/app/core/auth/auth.service.ts index dda59a64d6..996c6ce403 100644 --- a/frontend/projects/upgrade/src/app/core/auth/auth.service.ts +++ b/frontend/projects/upgrade/src/app/core/auth/auth.service.ts @@ -174,6 +174,7 @@ export class AuthService { case UserRole.ADMIN: this.userPermissions$.next({ experiments: { create: true, read: true, update: true, delete: true }, + stratifications: { create: true, read: true, update: true, delete: true }, users: { create: true, read: true, update: true, delete: true }, logs: { create: true, read: true, update: true, delete: true }, manageRoles: { create: true, read: true, update: true, delete: true }, @@ -185,6 +186,7 @@ export class AuthService { case UserRole.CREATOR: this.userPermissions$.next({ experiments: { create: true, read: true, update: true, delete: true }, + stratifications: { create: true, read: true, update: true, delete: true }, users: { create: true, read: true, update: true, delete: true }, logs: { create: false, read: true, update: false, delete: false }, manageRoles: { create: false, read: true, update: false, delete: false }, @@ -196,6 +198,7 @@ export class AuthService { case UserRole.USER_MANAGER: this.userPermissions$.next({ experiments: { create: false, read: true, update: false, delete: false }, + stratifications: { create: false, read: true, update: false, delete: false }, users: { create: true, read: true, update: true, delete: true }, logs: { create: false, read: true, update: false, delete: false }, manageRoles: { create: false, read: true, update: false, delete: false }, @@ -207,6 +210,7 @@ export class AuthService { case UserRole.READER: this.userPermissions$.next({ experiments: { create: false, read: true, update: false, delete: false }, + stratifications: { create: false, read: true, update: false, delete: false }, users: { create: false, read: true, update: false, delete: false }, logs: { create: false, read: true, update: false, delete: false }, manageRoles: { create: false, read: true, update: false, delete: false }, diff --git a/frontend/projects/upgrade/src/app/core/auth/store/auth.models.ts b/frontend/projects/upgrade/src/app/core/auth/store/auth.models.ts index 73558ed96c..17531522ab 100755 --- a/frontend/projects/upgrade/src/app/core/auth/store/auth.models.ts +++ b/frontend/projects/upgrade/src/app/core/auth/store/auth.models.ts @@ -10,6 +10,7 @@ interface CRUD { export interface UserPermission { experiments: CRUD; + stratifications: CRUD; users: CRUD; logs: CRUD; manageRoles: CRUD; diff --git a/frontend/projects/upgrade/src/app/features/dashboard/experiment-users/components/stratification-factor-list/stratification-factor-list.component.html b/frontend/projects/upgrade/src/app/features/dashboard/experiment-users/components/stratification-factor-list/stratification-factor-list.component.html index ef4ee2101a..8922aff294 100644 --- a/frontend/projects/upgrade/src/app/features/dashboard/experiment-users/components/stratification-factor-list/stratification-factor-list.component.html +++ b/frontend/projects/upgrade/src/app/features/dashboard/experiment-users/components/stratification-factor-list/stratification-factor-list.component.html @@ -5,6 +5,7 @@

{{ 'users.stratification-users-title.text' | translate }}<