UCL

ULib’s Access Control List

Summary
UCLULib’s Access Control List
Functions
ucl.addGroupAdds a new group to the UCL.
ucl.groupAllowAdds or removes an access tag in the allows for a group.
ucl.renameGroupRenames a group in the UCL.
ucl.setGroupInheritanceSets a group’s inheritance in the UCL.
ucl.setGroupCanTargetSets what a group is allowed to target in the UCL.
ucl.removeGroupRemoves a group from the UCL.
ucl.getUserRegisteredIDReturns the SteamID, IP, or UniqueID of a player if they’re registered under any of those IDs under ucl.users.
ucl.addUserAdds a user to the UCL.
ucl.userAllowAdds or removes an access tag in the allows or denies for a user.
ucl.removeUserRemoves a user from the UCL.
ucl.registerAccessInform UCL about the existence of a particular access string, optionally make it have a certain default access, optionally give a help message along with it.
ucl.probeProbes the user to assign access appropriately.

Functions

ucl.addGroup

function ucl.addGroup(name,
allows,
inherit_from)

Adds a new group to the UCL.  Automatically saves.

Parameters

nameA string of the group name.  (IE: superadmin)
allows(Optional, defaults to empty table) The allowed access for the group.
inherit_from(Optional) A string of a valid group to inherit from

Revisions

v2.10acl is now an options parameter, added inherit_from.
v2.40Rewrite, changed parameter list around.

ucl.groupAllow

function ucl.groupAllow(name,
access,
revoke)

Adds or removes an access tag in the allows for a group.  Automatically reprobes, automatically saves.

Parameters

nameA string of the group name.  (IE: superadmin)
accessThe string of the access or a table of accesses to add or remove.  Access tags can be specified in values in the table for allows.
revoke(Optional, defaults to false) A boolean of whether access should be granted or revoked.

Returns

A boolean stating whether you changed anything or not.

Revisions

v2.40Initial.

ucl.renameGroup

function ucl.renameGroup(orig,
new)

Renames a group in the UCL.  Automatically moves current members, automatically renames inheritances, automatically saves.

Parameters

origA string of the original group name.  (IE: superadmin)
newA string of the new group name.  (IE: owner)

Revisions

v2.40Initial.

ucl.setGroupInheritance

function ucl.setGroupInheritance(group,
inherit_from)

Sets a group’s inheritance in the UCL.  Automatically reprobes current members, automatically saves.

Parameters

groupA string of the group name.  (IE: superadmin)
inherit_fromEither a string of the new inheritance group name or nil to remove inheritance.  (IE: admin)

Revisions

v2.40Initial.

ucl.setGroupCanTarget

function ucl.setGroupCanTarget(group,
can_target)

Sets what a group is allowed to target in the UCL.  Automatically saves.

Parameters

groupA string of the group name.  (IE: superadmin)
can_targetEither a string of who the group is allowed to target (IE: !%admin) or nil to clear the restriction.

Revisions

v2.40Initial.

ucl.removeGroup

function ucl.removeGroup(name)

Removes a group from the UCL.  Automatically removes this group from members in it, automatically patches inheritances, automatically saves.

Parameters

nameA string of the group name.  (IE: superadmin)

Revisions

v2.10Initial.
v2.40Rewrite, removed write parameter.

ucl.getUserRegisteredID

function ucl.getUserRegisteredID(ply)

Returns the SteamID, IP, or UniqueID of a player if they’re registered under any of those IDs under ucl.users.  Checks in order.  Returns nil if not registered.

Parameters

plyThe player object you wish to check.

Revisions

2.41Initial.

ucl.addUser

function ucl.addUser(id,
allows,
denies,
group)

Adds a user to the UCL.  Automatically probes for the user, automatically saves.

Parameters

idThe SteamID, IP, or UniqueID of the user you wish to add.
allows(Optional, defaults to empty table) The list of access you wish to give this user.
denies(Optional, defaults to empty table) The list of access you wish to explicitly deny this user.
group(Optional) The sting of the group this user should belong to.  Must be a valid group.

Revisions

2.10No longer makes a group if it doesn’t exist.
2.40Rewrite, changed the arguments all around.

ucl.userAllow

function ucl.userAllow(id,
access,
revoke,
deny)

Adds or removes an access tag in the allows or denies for a user.  Automatically reprobes, automatically saves.

Parameters

idThe SteamID, IP, or UniqueID of the user to change.  Must be a valid, existing ID.  The unique id of a connected user is always valid.
accessThe string of the access or a table of accesses to add or remove.  Access tags can be specified in values in the table for allows.
revoke(Optional, defaults to false) A boolean of whether the access tag should be added or removed from the allow or deny list.  If true, it’s removed.
deny(Optional, defaults to false) If true, the access is added or removed from the deny list, if false it’s added or removed from the allow list.

Returns

A boolean stating whether you changed anything or not.

Revisions

v2.40Initial.

ucl.removeUser

function ucl.removeUser(id)

Removes a user from the UCL.  Automatically probes for the user, automatically saves.

Parameters

idThe SteamID, IP, or UniqueID of the user you wish to remove.  Must be a valid, existing ID.  The unique id of a connected user is always valid.

Revisions

v2.40Rewrite, removed the write argument.

ucl.registerAccess

function ucl.registerAccess(access,
groups,
comment,
category)

Inform UCL about the existence of a particular access string, optionally make it have a certain default access, optionally give a help message along with it.  The use of this function is optional, it is not required in order to query an access string, but it’s use is highly recommended.

Parameters

accessThe access string (IE, “ulx slap” or “ups deletionAccess”).
groups(Optional, defaults to no access) Either a string of a group or a table of groups to give the default access to.
comment(Optional) A brief description of what this access string is granting access to.
category(Optional) Category for the access string (IE, “Command”, “CVAR”, “Limits”)

Revisions

v2.40Rewrite.

ucl.probe

function ucl.probe(ply)

Probes the user to assign access appropriately.  DO NOT CALL THIS DIRECTLY, UCL HANDLES IT.

Parameters

plyThe player object to probe.

Revisions

v2.40Rewrite.
function ucl.addGroup(name,
allows,
inherit_from)
Adds a new group to the UCL.
function ucl.groupAllow(name,
access,
revoke)
Adds or removes an access tag in the allows for a group.
function ucl.renameGroup(orig,
new)
Renames a group in the UCL.
function ucl.setGroupInheritance(group,
inherit_from)
Sets a group’s inheritance in the UCL.
function ucl.setGroupCanTarget(group,
can_target)
Sets what a group is allowed to target in the UCL.
function ucl.removeGroup(name)
Removes a group from the UCL.
function ucl.getUserRegisteredID(ply)
Returns the SteamID, IP, or UniqueID of a player if they’re registered under any of those IDs under ucl.users.
function ucl.addUser(id,
allows,
denies,
group)
Adds a user to the UCL.
function ucl.userAllow(id,
access,
revoke,
deny)
Adds or removes an access tag in the allows or denies for a user.
function ucl.removeUser(id)
Removes a user from the UCL.
function ucl.registerAccess(access,
groups,
comment,
category)
Inform UCL about the existence of a particular access string, optionally make it have a certain default access, optionally give a help message along with it.
function ucl.probe(ply)
Probes the user to assign access appropriately.
Close