Add user role service validation

This commit is contained in:
Peter Maquiran
2021-07-29 20:40:04 +01:00
parent 06cccbc1c2
commit 630fe0b1fb
2 changed files with 9 additions and 4 deletions
+8 -3
View File
@@ -13,21 +13,26 @@ export class PermissionService {
userRole(args) {
let data: string[] = []
if(!Array.isArray(args) && typeof(args) == 'string') {
if(!Array.isArray(args) && typeof(args) == 'string') {
data = [args]
} else {
data = args
}
console.log('==!!==',data, this.userStore.user.Profile)
return data.includes(this.userStore.user.Profile)
}
role(args: any) {
let UserRoleIsValid = this.userRole(args)
return {
permissionAnyOf(role) {
if(!Array.isArray(role) && typeof(role) == 'string') {
role = [role]
if(!Array.isArray(args) && typeof(args) == 'string') {
role = [args]
}
if(!UserRoleIsValid) {return false }