mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-20 05:16:07 +00:00
further improvements in permission
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user