ULib’s Access Control List
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” }
UCL | ULib’s Access Control List |
Functions | |
ucl. | Adds a new group to the UCL. |
ucl. | Adds or removes an access tag in the allows for a group. |
ucl. | Renames a group in the UCL. |
ucl. | Sets a group’s inheritance in the UCL. |
ucl. | Sets what a group is allowed to target in the UCL. |
ucl. | Removes a group from the UCL. |
ucl. | Returns the SteamID, IP, or UniqueID of a player if they’re registered under any of those IDs under ucl.users. |
ucl. | Returns a table containing the name and group of a player in the UCL table of users if they exist. |
ucl. | Adds a user to the UCL. |
ucl. | Adds or removes an access tag in the allows or denies for a user. |
ucl. | Removes a user from the UCL. |
ucl. | 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. |
ucl. | Probes the user to assign access appropriately. |
function ucl.addGroup( name, allows, inherit_from, from_CAMI )
Adds a new group to the UCL. Automatically saves.
name | A 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. |
v2.10 | acl is now an options parameter, added inherit_from. |
v2.40 | Rewrite, changed parameter list around. |
v2.60 | Added CAMI support and parameter. |
function ucl.groupAllow( name, access, revoke )
Adds or removes an access tag in the allows for a group. Automatically reprobes, automatically saves.
name | A string of the group name. (IE: superadmin) |
access | The 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. |
A boolean stating whether you changed anything or not.
v2.40 | Initial. |
function ucl.renameGroup( orig, new )
Renames a group in the UCL. Automatically moves current members, automatically renames inheritances, automatically saves.
orig | A string of the original group name. (IE: superadmin) |
new | A string of the new group name. (IE: owner) |
v2.40 | Initial. |
v2.60 | Added CAMI support. |
function ucl.setGroupInheritance( group, inherit_from, from_CAMI )
Sets a group’s inheritance in the UCL. Automatically reprobes current members, automatically saves.
group | A string of the group name. (IE: superadmin) |
inherit_from | Either 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. |
v2.40 | Initial. |
v2.60 | Added CAMI support and parameter. |
function ucl.setGroupCanTarget( group, can_target )
Sets what a group is allowed to target in the UCL. Automatically saves.
group | A string of the group name. (IE: superadmin) |
can_target | Either a string of who the group is allowed to target (IE: !%admin) or nil to clear the restriction. |
v2.40 | Initial. |
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.
name | A string of the group name. (IE: superadmin) |
from_CAMI | (Optional) An indicator for this group coming from CAMI. |
v2.10 | Initial. |
v2.40 | Rewrite, removed write parameter. |
v2.60 | Added CAMI support and parameter. |
function ucl.addUser( id, allows, denies, group, from_CAMI )
Adds a user to the UCL. Automatically probes for the user, automatically saves.
id | The 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. |
v2.10 | No longer makes a group if it doesn’t exist. |
v2.40 | Rewrite, changed the arguments all around. |
v2.60 | Added support for CAMI and parameter. |
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.
id | The SteamID, IP, or UniqueID of the user to change. Must be a valid, existing ID, or an ID of a connected player. |
access | The 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. |
A boolean stating whether you changed anything or not.
v2.40 | Initial. |
v2.50 | Relaxed restrictions on id parameter. |
v2.51 | Fixed this function not working on disconnected players. |
function ucl.removeUser( id, from_CAMI )
Removes a user from the UCL. Automatically probes for the user, automatically saves.
id | The 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. |
v2.40 | Rewrite, removed the write argument. |
v2.60 | Added CAMI support and parameter. |
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.
access | The 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”) |
v2.40 | Rewrite. |
Adds a new group to the UCL.
function ucl.addGroup( name, allows, inherit_from, from_CAMI )
Adds or removes an access tag in the allows for a group.
function ucl.groupAllow( name, access, revoke )
Renames a group in the UCL.
function ucl.renameGroup( orig, new )
Sets a group’s inheritance in the UCL.
function ucl.setGroupInheritance( group, inherit_from, from_CAMI )
Sets what a group is allowed to target in the UCL.
function ucl.setGroupCanTarget( group, can_target )
Removes a group from the UCL.
function ucl.removeGroup( name, from_CAMI )
Returns the SteamID, IP, or UniqueID of a player if they’re registered under any of those IDs under ucl.users.
function ucl.getUserRegisteredID( ply )
Returns a table containing the name and group of a player in the UCL table of users if they exist.
function ucl.getUserInfoFromID( id )
Adds a user to the UCL.
function ucl.addUser( id, allows, denies, group, from_CAMI )
Adds or removes an access tag in the allows or denies for a user.
function ucl.userAllow( id, access, revoke, deny )
Removes a user from the UCL.
function ucl.removeUser( id, from_CAMI )
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.registerAccess( access, groups, comment, category )
Probes the user to assign access appropriately.
function ucl.probe( ply )