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 = '…' | |
|---|---|---|
| Given | In server.cfg, with add_ace | With GrantPermission, or in the Player Manager |
| Best for | Full admins | Staff roles given and taken while the server runs |
| A dead player | Let through: it's an admin tool | Refused, 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.
Declares a permission; no other resource can take the name. The declaration goes when your resource stops, but grants stay in force.
| Field | Type | Description |
|---|---|---|
| name | string | 3 to 64 letters, digits, ., _ and -, starting with your resource's name |
| def.label | string? | Shown in the Monitor when someone lacks it |
| def.description | string? | A sentence for your own screens |
| def.implies | string[]? | Permissions this one includes (a Director admin is a builder too) |
| def.devtools | boolean? | false: full admins don't hold it automatically |
| def.grantedBy | string? | A permission whose holders may give and take this one. Full admins always may; temporary dev-tools admins need it |
true, or false, reasonWhether the player has it through a grant, an implying permission, or full admin. Read from memory.
| Param | Type | Description |
|---|---|---|
| source | number | Server id |
| name | string | The permission |
booleanGives 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.
| Param | Type | Description |
|---|---|---|
| who | number|table | A person: an online server id, { charId = n } (online or not), or { userId = n } |
| name | string | The permission |
true, or false, reasonEveryone given it directly, named by their online or latest character. Full admins aren't listed.
| Param | Type | Description |
|---|---|---|
| name | string | The permission |
{ { userId, name, account, grantedBy, grantedAt, online }, … }, or false, reason