From the reference libraryFiveM

server.cfg, required for access to ExecuteCommand

fivem-docs/docs/cookbook/2021/07/17/quick-note-on-using-built-in-acl-security.md

server.cfg, required for access to ExecuteCommand

add_ace resource.myframework command.add_principal allow add_ace resource.myframework command.remove_principal allow

alternately, predefine ACEs here

add_ace resource.myframework command.add_ace allow


```js
// server-side code in myframework
on('myframework:jobRegistered', (job) => {
    ExecuteCommand(`add_ace "job.${job}" "jobProbe.${job}" allow`);
});

on('myframework:jobAssigned', (source, job) => {
    ExecuteCommand(`add_principal "player.${source}" "job.${job}"`);
});

on('playerDropped', () => {
    const source = source;
    for (const job of myfw.getPlayerJobs(source)) {
        ExecuteCommand(`remove_principal "player.${source}" "job.${job}"`);
    }
});

... and then a resource that one would want to add a job check to - or a chat mode's seObject, or an existing resource - can just check for the jobProbe.mechanic privilege using native commands such as IsPlayerAceAllowed, without taking a dependency on myframework or any of its inner workings.


Original discussion thread: https://forum.fivem.net/t/quick-note-on-using-built-in-acl-security/3958985

add_ace resource.myframework command.add_principal allow add_ace resource.myframework command.remove_principal allow

alternately, predefine ACEs here

add_ace resource.myframework command.add_ace allow


```js
// server-side code in myframework
on('myframework:jobRegistered', (job) => {
    ExecuteCommand(`add_ace "job.${job}" "jobProbe.${job}" allow`);
});

on('myframework:jobAssigned', (source, job) => {
    ExecuteCommand(`add_principal "player.${source}" "job.${job}"`);
});

on('playerDropped', () => {
    const source = source;
    for (const job of myfw.getPlayerJobs(source)) {
        ExecuteCommand(`remove_principal "player.${source}" "job.${job}"`);
    }
});

... and then a resource that one would want to add a job check to - or a chat mode's seObject, or an existing resource - can just check for the jobProbe.mechanic privilege using native commands such as IsPlayerAceAllowed, without taking a dependency on myframework or any of its inner workings.


Original discussion thread: https://forum.fivem.net/t/quick-note-on-using-built-in-acl-security/3958985

Back to documentation