Skip to content

Commit

Permalink
minor: added GrantedOwnerRole
Browse files Browse the repository at this point in the history
  • Loading branch information
dereekb committed Aug 9, 2022
1 parent c836d0c commit 989c9d5
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions packages/model/src/lib/service/permission/role.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,28 @@ export type GrantedRole = string;
export type GrantedSysAdminRole = typeof GRANTED_SYS_ADMIN_ROLE_KEY;
export const GRANTED_SYS_ADMIN_ROLE_KEY = 'sysadmin';

/**
* Communicates that the current context is an admin/owner.
*/
export type GrantedOwnerRole = typeof GRANTED_OWNER_ROLE_KEY;
export const GRANTED_OWNER_ROLE_KEY = 'owner';

/**
* Communicates that the current context is an admin.
*/
export type GrantedAdminRole = typeof GRANTED_ADMIN_ROLE_KEY;
export const GRANTED_ADMIN_ROLE_KEY = 'admin';

/**
* Returns true if the input role is a GrantedAdminRole or a GrantedOwnerRole.
*
* @param role
* @returns
*/
export function isGrantedAdminLevelRole(role: GrantedRole): boolean {
return role === GRANTED_ADMIN_ROLE_KEY || role === GRANTED_OWNER_ROLE_KEY;
}

/**
* Communicates that the current context has read access to a model.
*/
Expand Down

0 comments on commit 989c9d5

Please sign in to comment.