This commit is contained in:
Peter Maquiran
2022-12-19 17:04:21 +01:00
parent 7543f319b8
commit 2b85796a5f
15 changed files with 325 additions and 416 deletions
+8 -5
View File
@@ -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
}
}