UCL

ULib’s Access Control List

Formatting Details

Format of admin account in users.txt-- “<steamid|ip|unique id>” { “group” “superadmin” “allow” { “ulx kick” “ulx ban” } “deny” { “ulx cexec” } }

Example of a superadmin-- “STEAM_0:1:123456” { “group” “superadmin” “allow” { } “deny” { } }

Format of group that gets the same allows as a superadmin in groups.txt-- “<group_name>” { “allow” { “ulx kick” “ulx ban” } “inherit_from” “superadmin” }

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.getUserInfoFromIDReturns a table containing the name and group of a player in the UCL table of users if they exist.
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,
from_CAMI)

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
from_CAMI(Optional) An indicator for this group coming from CAMI.

Revisions

v2.10acl is now an options parameter, added inherit_from.
v2.40Rewrite, changed parameter list around.
v2.60Added CAMI support and parameter.

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.
v2.60Added CAMI support.

ucl.setGroupInheritance

function ucl.setGroupInheritance(group,
inherit_from,
from_CAMI)

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)
from_CAMI(Optional) An indicator for this group coming from CAMI.

Revisions

v2.40Initial.
v2.60Added CAMI support and parameter.

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,
from_CAMI)

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)
from_CAMI(Optional) An indicator for this group coming from CAMI.

Revisions

v2.10Initial.
v2.40Rewrite, removed write parameter.
v2.60Added CAMI support and 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

v2.41Initial.

ucl.getUserInfoFromID

function ucl.getUserInfoFromID(id)

Returns a table containing the name and group of a player in the UCL table of users if they exist.

Parameters

idThe SteamID, IP, or UniqueID of the user you wish to check.

ucl.addUser

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

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 string of the group this user should belong to.  Must be a valid group.
from_CAMI(Optional) An indicator for this information coming from CAMI.

Revisions

v2.10No longer makes a group if it doesn’t exist.
v2.40Rewrite, changed the arguments all around.
v2.60Added support for CAMI and parameter.

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, or an ID of a connected player.
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.
v2.50Relaxed restrictions on id parameter.
v2.51Fixed this function not working on disconnected players.

ucl.removeUser

function ucl.removeUser(id,
from_CAMI)

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.
from_CAMI(Optional) An indicator for this information coming from CAMI.

Revisions

v2.40Rewrite, removed the write argument.
v2.60Added CAMI support and parameter.

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,
from_CAMI)
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,
from_CAMI)
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,
from_CAMI)
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.getUserInfoFromID(id)
Returns a table containing the name and group of a player in the UCL table of users if they exist.
function ucl.addUser(id,
allows,
denies,
group,
from_CAMI)
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,
from_CAMI)
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