mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 12:37:53 +00:00
route permission
This commit is contained in:
@@ -32,34 +32,58 @@ export class AuthGuard implements CanActivate {
|
||||
this.router.navigate(['/']);
|
||||
return false
|
||||
} else {
|
||||
if(this.p.userPermission(this.p.permissionList.Chat.access) == true){
|
||||
if(this.p.userPermission(this.p.permissionList.Chat.access) == true) {
|
||||
this.authService.loginChat();
|
||||
}
|
||||
|
||||
const pathname = window.location.pathname
|
||||
|
||||
if(this.p.userPermission(this.p.permissionList.Agenda.access) && pathname.startsWith('/home/agenda')) {
|
||||
return true;
|
||||
} else if (this.p.userPermission(this.p.permissionList.Gabinete.access) && pathname.startsWith('/home/gabinete-digital')) {
|
||||
return true;
|
||||
}
|
||||
else if(this.p.userPermission(this.p.permissionList.Chat.access) && pathname.startsWith('/home/chat')) {
|
||||
return true;
|
||||
} else if(this.p.userPermission(this.p.permissionList.Actions.access) && pathname.startsWith('/home/publications')) {
|
||||
return true;
|
||||
} else if ((this.p.userPermission([this.p.permissionList.Agenda.access]) || this.p.userPermission([this.p.permissionList.Gabinete.access])) && pathname.startsWith('/home/events')) {
|
||||
if(this.p.userPermission(pathname.startsWith('/home/agenda'))) {
|
||||
|
||||
if(this.p.permissionList.Agenda.access) {
|
||||
return true;
|
||||
} else {
|
||||
this.router.navigate(['/login']);
|
||||
return false;
|
||||
}
|
||||
|
||||
} else if ( pathname.startsWith('/home/gabinete-digital')) {
|
||||
|
||||
if(this.p.userPermission(this.p.permissionList.Gabinete.access)) {
|
||||
return true;
|
||||
} else {
|
||||
this.router.navigate(['/login']);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if(pathname.startsWith('/home/chat')) {
|
||||
if(this.p.userPermission(this.p.permissionList.Gabinete.access)) {
|
||||
return true;
|
||||
} else {
|
||||
this.router.navigate(['/login']);
|
||||
return false;
|
||||
}
|
||||
} else if(pathname.startsWith('/home/publications')) {
|
||||
if(this.p.userPermission(this.p.permissionList.Actions.access)) {
|
||||
return true
|
||||
} else {
|
||||
this.router.navigate(['/login']);
|
||||
return false
|
||||
}
|
||||
} else if (pathname.startsWith('/home/events')) {
|
||||
if((this.p.userPermission([this.p.permissionList.Agenda.access]) || this.p.userPermission([this.p.permissionList.Gabinete.access]))) {
|
||||
return true
|
||||
} else {
|
||||
this.router.navigate(['/login']);
|
||||
return false
|
||||
}
|
||||
} else if (pathname == '/') {
|
||||
return true
|
||||
}
|
||||
else if (this.RouteService.history.length >= 1) {
|
||||
const pathName = this.RouteService.getLastRouteA()
|
||||
this.router.navigate([pathName]);
|
||||
} else {
|
||||
this.router.navigate(['/']);
|
||||
this.router.navigate(['/login']);
|
||||
return false
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user