Add frontend permission checks
LocationBasedServices/smartguide/pipeline/head This commit looks good
LocationBasedServices/smartguide/pipeline/head This commit looks good
This commit is contained in:
@@ -14,6 +14,7 @@ export interface AccountProfile {
|
||||
email: string;
|
||||
name: string;
|
||||
role: UserRole;
|
||||
permissions?: Array<string>;
|
||||
organization_id: string;
|
||||
organization_name: string;
|
||||
deleted: boolean;
|
||||
|
||||
@@ -83,6 +83,22 @@ export class CredentialService {
|
||||
() => this.accountProfile()?.organization_name ?? '',
|
||||
);
|
||||
|
||||
public readonly permissions = computed(
|
||||
() => this.accountProfile()?.permissions ?? [],
|
||||
);
|
||||
|
||||
public readonly canReadAccounts = computed(() =>
|
||||
this.permissions().includes('READ_ACCOUNTS'),
|
||||
);
|
||||
|
||||
public readonly canManageAccounts = computed(() =>
|
||||
this.permissions().includes('MANAGE_ACCOUNTS'),
|
||||
);
|
||||
|
||||
public readonly canManageOrganizations = computed(() =>
|
||||
this.permissions().includes('MANAGE_ORGANIZATIONS'),
|
||||
);
|
||||
|
||||
public readonly realAccountId = computed(
|
||||
() => this.accessToken()?.real_account_id ?? '',
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user