Renamed groups to roles in the frontend

Working:
 Account
 Cost Centre
 Employee
 Product Group
 Product
 Role
 User
 Client
This commit is contained in:
tanshu
2020-05-12 01:31:21 +05:30
parent cd764be49c
commit 6dbab6442f
50 changed files with 272 additions and 295 deletions

View File

@ -15,13 +15,14 @@ export class AuthGuard implements CanActivate {
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) {
const user = this.authService.user;
const permission = route.data['permission'].replace(/ /g, '-').toLowerCase();
const permission = (route.data['permission'] === undefined) ? route.data['permission'] : route.data['permission']
.replace(/ /g, '-')
.toLowerCase();
if (!user) {
// not logged in so redirect to login page with the return url
this.router.navigate(['/login'], {queryParams: {returnUrl: state.url}});
return false;
}
console.log(permission, user.perms.indexOf(permission));
if (permission !== undefined && user.perms.indexOf(permission) === -1) {
this.toaster.show('Danger', 'You do not have the permission to access this area.');
return false;