From b318a9f08c2c850a5aa7b587434ca8f6a98add9a Mon Sep 17 00:00:00 2001 From: Sanjay Babu Date: Wed, 3 Jul 2024 07:43:48 -0700 Subject: [PATCH] User management - Front-end --- frontend/src/components/layout/Navbar.vue | 1 + .../src/components/user/UserCreateModal.vue | 103 ++++++++++ .../src/components/user/UserManageModal.vue | 52 +++++ frontend/src/components/user/UserTable.vue | 147 +++++++++++++++ frontend/src/router/index.ts | 5 + frontend/src/services/permissionService.ts | 4 +- frontend/src/types/User.ts | 2 + frontend/src/utils/constants/application.ts | 4 +- frontend/src/utils/enums/application.ts | 9 +- .../src/views/user/UserManagementView.vue | 178 ++++++++++++++++++ 10 files changed, 502 insertions(+), 3 deletions(-) create mode 100644 frontend/src/components/user/UserCreateModal.vue create mode 100644 frontend/src/components/user/UserManageModal.vue create mode 100644 frontend/src/components/user/UserTable.vue create mode 100644 frontend/src/views/user/UserManagementView.vue diff --git a/frontend/src/components/layout/Navbar.vue b/frontend/src/components/layout/Navbar.vue index 87ac3d61..d5877397 100644 --- a/frontend/src/components/layout/Navbar.vue +++ b/frontend/src/components/layout/Navbar.vue @@ -64,6 +64,7 @@ onMounted(() => { }, { label: 'User Management', + route: RouteName.USER_MANAGEMENT, access: Permissions.NAVIGATION_HOUSING_USER_MANAGEMENT }, { diff --git a/frontend/src/components/user/UserCreateModal.vue b/frontend/src/components/user/UserCreateModal.vue new file mode 100644 index 00000000..1959dd2d --- /dev/null +++ b/frontend/src/components/user/UserCreateModal.vue @@ -0,0 +1,103 @@ + + + diff --git a/frontend/src/components/user/UserManageModal.vue b/frontend/src/components/user/UserManageModal.vue new file mode 100644 index 00000000..bb0fa75b --- /dev/null +++ b/frontend/src/components/user/UserManageModal.vue @@ -0,0 +1,52 @@ + + + diff --git a/frontend/src/components/user/UserTable.vue b/frontend/src/components/user/UserTable.vue new file mode 100644 index 00000000..fe5da044 --- /dev/null +++ b/frontend/src/components/user/UserTable.vue @@ -0,0 +1,147 @@ + + + diff --git a/frontend/src/router/index.ts b/frontend/src/router/index.ts index d2594fee..f712249b 100644 --- a/frontend/src/router/index.ts +++ b/frontend/src/router/index.ts @@ -138,6 +138,11 @@ const routes: Array = [ } ] }, + { + path: '/user', + name: RouteName.USER_MANAGEMENT, + component: () => import('@/views/user/UserManagementView.vue') + }, { path: '/:pathMatch(.*)*', name: RouteName.NOT_FOUND, diff --git a/frontend/src/services/permissionService.ts b/frontend/src/services/permissionService.ts index 441501db..3d9b4866 100644 --- a/frontend/src/services/permissionService.ts +++ b/frontend/src/services/permissionService.ts @@ -27,6 +27,7 @@ export enum Permissions { NAVIGATION_HOUSING_SUBMISSIONS_SUB = 'housing.submissions.sub', NAVIGATION_HOUSING_STATUS_TRACKER = 'housing.status.tracker', NAVIGATION_HOUSING_USER_MANAGEMENT = 'housing.usermanagement', + NAVIGATION_HOUSING_USER_MANAGEMENT_ADMIN = 'housing.usermanagementadmin', NAVIGATION_DEVELOPER = 'developer', TESTING_ROLE_OVERRIDE = 'testing.role.override' @@ -46,7 +47,8 @@ const PermissionMap = [ Permissions.NAVIGATION_HOUSING_STATUS_TRACKER, Permissions.NAVIGATION_HOUSING_SUBMISSION, Permissions.NAVIGATION_HOUSING_SUBMISSIONS, - Permissions.NAVIGATION_HOUSING_USER_MANAGEMENT + Permissions.NAVIGATION_HOUSING_USER_MANAGEMENT, + Permissions.NAVIGATION_HOUSING_USER_MANAGEMENT_ADMIN ] }, { diff --git a/frontend/src/types/User.ts b/frontend/src/types/User.ts index c57fc372..48d0bdad 100644 --- a/frontend/src/types/User.ts +++ b/frontend/src/types/User.ts @@ -8,6 +8,8 @@ export type User = { identityId: string | null; idp: string; lastName: string; + role?: string; + status?: string; userId: string; username: string; elevatedRights: boolean; diff --git a/frontend/src/utils/constants/application.ts b/frontend/src/utils/constants/application.ts index 09e73932..14469a10 100644 --- a/frontend/src/utils/constants/application.ts +++ b/frontend/src/utils/constants/application.ts @@ -3,7 +3,7 @@ */ import { NIL } from 'uuid'; -import { AccessRole, BasicResponse } from '../enums/application'; +import { AccessRole, BasicResponse, Roles } from '../enums/application'; export const ACCESS_ROLES_LIST = [ AccessRole.PCNS_ADMIN, @@ -20,6 +20,8 @@ export const PCNS_CONTACT = { subject: 'Reporting an Issue with PCNS' }; +export const ROLES = [Roles.NAVIGATOR, Roles.READ_ONLY]; + export const SYSTEM_USER = NIL; export const YES_NO_LIST = [BasicResponse.YES, BasicResponse.NO]; diff --git a/frontend/src/utils/enums/application.ts b/frontend/src/utils/enums/application.ts index 8f01cca9..d0cac319 100644 --- a/frontend/src/utils/enums/application.ts +++ b/frontend/src/utils/enums/application.ts @@ -52,7 +52,14 @@ export enum RouteName { OIDC_CALLBACK = 'oidc_callback', OIDC_LOGIN = 'oidc_login', - OIDC_LOGOUT = 'oidc_logout' + OIDC_LOGOUT = 'oidc_logout', + + USER_MANAGEMENT = 'user_management' +} + +export enum Roles { + NAVIGATOR = 'Navigator', + READ_ONLY = 'Read-only' } export enum StorageKey { diff --git a/frontend/src/views/user/UserManagementView.vue b/frontend/src/views/user/UserManagementView.vue new file mode 100644 index 00000000..ceb2a698 --- /dev/null +++ b/frontend/src/views/user/UserManagementView.vue @@ -0,0 +1,178 @@ + + + +