Skip to content

Commit

Permalink
DESENG-476 - Superuser to Administrator (#2374)
Browse files Browse the repository at this point in the history
* DESENG-476: Updating superuser to administrator in met-api

* DESENG-476: Superuser to Administrator in met-web

* Update changelog

* Fixing lint

* Correcting grammar issue

Co-authored-by: Baelx <[email protected]>

* Correcting grammar issue

Co-authored-by: Baelx <[email protected]>

* Update survey hidden info message

Co-authored-by: Baelx <[email protected]>

* Update survey message linting

---------

Co-authored-by: Baelx <[email protected]>
  • Loading branch information
ratheesh-aot and Baelx authored Feb 6, 2024
1 parent 10bc112 commit c16efb8
Show file tree
Hide file tree
Showing 14 changed files with 24 additions and 17 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.MD
Original file line number Diff line number Diff line change
@@ -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 02, 2024
- **Task** Updated Timeline widget icons so that the circles are more consistent. [🎟️DESENG-488](https://apps.itsm.gov.bc.ca/jira/browse/DESENG-488)

Expand Down
2 changes: 1 addition & 1 deletion met-api/src/met_api/services/engagement_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -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..
Expand Down
2 changes: 1 addition & 1 deletion met-api/src/met_api/services/membership_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 an Administrator.',
status_code=HTTPStatus.CONFLICT.value)

existing_membership = MembershipModel.find_by_engagement_and_user_id(
Expand Down
2 changes: 1 addition & 1 deletion met-api/src/met_api/services/staff_user_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 an Administrator.',
status_code=HTTPStatus.CONFLICT.value)
2 changes: 1 addition & 1 deletion met-api/src/met_api/utils/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion met-api/src/met_api/utils/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion met-api/src/met_api/utils/roles.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
12 changes: 8 additions & 4 deletions met-api/src/met_api/utils/tenant_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 super user 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):
Expand Down
2 changes: 1 addition & 1 deletion met-web/src/components/engagement/view/PreviewBanner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ export const PreviewBanner = () => {
</IconButton>
</Grid>
<Grid item sm={11}>
<MetBody>A Superuser can schedule the engagement when ready.</MetBody>
<MetBody>An Administrator can schedule the engagement when ready.</MetBody>
</Grid>
</Grid>
</Grid>
Expand Down
2 changes: 1 addition & 1 deletion met-web/src/components/survey/building/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ const SurveyFormBuilder = () => {
/>
</FormGroup>
<Tooltip
title="When you toggle ON this option and save your Survey, your Survey will be 'Hidden'. When the toggle is ON and as long as the survey is not attached to an engagement, the Survey will only be visible to Superusers. When you are ready to make it available and able to be cloned or attached to an engagement, change the toggle to OFF and click the Save button."
title="When you toggle ON this option and save your Survey, your Survey will be 'Hidden'. When the toggle is ON and as long as the survey is not attached to an engagement, the Survey will only be visible to Administrators. When you are ready to make it available and able to be cloned or attached to an engagement, change the toggle to OFF and click the Save button."
placement="top"
componentsProps={{
tooltip: {
Expand Down
4 changes: 2 additions & 2 deletions met-web/src/components/survey/listing/Surveys.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ const Surveys = () => {
<>
<strong>Hidden</strong>
<p>
This survey is only visible to Superusers. Toggle off on the survey edit page to
make it ready and available.
This survey is only visible to Administrators. Disable this setting to have it
visible to team members and viewers.
</p>
</>
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ export const AssignRoleModal = () => {
<FormControlLabel
value={USER_GROUP.ADMIN.value}
control={<Radio />}
label={'Superuser'}
label={'Administrator'}
/>
</ControlledRadioGroup>
<When condition={Boolean(groupErrors)}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ export const ReassignRoleModal = () => {
<FormControlLabel
value={USER_GROUP.ADMIN.value}
control={<Radio />}
label={'Superuser'}
label={'Administrator'}
/>
</Unless>
</ControlledRadioGroup>
Expand Down
2 changes: 1 addition & 1 deletion met-web/src/models/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit c16efb8

Please sign in to comment.