MC/website/node/organisation-native-projection.mjs
2026-11-27 23:43:05 +00:00

8 lines
585 B
JavaScript

const localPrivilegeEditors=new Set(['web.forum.admin','web.tickets.admin','web.luckperms.edit','cp.luckperms.edit']);
export function nativeAgentIdentity(user,access){
const centralHuman=access.organisation?.mode==='active';
const supportOwner=centralHuman&&access.ranks.includes('org_owner_ceo');
return {...user,role:access.rank,ranks:access.ranks,
permissions:centralHuman?access.nodes.filter(n=>!localPrivilegeEditors.has(n)||supportOwner&&n==='web.tickets.admin'):access.nodes,
...(centralHuman?{organisation:access.organisation,nativePermissionManagement:false}:{} )};
}