From 42cb946a6b9511e7f154bcaa1c347a470609d8da Mon Sep 17 00:00:00 2001 From: Ratheesh kumar R Date: Thu, 1 Feb 2024 15:07:42 -0800 Subject: [PATCH 1/8] DESENG-476: Updating superuser to administrator in met-api --- met-api/src/met_api/services/engagement_service.py | 2 +- met-api/src/met_api/services/membership_service.py | 2 +- met-api/src/met_api/services/staff_user_service.py | 2 +- met-api/src/met_api/utils/constants.py | 2 +- met-api/src/met_api/utils/enums.py | 2 +- met-api/src/met_api/utils/roles.py | 2 +- met-api/src/met_api/utils/tenant_validator.py | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/met-api/src/met_api/services/engagement_service.py b/met-api/src/met_api/services/engagement_service.py index cb05061cf..0895c15b3 100644 --- a/met-api/src/met_api/services/engagement_service.py +++ b/met-api/src/met_api/services/engagement_service.py @@ -95,7 +95,7 @@ def _attach_banner_url(self, engagements: list): @staticmethod def _get_scope_options(user_roles, has_team_access): if Role.VIEW_PRIVATE_ENGAGEMENTS.value in user_roles: - # If user has VIEW_PRIVATE_ENGAGEMENTS, e.g. Superuser role, return unrestricted scope options + # If user has VIEW_PRIVATE_ENGAGEMENTS, e.g. Administrator role, return unrestricted scope options return EngagementScopeOptions(restricted=False) if has_team_access: # return those engagements where user has access for edit members.. diff --git a/met-api/src/met_api/services/membership_service.py b/met-api/src/met_api/services/membership_service.py index dc5ae06b5..89adf8fea 100644 --- a/met-api/src/met_api/services/membership_service.py +++ b/met-api/src/met_api/services/membership_service.py @@ -58,7 +58,7 @@ def _validate_create_membership(engagement_id, user_details): groups = user_details.get('groups') if KeycloakGroups.EAO_IT_ADMIN.value in groups: raise BusinessException( - error='This user is already a Superuser.', + error='This user is already a Administrator.', status_code=HTTPStatus.CONFLICT.value) existing_membership = MembershipModel.find_by_engagement_and_user_id( diff --git a/met-api/src/met_api/services/staff_user_service.py b/met-api/src/met_api/services/staff_user_service.py index 4c0faa080..00bd5cc79 100644 --- a/met-api/src/met_api/services/staff_user_service.py +++ b/met-api/src/met_api/services/staff_user_service.py @@ -188,5 +188,5 @@ def validate_user(db_user: StaffUserModel): group_names = [group.get('name') for group in groups] if KeycloakGroupName.EAO_IT_ADMIN.value in group_names: raise BusinessException( - error='This user is already a Superuser.', + error='This user is already a Administrator.', status_code=HTTPStatus.CONFLICT.value) diff --git a/met-api/src/met_api/utils/constants.py b/met-api/src/met_api/utils/constants.py index 4ef88d2fc..07c82c28b 100644 --- a/met-api/src/met_api/utils/constants.py +++ b/met-api/src/met_api/utils/constants.py @@ -19,7 +19,7 @@ class Groups(Enum): """Enumeration representing user groups.""" - EAO_IT_ADMIN = 'Superuser' + EAO_IT_ADMIN = 'Administrator' EAO_TEAM_MEMBER = 'Team Member' EAO_REVIEWER = 'Reviewer' EAO_IT_VIEWER = 'Viewer' diff --git a/met-api/src/met_api/utils/enums.py b/met-api/src/met_api/utils/enums.py index ef2528457..93fe76cd7 100644 --- a/met-api/src/met_api/utils/enums.py +++ b/met-api/src/met_api/utils/enums.py @@ -62,7 +62,7 @@ class LoginSource(Enum): class KeycloakGroups(Enum): """Login Source.""" - EAO_IT_ADMIN = 'Superuser' + EAO_IT_ADMIN = 'Administrator' EAO_IT_VIEWER = 'Viewer' EAO_TEAM_MEMBER = 'Member' EAO_REVIEWER = 'Reviewer' diff --git a/met-api/src/met_api/utils/roles.py b/met-api/src/met_api/utils/roles.py index 957d798c4..a215e072d 100644 --- a/met-api/src/met_api/utils/roles.py +++ b/met-api/src/met_api/utils/roles.py @@ -44,7 +44,7 @@ class Role(Enum): ACCESS_DASHBOARD = 'access_dashboard' VIEW_MEMBERS = 'view_members' EDIT_MEMBERS = 'edit_members' - VIEW_ALL_SURVEYS = 'view_all_surveys' # Super user can view all kind of surveys including hidden + VIEW_ALL_SURVEYS = 'view_all_surveys' # Administrator can view all kind of surveys including hidden EDIT_ALL_SURVEYS = 'edit_all_surveys' EDIT_DRAFT_ENGAGEMENT = 'edit_draft_engagement' EDIT_SCHEDULED_ENGAGEMENT = 'edit_scheduled_engagement' diff --git a/met-api/src/met_api/utils/tenant_validator.py b/met-api/src/met_api/utils/tenant_validator.py index 80d64b6e4..f03dec9e5 100644 --- a/met-api/src/met_api/utils/tenant_validator.py +++ b/met-api/src/met_api/utils/tenant_validator.py @@ -34,7 +34,7 @@ def require_role(role, skip_tenant_check_for_admin=False): role (str): The role that the user is required to have. skip_tenant_check_for_admin (bool, optional): A flag to indicate whether to skip tenant checks for MET Admins. If set to True, tenant checks are skipped for users with MET administrative privileges. - Defaults to False. Set it to True for cross tenant operations like first time adding a super user to tenant. + Defaults to False. Set it to True for cross tenant operations like first time adding a administrator to tenant. Returns: function: A decorator function that can be used to enforce role-based authorization. From 329695ce81035c3babe46559320b2c3321a2b82e Mon Sep 17 00:00:00 2001 From: Ratheesh kumar R Date: Thu, 1 Feb 2024 15:12:34 -0800 Subject: [PATCH 2/8] DESENG-476: Superuser to Administrator in met-web --- met-web/src/components/engagement/view/PreviewBanner.tsx | 2 +- met-web/src/components/survey/building/index.tsx | 2 +- met-web/src/components/survey/listing/Surveys.tsx | 2 +- .../src/components/userManagement/listing/AssignRoleModal.tsx | 2 +- .../src/components/userManagement/listing/ReassignRoleModal.tsx | 2 +- met-web/src/models/user.ts | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/met-web/src/components/engagement/view/PreviewBanner.tsx b/met-web/src/components/engagement/view/PreviewBanner.tsx index 125cb5e37..8de9603ea 100644 --- a/met-web/src/components/engagement/view/PreviewBanner.tsx +++ b/met-web/src/components/engagement/view/PreviewBanner.tsx @@ -150,7 +150,7 @@ export const PreviewBanner = () => { - A Superuser can schedule the engagement when ready. + An Administrator can schedule the engagement when ready. diff --git a/met-web/src/components/survey/building/index.tsx b/met-web/src/components/survey/building/index.tsx index 38bcd3e38..9ab2bf4fc 100644 --- a/met-web/src/components/survey/building/index.tsx +++ b/met-web/src/components/survey/building/index.tsx @@ -391,7 +391,7 @@ const SurveyFormBuilder = () => { /> { <> Hidden

