further improvements in permission

This commit is contained in:
tiago.kayaya
2022-03-30 15:08:23 +01:00
parent 5ff9ba77cb
commit 236cc86fbf
14 changed files with 66 additions and 33 deletions
+8 -7
View File
@@ -4,7 +4,7 @@ import { Observable } from 'rxjs';
import { SessionStore } from '../store/session.service';
import { AlertController, Platform } from '@ionic/angular';
import { PermissionService } from '../services/permission.service';
import { PermissionList } from '../models/permissionList';
import { PermissionList } from '../models/permission/permissionList';
@Injectable({
providedIn: 'root'
@@ -24,13 +24,14 @@ export class InactivityGuard implements CanActivate {
state: RouterStateSnapshot): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree {
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
if(this.permissionService.userPermission(this.permissionList.Agenda) || this.permissionService.userPermission(this.permissionList.Gabinete)){
console.log(this.permissionList);
if(this.permissionService.userPermission(this.permissionList.Agenda.access) || this.permissionService.userPermission(this.permissionList.Gabinete.access)){
this.router.navigate(['/home/events']);
}
else if(this.permissionService.userPermission(this.permissionList.Chat)){
else if(this.permissionService.userPermission(this.permissionList.Chat.access) && this.permissionService.userPermission(this.permissionList.Actions.access)){
this.router.navigate(['/home/chat']);
}
else if(this.permissionService.userPermission(this.permissionList.Actions)){
else if(this.permissionService.userPermission(this.permissionList.Actions.access)){
this.router.navigate(['/home/publications']);
}
return false
@@ -40,13 +41,13 @@ export class InactivityGuard implements CanActivate {
return true
}//Mobile or Tablet without session
else {
if(this.permissionService.userPermission(this.permissionList.Agenda) || this.permissionService.userPermission(this.permissionList.Gabinete)){
if(this.permissionService.userPermission(this.permissionList.Agenda.access) || this.permissionService.userPermission(this.permissionList.Gabinete.access)){
this.router.navigate(['/home/events']);
}
else if(this.permissionService.userPermission(this.permissionList.Chat)){
else if(this.permissionService.userPermission(this.permissionList.Chat.access) && this.permissionService.userPermission(this.permissionList.Actions.access)){
this.router.navigate(['/home/chat']);
}
else if(this.permissionService.userPermission(this.permissionList.Actions)){
else if(this.permissionService.userPermission(this.permissionList.Actions.access)){
this.router.navigate(['/home/publications']);
}
return false