JCKSDocs
JCKS BridgeV2Référence

Permissions and access

Who counts as a JCKS admin, how access rules per permission work and how your resource registers and checks its own permissions.

Owners and admins

A player is an owner with the ACE jcks.owner or jcks.admin. The server console is always an owner. Owners pass every permission check.

A player is an admin when one of these is true:

  • they are an owner,
  • Editable.IsAdmin(src) in editable/server.lua returns true,
  • their framework group is in AdminGroups (/jcks, Access, Admin groups),
  • one of their identifiers is in AdminPeople (/jcks, Access, Admin people),
  • they opened the first setup with the console code and the setup is not saved yet.
cfg
add_ace group.admin jcks.admin allow
add_principal identifier.license:abc123 group.admin

What a group means depends on the framework:

Framework Group
ESX The player group (xPlayer.getGroup), for example admin
QBCore Permission level: god, admin, mod
Qbox ACE group, admin means group.admin. Qbox has no admin in the database, the account must be in the group through add_principal
ox_core An ox group or an ACE group
standalone ACE group (group.admin)

When a player is refused /jcks or /jobadmin, the server console prints their license, the framework rule and the exact add_principal and add_ace lines to add, at most once a minute per player. Your own resources can do the same with exports.jcks_bridge:ExplainDenied(src, permission, ace).

The bridge publishes the admin flag on every player as Player(src).state['jcks:admin'], refreshed every minute. Only the server writes it. JCKS windows and Spotlight read it to show admin entries.

Access rules

Every permission has a rule, set in /jcks, Access or on the script page under Access.

Mode Who has it
Admins Admins only
Everyone Every player
Nobody Nobody except owners
Custom Players matching any entry below, plus admins unless Admins also have access is off

Entries of a custom rule:

Entry Limit Matches
Framework groups 20 The player is in the group
ACE permissions 20 IsPlayerAceAllowed
Specific players 50 An identifier of the player, for example license:... or discord:...
Discord roles 20 A role ID the player has on your Discord server. Needs the bot token and server ID in /jcks, Access, Discord roles. Roles refresh every 5 minutes.
Jobs 20 Job name, from grade, optionally only on duty

Results are cached for 10 seconds per player.

Permissions of the bridge

Id Default What it opens
bridge.setup Admins Server setup: framework, providers, access rules and security
bridge.uisettings Everyone Personal UI settings: theme, language and size
bridge.security Admins Exploit reports and kicks

JCKS scripts register their own, for example jcks_jobs jobs.admin, jobs.fire and jobs.gigs. They show on the script page.

Using permissions in your resource

Register a permission (server):

lua
exports.jcks_bridge:RegisterPermission('scoreboard.admin', {
    label = 'Scoreboard settings',
    description = 'Open /scoreboardadmin',
    default = 'admin',
})

The id needs a dot (resource.action), letters, digits and _, at most 60 characters. default is admin, everyone or nobody. A permission belongs to the resource that registered it, another resource cannot take it over. When a resource named like the part before the dot exists (scoreboard or jcks_scoreboard), only that resource can register the id. Permissions declared in access of jcks.settings.register are registered the same way.

Check it:

lua
if not exports.jcks_bridge:HasPermission(source, 'scoreboard.admin') then return end
local list = exports.jcks_bridge:GetPermissions(source)
local admin = exports.jcks_bridge:IsAdmin(source)

GetPermissions returns the ids the player has. The same list is published as Player(src).state['jcks:perms']. jcks.net.on and jcks.command of jcks_lib accept a bridge permission id in permission.