Aller au contenu
Tutorials

FiveM ACE Permissions Explained: Admins, Groups and Principals

ATY Development
·
·Mis à jour ·
25 vues
QBCoreESXQboxStandalone
FiveM ACE Permissions Explained: Admins, Groups and Principals

Most FiveM servers end up with admin access granted by copy-pasted lines nobody fully understands. That works until a staff member leaves, someone gets the wrong rank, or a resource quietly hands out command access to everyone. This guide explains how ACE permissions actually work and how to structure them so you can reason about who can do what.

How ACE works in one paragraph

ACE (Access Control Entries) has three parts. A principal is who is asking: a player identifier, a group, or a resource. An object is what they want access to, usually a command like command.kick or a custom string like myserver.vehiclespawn. An ace is the rule that connects them with allow or deny. Principals can inherit from other principals, which is how you build ranks.

Four commands do almost all the work:

  • add_ace <principal> <object> allow|deny grants or denies an object.
  • add_principal <child> <parent> makes the child inherit everything the parent has.
  • remove_ace and remove_principal undo the above at runtime.

The minimal admin setup

The classic setup from the default server config looks like this:

add_ace group.admin command allow
add_ace group.admin command.quit deny
add_principal identifier.fivem:1234567 group.admin

The first line allows every command for group.admin. The second explicitly denies quit, and a deny wins over an allow. The third puts a specific player into the group. Note that command on its own is a parent of every command.* object, so it is a very broad grant. That is fine for owners, not for moderators.

Which identifier to use

A principal for a player is written as identifier.<type>:<value>. Common types:

  • license: tied to the Rockstar license the player connects with. Always present, which makes it the most reliable choice.
  • fivem: the Cfx.re forum account ID, present when the player is linked.
  • discord: only present if the player has Discord running and linked.
  • steam: only present if Steam is running.

Use license or fivem for staff. Granting admin through discord or steam means the permission silently disappears when the player launches without those clients, which leads to confusing support tickets. You can grab a player's identifiers from txAdmin's player panel.

Building a rank hierarchy

Instead of giving each rank its own full list, grant only the difference and use inheritance. Put this in a separate file and load it from server.cfg with exec permissions.cfg so staff changes never touch your resource list.

# permissions.cfg

# Moderator: limited commands
add_ace group.mod command.kick allow
add_ace group.mod myserver.spectate allow
add_ace group.mod myserver.noclip allow

# Admin: everything a mod has, plus more
add_principal group.admin group.mod
add_ace group.admin command.ban allow
add_ace group.admin myserver.vehiclespawn allow

# Owner: everything
add_principal group.owner group.admin
add_ace group.owner command allow

# Staff
add_principal identifier.license:aaaaaaaa group.owner
add_principal identifier.license:bbbbbbbb group.admin
add_principal identifier.license:cccccccc group.mod

Removing someone is now one line deleted, and promoting someone is changing one word. Keep a comment with the person's name next to each identifier; in six months nobody will remember who bbbbbbbb was.

Changes in the file apply on the next restart. You can also run add_principal or remove_principal in the live console for an immediate effect, but anything typed there is lost on restart unless you also update the file.

Checking permissions in your own resources

There are two clean ways to gate functionality in Lua.

Restricted commands

The third argument of RegisterCommand marks a command as restricted. Restricted commands require the matching command.<name> ace, and the server enforces it before your handler runs.

RegisterCommand('fixcar', function(source, args)
    -- only reached if the player has command.fixcar
    TriggerClientEvent('myserver:fixVehicle', source)
end, true)

Then grant it: add_ace group.mod command.fixcar allow.

Custom objects with IsPlayerAceAllowed

For anything that is not a command, such as a menu option, a server event or a button in a NUI panel, check a custom object on the server:

RegisterNetEvent('myserver:spawnVehicle', function(model)
    local src = source
    if not IsPlayerAceAllowed(src, 'myserver.vehiclespawn') then
        print(('Blocked vehicle spawn attempt from %s'):format(src))
        return
    end
    -- spawn logic here
end)

Always do this check server-side. A client-side check only hides a button; anyone running a modified client can still trigger the event directly. Pick a consistent prefix for your custom objects (your server name, for example) so they are easy to grep and do not collide with other resources.

Resource principals

Resources are principals too, written as resource.<name>. Some resources need to run console commands themselves, for example to add principals at runtime when a framework sets a player's group. That requires a line like:

add_ace resource.my_admin_resource command.add_principal allow
add_ace resource.my_admin_resource command.remove_principal allow

Be stingy here. Granting a resource command allow means any code in that resource, including a backdoor in a leaked or obfuscated script, can execute any console command on your server. Grant only the specific commands the resource documents as necessary.

Where frameworks fit in

Frameworks layer their own role systems on top, and they do it differently:

  • QBCore and Qbox rely on ACE for staff permissions. Their default configs ship with specific group names and the ace lines that go with them. Read the permission section of your framework's default server.cfg and keep those group names rather than inventing parallel ones, otherwise framework admin commands will not recognise your staff.
  • ESX traditionally stores the player's group in the database (the users table) and checks that for its own admin features. Standalone resources on the same server may still check ACE, so staff often need both the ESX group and the ACE principal.

When a third-party script says it needs "admin", check its documentation for which system it reads. Mismatches between framework groups and ACE groups are the most common reason an admin "has permission" in one script but not another.

txAdmin admins are a separate layer

txAdmin manages its own admin accounts and permissions through its web panel, including access to the in-game txAdmin menu. Those accounts are not ACE principals. Giving someone a txAdmin account does not let them run your restricted commands, and adding them to group.admin does not give them txAdmin panel access. Decide per staff member which layers they need and keep a short written list of both.

Debugging permissions

When someone says a command does not work for them, check in this order:

  1. Confirm the identifier. Copy it from txAdmin rather than from memory, and check the prefix (license: vs license2: are different).
  2. Run list_principals in the server console to see the inheritance tree that is actually loaded.
  3. Run list_aces to see every ace that is active, including ones added by resources.
  4. Use test_ace with the principal and object to see whether the server resolves it as allowed.
  5. Check that your exec permissions.cfg line actually runs; a typo in the file name fails quietly in a busy console log.

Common mistakes

  • Granting anything to builtin.everyone or a default group that every player inherits. Audit for this after installing any new resource that edits your config.
  • Giving moderators command allow because it was faster than listing commands.
  • Using Discord or Steam identifiers for staff ranks.
  • Checking permissions only on the client.
  • Leaving former staff in the file because nobody owns the list.

Practical takeaway

Move all permissions into one permissions.cfg, build ranks with inheritance so each group only lists what it adds, use license or fivem identifiers, and gate every sensitive server event with IsPlayerAceAllowed. Review the file whenever staff changes and after every new resource install. For the full list of console commands and natives, the official documentation at docs.fivem.net is the reference to keep open.