mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-18 15:36:02 +01:00
feat(acl): if principal is a number, reference player.num
This commit is contained in:
@@ -2,19 +2,38 @@ local function allowAce(allow)
|
|||||||
return allow == false and 'deny' or 'allow'
|
return allow == false and 'deny' or 'allow'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Adds the ace to the principal.
|
||||||
function lib.addAce(principal, ace, allow)
|
function lib.addAce(principal, ace, allow)
|
||||||
|
if type(principal) == 'number' then
|
||||||
|
principal = 'player.'..principal
|
||||||
|
end
|
||||||
|
|
||||||
ExecuteCommand(('add_ace %s %s %s'):format(principal, ace, allowAce(allow)))
|
ExecuteCommand(('add_ace %s %s %s'):format(principal, ace, allowAce(allow)))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Removes the ace from the principal.
|
||||||
function lib.removeAce(principal, ace, allow)
|
function lib.removeAce(principal, ace, allow)
|
||||||
|
if type(principal) == 'number' then
|
||||||
|
principal = 'player.'..principal
|
||||||
|
end
|
||||||
|
|
||||||
ExecuteCommand(('remove_ace %s %s %s'):format(principal, ace, allowAce(allow)))
|
ExecuteCommand(('remove_ace %s %s %s'):format(principal, ace, allowAce(allow)))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Adds the child principal to the parent principal.
|
||||||
function lib.addPrincipal(child, parent)
|
function lib.addPrincipal(child, parent)
|
||||||
|
if type(child) == 'number' then
|
||||||
|
child = 'player.'..child
|
||||||
|
end
|
||||||
|
|
||||||
ExecuteCommand(('add_principal %s %s'):format(child, parent))
|
ExecuteCommand(('add_principal %s %s'):format(child, parent))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Removes the child principal from the parent principal.
|
||||||
function lib.removePrincipal(child, parent)
|
function lib.removePrincipal(child, parent)
|
||||||
|
if type(child) == 'number' then
|
||||||
|
child = 'player.'..child
|
||||||
|
end
|
||||||
|
|
||||||
ExecuteCommand(('remove_principal %s %s'):format(child, parent))
|
ExecuteCommand(('remove_principal %s %s'):format(child, parent))
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user