mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-20 21:35:50 +00:00
save
This commit is contained in:
@@ -21,25 +21,24 @@ export class AuthGuard implements CanActivate {
|
||||
canActivate(
|
||||
route: ActivatedRouteSnapshot,
|
||||
state: RouterStateSnapshot): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree {
|
||||
console.log('hire!', state.url)
|
||||
|
||||
// if user not active
|
||||
if(!SessionStore.user.Inactivity) {
|
||||
console.log(' goto login /')
|
||||
this.router.navigate(['/']);
|
||||
return false
|
||||
}
|
||||
// if session doesn't exit
|
||||
else if(!SessionStore.exist) {
|
||||
console.log(' goto /')
|
||||
this.router.navigate(['/']);
|
||||
return false
|
||||
} else {
|
||||
if(this.p.userPermission(this.p.permissionList.Chat.access) == true) {
|
||||
// this.authService.loginChat();
|
||||
}
|
||||
|
||||
const pathname = state.url
|
||||
|
||||
if(pathname.startsWith('/home/agenda')) {
|
||||
|
||||
if(this.p.userPermission(this.p.permissionList.Agenda.access)) {
|
||||
return true;
|
||||
} else {
|
||||
@@ -48,7 +47,7 @@ export class AuthGuard implements CanActivate {
|
||||
}
|
||||
|
||||
} else if ( pathname.startsWith('/home/gabinete-digital')) {
|
||||
console.log('gabinete');
|
||||
|
||||
|
||||
if(this.p.userPermission(this.p.permissionList.Gabinete.access)) {
|
||||
return true;
|
||||
@@ -73,6 +72,7 @@ export class AuthGuard implements CanActivate {
|
||||
}
|
||||
} else if (pathname.startsWith('/home/events')) {
|
||||
if(SessionStore.user.OwnerCalendars.length >= 1 || this.p.userPermission([this.p.permissionList.Gabinete.access])) {
|
||||
console.log('go /home/events')
|
||||
return true
|
||||
} else {
|
||||
this.router.navigate(['/login']);
|
||||
@@ -87,6 +87,9 @@ export class AuthGuard implements CanActivate {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user