mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-20 21:35:50 +00:00
improve
This commit is contained in:
@@ -5,7 +5,7 @@ import { AuthService } from '../services/auth.service';
|
||||
import { PermissionService } from '../services/permission.service';
|
||||
import { LocalstoreService } from '../store/localstore.service';
|
||||
import { SessionStore } from '../store/session.service';
|
||||
|
||||
import { RouteService } from 'src/app/services/route.service'
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
@@ -15,6 +15,7 @@ export class AuthGuard implements CanActivate {
|
||||
private localstoreService: LocalstoreService,
|
||||
private authService: AuthService,
|
||||
public p: PermissionService,
|
||||
private RouteService: RouteService
|
||||
){}
|
||||
|
||||
canActivate(
|
||||
@@ -35,7 +36,30 @@ export class AuthGuard implements CanActivate {
|
||||
this.authService.loginChat();
|
||||
}
|
||||
|
||||
return true;
|
||||
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')) {
|
||||
|
||||
} 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(['/']);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user