mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 13:02:56 +00:00
Add user role service validation
This commit is contained in:
@@ -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 }
|
||||
|
||||
Reference in New Issue
Block a user