add permission logic to nav bar.

This commit is contained in:
tiago.kayaya
2022-03-28 15:46:07 +01:00
parent ecdb4338f1
commit 420b203c0c
24 changed files with 130 additions and 109 deletions
@@ -1,42 +0,0 @@
import { Injectable } from '@angular/core';
import { SessionStore } from '../../store/session.service';
@Injectable({
providedIn: 'root'
})
export class PermissionService {
SessionStore = SessionStore
constructor() { }
userRole(args) {
if(!Array.isArray(args)) {
args = [args]
}
return args.includes(this.SessionStore.user.Profile)
}
role(args: any) {
let UserRoleIsValid = this.userRole(args)
return {
permissionAnyOf(role) {
if(!Array.isArray(role)) {
role = [role]
}
if(!UserRoleIsValid) {return false }
return true
}
}
}
}