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 @@ + + + + +