From 23bdc0b4108d352d15385392775ccdec9fdd4578 Mon Sep 17 00:00:00 2001 From: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Date: Wed, 9 Mar 2022 12:50:55 +1000 Subject: [PATCH] Move access logic to org model (#713) --- common/src/models/domain/organization.ts | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/common/src/models/domain/organization.ts b/common/src/models/domain/organization.ts index 8a682212..70cd0d34 100644 --- a/common/src/models/domain/organization.ts +++ b/common/src/models/domain/organization.ts @@ -181,4 +181,27 @@ export class Organization { get isExemptFromPolicies() { return this.canManagePolicies; } + + get canAccessManageTab(): boolean { + return ( + this.canManageUsers || + this.canViewAllCollections || + this.canViewAssignedCollections || + this.canManageGroups || + this.canManagePolicies || + this.canAccessEventLogs + ); + } + + get canAccessToolsTab(): boolean { + return this.canAccessImportExport || this.canAccessReports; + } + + get canAccessSettingsTab(): boolean { + return this.isOwner; + } + + get canAccessAdminView() { + return this.canAccessManageTab || this.canAccessToolsTab || this.canAccessSettingsTab; + } }