@@ -4,6 +4,14 @@ import { RouterModule } from '@angular/router';
44import { MyRoute } from '@models/routes.model' ;
55
66import { SERV } from '@services/main.config' ;
7+ import { AgentBinaryRoleService } from '@services/roles/binaries/agent-binary-role.service' ;
8+ import { CrackerBinaryRoleService } from '@services/roles/binaries/cracker-binary-role.service' ;
9+ import { PreprocessorRoleService } from '@services/roles/binaries/preprocessor-role.service' ;
10+ import { HashTypesRoleService } from '@services/roles/config/hashtypes-role.service' ;
11+ import { HealthCheckRoleService } from '@services/roles/config/healthcheck-role.service' ;
12+ import { LogRoleService } from '@services/roles/config/log-role.service' ;
13+ import { NotificationsRoleService } from '@services/roles/config/notifications-role.service' ;
14+ import { SettingsRoleService } from '@services/roles/config/settings-role.service' ;
715
816import { FormComponent } from '@components/forms/simple-forms/form.component' ;
917import { FormConfigComponent } from '@components/forms/simple-forms/formconfig.component' ;
@@ -18,9 +26,8 @@ import { HealthChecksComponent } from '@src/app/config/health-checks/health-chec
1826import { NewHealthChecksComponent } from '@src/app/config/health-checks/new-health-check/new-health-checks.component' ;
1927import { ViewHealthChecksComponent } from '@src/app/config/health-checks/view-health-check/view-health-checks.component' ;
2028import { LogComponent } from '@src/app/config/log/log.component' ;
21- import { Perm } from '@src/app/core/_constants/userpermissions.config' ;
2229import { IsAuth } from '@src/app/core/_guards/auth.guard' ;
23- import { CheckPerm } from '@src/app/core/_guards/permission.guard' ;
30+ import { CheckRole } from '@src/app/core/_guards/permission.guard' ;
2431
2532const routes : MyRoute [ ] = [
2633 {
@@ -35,9 +42,10 @@ const routes: MyRoute[] = [
3542 type : 'edit' ,
3643 serviceConfig : SERV . CONFIGS ,
3744 breadcrumb : 'Agent Settings' ,
38- permission : Perm . Config . READ
45+ roleServiceClass : SettingsRoleService ,
46+ roleName : 'read'
3947 } ,
40- canActivate : [ CheckPerm ]
48+ canActivate : [ CheckRole ]
4149 } ,
4250 {
4351 path : 'task-chunk' ,
@@ -47,9 +55,10 @@ const routes: MyRoute[] = [
4755 type : 'edit' ,
4856 serviceConfig : SERV . CONFIGS ,
4957 breadcrumb : 'Task Chunk Settings' ,
50- permission : Perm . Config . READ
58+ roleServiceClass : SettingsRoleService ,
59+ roleName : 'read'
5160 } ,
52- canActivate : [ CheckPerm ]
61+ canActivate : [ CheckRole ]
5362 } ,
5463 {
5564 path : 'hch' ,
@@ -59,9 +68,10 @@ const routes: MyRoute[] = [
5968 type : 'edit' ,
6069 serviceConfig : SERV . CONFIGS ,
6170 breadcrumb : 'Hashes/Cracks/Hashlist Settings' ,
62- permission : Perm . Config . READ
71+ roleServiceClass : SettingsRoleService ,
72+ roleName : 'read'
6373 } ,
64- canActivate : [ CheckPerm ]
74+ canActivate : [ CheckRole ]
6575 } ,
6676 {
6777 path : 'notifications' ,
@@ -71,9 +81,10 @@ const routes: MyRoute[] = [
7181 type : 'edit' ,
7282 serviceConfig : SERV . CONFIGS ,
7383 breadcrumb : 'Notifications' ,
74- permission : Perm . Notif . READ
84+ roleServiceClass : NotificationsRoleService ,
85+ roleName : 'read'
7586 } ,
76- canActivate : [ CheckPerm ]
87+ canActivate : [ CheckRole ]
7788 } ,
7889 {
7990 path : 'general-settings' ,
@@ -83,19 +94,21 @@ const routes: MyRoute[] = [
8394 type : 'edit' ,
8495 serviceConfig : SERV . CONFIGS ,
8596 breadcrumb : 'General Settings' ,
86- permission : Perm . Config . READ
97+ roleServiceClass : SettingsRoleService ,
98+ roleName : 'read'
8799 } ,
88- canActivate : [ CheckPerm ]
100+ canActivate : [ CheckRole ]
89101 } ,
90102 {
91103 path : 'hashtypes' ,
92104 component : HashtypesComponent ,
93105 data : {
94106 kind : 'hashtypes' ,
95107 breadcrumb : 'Hashtypes' ,
96- permission : Perm . Hashtype . READ
108+ roleServiceClass : HashTypesRoleService ,
109+ roleName : 'read'
97110 } ,
98- canActivate : [ CheckPerm ]
111+ canActivate : [ CheckRole ]
99112 } ,
100113 {
101114 path : 'hashtypes/new' ,
@@ -105,9 +118,10 @@ const routes: MyRoute[] = [
105118 type : 'create' ,
106119 serviceConfig : SERV . HASHTYPES ,
107120 breadcrumb : 'New Hashtype' ,
108- permission : Perm . Hashtype . CREATE
121+ roleServiceClass : HashTypesRoleService ,
122+ roleName : 'create'
109123 } ,
110- canActivate : [ CheckPerm ]
124+ canActivate : [ CheckRole ]
111125 } ,
112126 {
113127 path : 'hashtypes/:id/edit' ,
@@ -117,59 +131,65 @@ const routes: MyRoute[] = [
117131 type : 'edit' ,
118132 serviceConfig : SERV . HASHTYPES ,
119133 breadcrumb : 'Edit Hashtype' ,
120- permission : Perm . Hashtype . READ
134+ roleServiceClass : HashTypesRoleService ,
135+ roleName : 'read'
121136 } ,
122- canActivate : [ CheckPerm ]
137+ canActivate : [ CheckRole ]
123138 } ,
124139 {
125140 path : 'log' ,
126141 component : LogComponent ,
127142 data : {
128143 kind : 'log' ,
129144 breadcrumb : 'Logs' ,
130- permission : Perm . Logs . READ
145+ roleServiceClass : LogRoleService ,
146+ roleName : 'read'
131147 } ,
132- canActivate : [ CheckPerm ]
148+ canActivate : [ CheckRole ]
133149 } ,
134150 {
135151 path : 'health-checks' ,
136152 component : HealthChecksComponent ,
137153 data : {
138154 kind : 'health-checks' ,
139155 breadcrumb : 'Health Checks' ,
140- permission : Perm . HealthCheck . READ
156+ roleServiceClass : HealthCheckRoleService ,
157+ roleName : 'read'
141158 } ,
142- canActivate : [ CheckPerm ]
159+ canActivate : [ CheckRole ]
143160 } ,
144161 {
145162 path : 'health-checks/new' ,
146163 component : NewHealthChecksComponent ,
147164 data : {
148165 kind : 'new-health-checks' ,
149166 breadcrumb : 'New Health Checks' ,
150- permission : Perm . HealthCheck . CREATE
167+ roleServiceClass : HealthCheckRoleService ,
168+ roleName : 'create'
151169 } ,
152- canActivate : [ CheckPerm ]
170+ canActivate : [ CheckRole ]
153171 } ,
154172 {
155173 path : 'health-checks/:id' ,
156174 component : ViewHealthChecksComponent ,
157175 data : {
158176 kind : 'view-health-checks' ,
159177 breadcrumb : 'View Health Checks' ,
160- permission : Perm . HealthCheck . READ
178+ roleServiceClass : HealthCheckRoleService ,
179+ roleName : 'read'
161180 } ,
162- canActivate : [ CheckPerm ]
181+ canActivate : [ CheckRole ]
163182 } ,
164183 {
165184 path : 'engine/agent-binaries' ,
166185 component : AgentBinariesComponent ,
167186 data : {
168187 kind : 'agent-binaries' ,
169188 breadcrumb : 'Engine > Agent-binaries' ,
170- permission : Perm . AgentBinary . READ
189+ roleServiceClass : AgentBinaryRoleService ,
190+ roleName : 'read'
171191 } ,
172- canActivate : [ CheckPerm ]
192+ canActivate : [ CheckRole ]
173193 } ,
174194 {
175195 path : 'engine/agent-binaries/new-agent-binary' ,
@@ -179,9 +199,10 @@ const routes: MyRoute[] = [
179199 type : 'create' ,
180200 serviceConfig : SERV . AGENT_BINARY ,
181201 breadcrumb : 'Engine > New Agent binary' ,
182- permission : Perm . HealthCheck . CREATE
202+ roleServiceClass : AgentBinaryRoleService ,
203+ roleName : 'create'
183204 } ,
184- canActivate : [ CheckPerm ]
205+ canActivate : [ CheckRole ]
185206 } ,
186207 {
187208 path : 'engine/agent-binaries/:id/edit' ,
@@ -191,19 +212,21 @@ const routes: MyRoute[] = [
191212 type : 'edit' ,
192213 serviceConfig : SERV . AGENT_BINARY ,
193214 breadcrumb : 'Engine > Edit Agent binary' ,
194- permission : Perm . AgentBinary . READ
215+ roleServiceClass : AgentBinaryRoleService ,
216+ roleName : 'read'
195217 } ,
196- canActivate : [ CheckPerm ]
218+ canActivate : [ CheckRole ]
197219 } ,
198220 {
199221 path : 'engine/crackers' ,
200222 component : CrackersComponent ,
201223 data : {
202224 kind : 'crackers' ,
203225 breadcrumb : 'Engine > Crackers' ,
204- permission : Perm . CrackerBinary . READ
226+ roleServiceClass : CrackerBinaryRoleService ,
227+ roleName : 'read'
205228 } ,
206- canActivate : [ CheckPerm ]
229+ canActivate : [ CheckRole ]
207230 } ,
208231 {
209232 path : 'engine/crackers/new' ,
@@ -213,9 +236,10 @@ const routes: MyRoute[] = [
213236 type : 'create' ,
214237 serviceConfig : SERV . CRACKERS_TYPES ,
215238 breadcrumb : 'Engine > New Cracker' ,
216- permission : Perm . CrackerBinary . CREATE
239+ roleServiceClass : CrackerBinaryRoleService ,
240+ roleName : 'create'
217241 } ,
218- canActivate : [ CheckPerm ]
242+ canActivate : [ CheckRole ]
219243 } ,
220244 {
221245 path : 'engine/crackers/:id/new' ,
@@ -225,9 +249,10 @@ const routes: MyRoute[] = [
225249 type : 'create' ,
226250 serviceConfig : SERV . CRACKERS ,
227251 breadcrumb : 'Engine > New Cracker Version/Binary' ,
228- permission : Perm . CrackerBinaryType . CREATE
252+ roleServiceClass : CrackerBinaryRoleService ,
253+ roleName : 'create'
229254 } ,
230- canActivate : [ CheckPerm ]
255+ canActivate : [ CheckRole ]
231256 } ,
232257 {
233258 path : 'engine/crackers/:id/edit' ,
@@ -237,19 +262,21 @@ const routes: MyRoute[] = [
237262 type : 'edit' ,
238263 serviceConfig : SERV . CRACKERS ,
239264 breadcrumb : 'Engine > Edit Cracker Version/Binary' ,
240- permission : Perm . CrackerBinaryType . READ
265+ roleServiceClass : CrackerBinaryRoleService ,
266+ roleName : 'read'
241267 } ,
242- canActivate : [ CheckPerm ]
268+ canActivate : [ CheckRole ]
243269 } ,
244270 {
245271 path : 'engine/preprocessors' ,
246272 component : PreprocessorsComponent ,
247273 data : {
248274 kind : 'preprocessors' ,
249275 breadcrumb : 'Engine > Preprocessors' ,
250- permission : Perm . Prepro . READ
276+ roleServiceClass : PreprocessorRoleService ,
277+ roleName : 'read'
251278 } ,
252- canActivate : [ CheckPerm ]
279+ canActivate : [ CheckRole ]
253280 } ,
254281 {
255282 path : 'engine/preprocessors/new-preprocessor' ,
@@ -259,9 +286,10 @@ const routes: MyRoute[] = [
259286 type : 'create' ,
260287 serviceConfig : SERV . PREPROCESSORS ,
261288 breadcrumb : 'Engine > New Preprocessor' ,
262- permission : Perm . Prepro . CREATE
289+ roleServiceClass : PreprocessorRoleService ,
290+ roleName : 'create'
263291 } ,
264- canActivate : [ CheckPerm ]
292+ canActivate : [ CheckRole ]
265293 } ,
266294 {
267295 path : 'engine/preprocessors/:id/edit' ,
@@ -271,9 +299,10 @@ const routes: MyRoute[] = [
271299 type : 'edit' ,
272300 serviceConfig : SERV . PREPROCESSORS ,
273301 breadcrumb : 'Engine > Edit Preprocessor' ,
274- permission : Perm . Prepro . READ
302+ roleServiceClass : PreprocessorRoleService ,
303+ roleName : 'read'
275304 } ,
276- canActivate : [ CheckPerm ]
305+ canActivate : [ CheckRole ]
277306 }
278307 ]
279308 }
0 commit comments