Esc to clear, Enter to open the best match, click an export to open it in its page
Security

Permissions

Staff roles between "everyone" and your full admins: a builder, a moderator, a garage manager. Your resource declares a permission, someone gives it to a player, and your events ask for it with permission = 'name'.

A grant works at once, with no restart. It's given to an account, so it's a staff role, not a job (for "police only", check the job). Full admins hold every permission: the whip.devtools ACE with developer mode on, and staff given dev tools in the Player Manager until the restart.

Permission or ACE?

ace = '…'permission = '…'
GivenIn server.cfg, with add_aceWith GrantPermission, or in the Player Manager
Best forFull adminsStaff roles given and taken while the server runs
A dead playerLet through: it's an admin toolRefused, unless whileDead = true

Using one

Whip.register(function()
    Whip.core:RegisterPermission('mygarage.manage', { label = 'Garage manager' })

    Whip.core:SecureEvent('mygarage:remove', {
        permission = 'mygarage.manage',     -- or a list: any one of them
        params     = { {'garageId', 'id'} },
    }, function(source, player, garageId)
        -- only a garage manager, or a full admin, gets here
    end)
end)

-- from a command or screen of yours
exports.whip_core:GrantPermission(targetSource, 'mygarage.manage')

A refused player shows in the Monitor with the permission they lacked.

Giving oneServer owners

Give and take any permission in /whip → Players → Player Manager → the player → Permissions. The Director's builders and admins can also be given in /whip → Director → Access.

RegisterPermission(name, def?)SERVER#

Declares a permission; no other resource can take the name. The declaration goes when your resource stops, but grants stay in force.

FieldTypeDescription
namestring3 to 64 letters, digits, ., _ and -, starting with your resource's name
def.labelstring?Shown in the Monitor when someone lacks it
def.descriptionstring?A sentence for your own screens
def.impliesstring[]?Permissions this one includes (a Director admin is a builder too)
def.devtoolsboolean?false: full admins don't hold it automatically
def.grantedBystring?A permission whose holders may give and take this one. Full admins always may; temporary dev-tools admins need it
Returns: true, or false, reason
HasPermission(source, name)SERVER#

Whether the player has it through a grant, an implying permission, or full admin. Read from memory.

ParamTypeDescription
sourcenumberServer id
namestringThe permission
Returns: boolean
GrantPermission(who, name) · RevokePermission(who, name)SERVERWAITS#

Gives an account a permission or takes it away, at once. whip_core:permission:changed fires on the server and on each of the account's online games (WHIP tells the player nothing); the activity log names your resource.

ParamTypeDescription
whonumber|tableA person: an online server id, { charId = n } (online or not), or { userId = n }
namestringThe permission
Returns: true, or false, reason
GetPermissionHolders(name)SERVERWAITS#

Everyone given it directly, named by their online or latest character. Full admins aren't listed.

ParamTypeDescription
namestringThe permission
Returns: { { userId, name, account, grantedBy, grantedAt, online }, … }, or false, reason