25 lines
1.4 KiB
TypeScript
25 lines
1.4 KiB
TypeScript
/**
|
|
* Purpose: SHOPLESS_ADMIN_ALLOWED_PREFIXES supports platform-admin-permissions.ts by holding or executing the shopless admin allowed prefixes page or API role.
|
|
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
|
|
*/
|
|
const SHOPLESS_ADMIN_ALLOWED_PREFIXES = ['user:', 'shop:', 'permission:', 'message:', 'announcement:']
|
|
/**
|
|
* Purpose: SHOPLESS_ADMIN_ALLOWED_PERMISSIONS supports platform-admin-permissions.ts by holding or executing the shopless admin allowed permissions page or API role.
|
|
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
|
|
*/
|
|
const SHOPLESS_ADMIN_ALLOWED_PERMISSIONS = [
|
|
'messagehub:config:manage',
|
|
'security:audit:view',
|
|
'legal_agreement:manage'
|
|
]
|
|
|
|
/**
|
|
* Purpose: isAllowedForShoplessPlatformAdmin supports platform-admin-permissions.ts by holding or executing the is allowed for shopless platform admin page or API role.
|
|
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
|
|
*/
|
|
export const isAllowedForShoplessPlatformAdmin = (permissionCode: string) =>
|
|
permissionCode === 'dashboard:view'
|
|
|| permissionCode.endsWith(':view')
|
|
|| SHOPLESS_ADMIN_ALLOWED_PERMISSIONS.includes(permissionCode)
|
|
|| SHOPLESS_ADMIN_ALLOWED_PREFIXES.some(prefix => permissionCode.startsWith(prefix))
|