import { Injectable } from '@angular/core'; import { UserStore } from 'src/app/store/user.service' @Injectable({ providedIn: 'root' }) export class PermissionService { userStore = UserStore constructor() { } userRole(args) { let data: string[] = [] if(!Array.isArray(args) && typeof(args) == 'string') { data = [args] } else { data = args } return data.includes(this.userStore.user.Profile) } role(args: any) { let UserRoleIsValid = this.userRole(args) return { permissionAnyOf(role) { if(!Array.isArray(args) && typeof(args) == 'string') { role = [args] } if(!UserRoleIsValid) {return false } return true } } } }