supersam/src/utils/roleHelpers.js

16 lines
578 B
JavaScript

/**
* Role helpers for SuperSam.
* mega_admin inherits all admin permissions.
*/
/** Roles that have admin-level access (mega_admin is a superset of admin) */
export const ADMIN_ROLES = ['admin', 'mega_admin'];
/** Check if the given role has admin-level access */
export const isAdminRole = (role) => ADMIN_ROLES.includes(role);
/** Roles that can manage orders */
export const ORDER_MANAGER_ROLES = ['manager', 'logistician', 'admin', 'mega_admin'];
/** Check if the role can manage orders */
export const canManageOrders = (role) => ORDER_MANAGER_ROLES.includes(role);