- This survey is only visible to Superusers. Toggle off on the survey edit page to + This survey is only visible to Administrators. Toggle off on the survey edit make it ready and available.

diff --git a/met-web/src/components/userManagement/listing/AssignRoleModal.tsx b/met-web/src/components/userManagement/listing/AssignRoleModal.tsx index cec125fca..6a2ce5f90 100644 --- a/met-web/src/components/userManagement/listing/AssignRoleModal.tsx +++ b/met-web/src/components/userManagement/listing/AssignRoleModal.tsx @@ -217,7 +217,7 @@ export const AssignRoleModal = () => { } - label={'Superuser'} + label={'Administrator'} /> diff --git a/met-web/src/components/userManagement/listing/ReassignRoleModal.tsx b/met-web/src/components/userManagement/listing/ReassignRoleModal.tsx index 43de0b218..da0d49f2f 100644 --- a/met-web/src/components/userManagement/listing/ReassignRoleModal.tsx +++ b/met-web/src/components/userManagement/listing/ReassignRoleModal.tsx @@ -115,7 +115,7 @@ export const ReassignRoleModal = () => { } - label={'Superuser'} + label={'Administrator'} /> diff --git a/met-web/src/models/user.ts b/met-web/src/models/user.ts index 241034f11..235e24dbb 100644 --- a/met-web/src/models/user.ts +++ b/met-web/src/models/user.ts @@ -3,7 +3,7 @@ export type UserGroup = 'EAO_IT_ADMIN' | 'EAO_IT_VIEWER' | 'EAO_TEAM_MEMBER' | ' export const USER_GROUP: { [x: string]: { value: UserGroup; label: string } } = { ADMIN: { value: 'EAO_IT_ADMIN', - label: 'Superuser', + label: 'Administrator', }, VIEWER: { value: 'EAO_IT_VIEWER', From 58ffb29d907988c9ba43a8215655c6e61c41b904 Mon Sep 17 00:00:00 2001 From: Ratheesh kumar R Date: Mon, 5 Feb 2024 10:15:11 -0800 Subject: [PATCH 3/8] Update changelog --- CHANGELOG.MD | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.MD b/CHANGELOG.MD index e34671060..9d520f5b6 100644 --- a/CHANGELOG.MD +++ b/CHANGELOG.MD @@ -1,3 +1,6 @@ +## February 05, 2024 +- **Task** Change "Superuser" to "Administrator" [DESENG-476](https://apps.itsm.gov.bc.ca/jira/browse/DESENG-476) + ## February 01, 2024 - **Task** Change name from "Engagement Core" to "Engagement Content". [🎟️DESENG-489](https://apps.itsm.gov.bc.ca/jira/browse/DESENG-489) From ce621c028030f646ebce158a3ca85aa59c9f89b7 Mon Sep 17 00:00:00 2001 From: Ratheesh kumar R Date: Mon, 5 Feb 2024 10:35:05 -0800 Subject: [PATCH 4/8] Fixing lint --- met-api/src/met_api/utils/tenant_validator.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/met-api/src/met_api/utils/tenant_validator.py b/met-api/src/met_api/utils/tenant_validator.py index f03dec9e5..371565fd2 100644 --- a/met-api/src/met_api/utils/tenant_validator.py +++ b/met-api/src/met_api/utils/tenant_validator.py @@ -32,12 +32,16 @@ def require_role(role, skip_tenant_check_for_admin=False): Args: role (str): The role that the user is required to have. - skip_tenant_check_for_admin (bool, optional): A flag to indicate whether to skip tenant checks for MET Admins. - If set to True, tenant checks are skipped for users with MET administrative privileges. - Defaults to False. Set it to True for cross tenant operations like first time adding a administrator to tenant. + skip_tenant_check_for_admin (bool, optional): A flag to indicate + whether to skip tenant checks for MET Admins. + If set to True, tenant checks are skipped for users with MET + administrative privileges. + Defaults to False. Set it to True for cross tenant operations + like first time adding a administrator to tenant. Returns: - function: A decorator function that can be used to enforce role-based authorization. + function: A decorator function that can be used to enforce + role-based authorization. """ def decorator(func): From 4d6bfa9e51273940c97950d5f90a90ae8347d528 Mon Sep 17 00:00:00 2001 From: Ratheesh kumar R <108045773+ratheesh-aot@users.noreply.github.com> Date: Mon, 5 Feb 2024 16:56:52 -0800 Subject: [PATCH 5/8] Correcting grammar issue Co-authored-by: Baelx <16845197+Baelx@users.noreply.github.com> --- met-api/src/met_api/services/membership_service.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/met-api/src/met_api/services/membership_service.py b/met-api/src/met_api/services/membership_service.py index 89adf8fea..d8015d4b1 100644 --- a/met-api/src/met_api/services/membership_service.py +++ b/met-api/src/met_api/services/membership_service.py @@ -58,7 +58,7 @@ def _validate_create_membership(engagement_id, user_details): groups = user_details.get('groups') if KeycloakGroups.EAO_IT_ADMIN.value in groups: raise BusinessException( - error='This user is already a Administrator.', + error='This user is already an Administrator.', status_code=HTTPStatus.CONFLICT.value) existing_membership = MembershipModel.find_by_engagement_and_user_id( From a607771b6e3c2c88d75fbba5bd98855cd260d20d Mon Sep 17 00:00:00 2001 From: Ratheesh kumar R <108045773+ratheesh-aot@users.noreply.github.com> Date: Mon, 5 Feb 2024 16:57:05 -0800 Subject: [PATCH 6/8] Correcting grammar issue Co-authored-by: Baelx <16845197+Baelx@users.noreply.github.com> --- met-api/src/met_api/services/staff_user_service.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/met-api/src/met_api/services/staff_user_service.py b/met-api/src/met_api/services/staff_user_service.py index 00bd5cc79..e7f7ba83b 100644 --- a/met-api/src/met_api/services/staff_user_service.py +++ b/met-api/src/met_api/services/staff_user_service.py @@ -188,5 +188,5 @@ def validate_user(db_user: StaffUserModel): group_names = [group.get('name') for group in groups] if KeycloakGroupName.EAO_IT_ADMIN.value in group_names: raise BusinessException( - error='This user is already a Administrator.', + error='This user is already an Administrator.', status_code=HTTPStatus.CONFLICT.value) From 7655bbba92959756dee9a1e04ee82e8ffb4e0dc3 Mon Sep 17 00:00:00 2001 From: Ratheesh kumar R <108045773+ratheesh-aot@users.noreply.github.com> Date: Mon, 5 Feb 2024 16:58:02 -0800 Subject: [PATCH 7/8] Update survey hidden info message Co-authored-by: Baelx <16845197+Baelx@users.noreply.github.com> --- met-web/src/components/survey/listing/Surveys.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/met-web/src/components/survey/listing/Surveys.tsx b/met-web/src/components/survey/listing/Surveys.tsx index f7c0c60c4..18e33dc0a 100644 --- a/met-web/src/components/survey/listing/Surveys.tsx +++ b/met-web/src/components/survey/listing/Surveys.tsx @@ -114,7 +114,7 @@ const Surveys = () => { <> Hidden

- This survey is only visible to Administrators. Toggle off on the survey edit + This survey is only visible to Administrators. Disable this setting to have it be visible to team members and viewers. make it ready and available.

From 1291d7c1726ce7486957bc3b6b7ffff2e7fc4490 Mon Sep 17 00:00:00 2001 From: Ratheesh kumar R Date: Mon, 5 Feb 2024 17:05:42 -0800 Subject: [PATCH 8/8] Update survey message linting --- met-web/src/components/survey/listing/Surveys.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/met-web/src/components/survey/listing/Surveys.tsx b/met-web/src/components/survey/listing/Surveys.tsx index 18e33dc0a..311c5f03b 100644 --- a/met-web/src/components/survey/listing/Surveys.tsx +++ b/met-web/src/components/survey/listing/Surveys.tsx @@ -114,8 +114,8 @@ const Surveys = () => { <> Hidden

- This survey is only visible to Administrators. Disable this setting to have it be visible to team members and viewers. - make it ready and available. + This survey is only visible to Administrators. Disable this setting to have it + visible to team members and viewers.

}