MC/website/node/organisation-native-projection.mjs

7 lines
454 B
JavaScript

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