From f3be83dfa3003a03ed5c9b8a9ba52fcc1d1aa239 Mon Sep 17 00:00:00 2001 From: Jared Date: Wed, 1 Feb 2023 00:18:30 -0500 Subject: [PATCH] Edited modify user section --- src/api/composed.ts | 5 ++ src/api/types.ts | 10 ++++ src/router/index.ts | 24 +++++++-- src/views/AdminDashboardView.vue | 5 +- src/views/AdminView.vue | 12 +++-- src/views/ModifyUserView.vue | 83 ++++++++++++++++++++++++++++++++ 6 files changed, 131 insertions(+), 8 deletions(-) create mode 100644 src/views/ModifyUserView.vue diff --git a/src/api/composed.ts b/src/api/composed.ts index 366324e..29db448 100644 --- a/src/api/composed.ts +++ b/src/api/composed.ts @@ -20,6 +20,7 @@ import { GetRewardFundResponse, GetRewardFundsRequest, GetRewardFundsResponse, + GetUsersResponse, LoginResponse, NearlyCompleteFundsRequest, NearlyCompleteFundsResponse, @@ -31,6 +32,8 @@ import { const controller = new SignetRequestController(); +export const usersExist = () => controller.post('/UsersExist', null); + export const register = (username: string, password: string) => controller.post('Register', { username, password, @@ -128,3 +131,5 @@ export const distributeRewardFund = (rewardFundID: number, payments: RewardDistr payments, distribute, }); + +export const getUsers = () => controller.post('GetUsers', null); diff --git a/src/api/types.ts b/src/api/types.ts index c33d72b..e714a13 100644 --- a/src/api/types.ts +++ b/src/api/types.ts @@ -208,3 +208,13 @@ export interface DistributeRewardsRequest { payments: RewardDistributionInfo[]; distribute: boolean; } + +export interface User { + username: string, + password: string, + admin: number, +} + +export interface GetUsersResponse { + users: User[]; +} diff --git a/src/router/index.ts b/src/router/index.ts index 470b5e5..93ba92b 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -13,10 +13,11 @@ import HomeView from '@/views/HomeView.vue'; import FundView from '@/views/FundView.vue'; import AddFundView from '@/views/AddFundView.vue'; import hasPermission from '@/lib/auth'; -import SignetRequestController from '@/api/requests'; import AdminView from '@/views/AdminView.vue'; import ModifyQueueView from '@/views/ModifyQueueView.vue'; import AdminDashboardView from '@/views/AdminDashboardView.vue'; +import { usersExist } from '@/api/composed'; +import ModifyUserView from '@/views/ModifyUserView.vue'; const routes: Array = [ { @@ -44,8 +45,7 @@ const routes: Array = [ meta: { requiredRights: Privileges.AdminPlus, accessible: async () => { - const controller = new SignetRequestController(); - const canProceed = await controller.post('/UsersExist', null); + const canProceed = await usersExist(); return canProceed?.success; }, title: 'Register', @@ -102,6 +102,24 @@ const routes: Array = [ title: 'Add Group Fund', }, }, + { + path: 'adduser', + name: 'adduser', + component: RegisterView, + meta: { + requiredRights: Privileges.AdminPlus, + title: 'Add User', + }, + }, + { + path: 'modifyuser', + name: 'modifyuser', + component: ModifyUserView, + meta: { + requiredRights: Privileges.AdminPlus, + title: 'Modify User', + }, + }, ], meta: { requiredRights: Privileges.Admin, diff --git a/src/views/AdminDashboardView.vue b/src/views/AdminDashboardView.vue index 998b3c8..54276e8 100644 --- a/src/views/AdminDashboardView.vue +++ b/src/views/AdminDashboardView.vue @@ -3,12 +3,15 @@
+
diff --git a/src/views/AdminView.vue b/src/views/AdminView.vue index fd3921e..5ac7f5b 100644 --- a/src/views/AdminView.vue +++ b/src/views/AdminView.vue @@ -29,14 +29,18 @@ const links = [ text: 'Add Fund', to: '/admin/addfund', }, - { - text: 'Modify Fund', - to: '/admin/modifyfund', - }, { text: 'Add/Modify Queue', to: '/admin/modifyqueue', }, + { + text: 'Add User', + to: '/admin/adduser', + }, + { + text: 'Modify User', + to: '/admin/modifyuser', + }, ]; diff --git a/src/views/ModifyUserView.vue b/src/views/ModifyUserView.vue new file mode 100644 index 0000000..50f1b68 --- /dev/null +++ b/src/views/ModifyUserView.vue @@ -0,0 +1,83 @@ + + + + +