-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathroutes.js
122 lines (101 loc) · 2.83 KB
/
routes.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
/**
* An array of routes that are accessible to the public
* These routes do not require authentication
* @type {string[]}
*/
export const publicRoutes = ['/'];
/**
* An array of routes that are used for authentication
* These routes will redirect logged in users to /settings
* @type {string[]}
*/
export const authenticationRoutes = ['/login', '/error'];
/**
* The prefix for API authentication routes
* Routes that start with this prefix are used for API authentication purposes
* @type {string}
*/
export const apiPrefix = '/api/auth';
/**
* The default redirect path after logging in
* @type {string}
*/
export const DEFAULT_REDIRECT_PATH = '/dashboard';
/**
* Protected routes
* @type {string[]}
*/
export const protectedRoutes = ['/dashboard'];
/**
* Routes accessible to admin users
* @type {RegExp[]}
*/
export const ADMIN = [
/^\/dashboard\/?$/, // Matches "/dashboard" exactly and "/dashboard/"
/^\/dashboard\/manage\/?$/, // Matches "/dashboard/manage" exactly and "/dashboard/manage/"
/\/dashboard\/manage\/admin($|\/.*)/,
/\/dashboard\/manage\/assistant-manager($|\/.*)/,
/\/dashboard\/manage\/education-term($|\/.*)/,
/\/dashboard\/manage\/lesson($|\/.*)/,
/\/dashboard\/manage\/lesson-program($|\/.*)/,
/\/dashboard\/manage\/manager($|\/.*)/,
/\/dashboard\/manage\/message($|\/.*)/,
/\/dashboard\/manage\/student($|\/.*)/,
/\/dashboard\/manage\/teacher($|\/.*)/
];
/**
* Routes accessible to manager users
* @type {RegExp[]}
*/
export const MANAGER = [
/^\/dashboard\/?$/,
/^\/dashboard\/manage\/?$/,
/\/dashboard\/manage\/assistant-manager($|\/.*)/,
/\/dashboard\/manage\/message($|\/.*)/
];
/**
* Routes accessible to assistant manager users
* @type {RegExp[]}
*/
export const ASSISTANTMANAGER = [
/^\/dashboard\/?$/,
/^\/dashboard\/manage\/?$/,
/\/dashboard\/manage\/education-term($|\/.*)/,
/\/dashboard\/manage\/lesson($|\/.*)/,
/\/dashboard\/manage\/lesson-program($|\/.*)/,
/\/dashboard\/manage\/message($|\/.*)/,
/\/dashboard\/manage\/student($|\/.*)/,
/\/dashboard\/manage\/teacher($|\/.*)/
];
/**
* Routes accessible to teacher users
* @type {RegExp[]}
*/
export const TEACHER = [
/^\/dashboard\/?$/,
/^\/dashboard\/manage\/?$/,
/\/dashboard\/manage\/meeting($|\/.*)/,
/\/dashboard\/manage\/student-information($|\/.*)/
];
/**
* Routes accessible to student users
* @type {RegExp[]}
*/
export const STUDENT = [
/^\/dashboard\/?$/,
/^\/dashboard\/grades\/?$/,
/^\/dashboard\/lessons\/?$/,
/^\/dashboard\/meetings\/?$/,
/^\/dashboard\/choose-lesson\/?$/
];
/**
* Roles
* @type {{ADMIN: RegExp[], MANAGER: RegExp[], ASSISTANTMANAGER: RegExp[], TEACHER: RegExp[], STUDENT: RegExp[]}}
*/
export const rolePermissions = {
ADMIN,
MANAGER,
ASSISTANTMANAGER,
TEACHER,
STUDENT
};