Shared UCL

Shared UCL stuff.

Summary
Shared UCLShared UCL stuff.
Tables
uclHolds all of the ucl variables and functions
Functions
ucl.queryThis function is used to see if a user has access to a command.
ucl.groupInheritsFromThis function is used to see if a specified group is inheriting from another
ucl.getInheritanceTreeThis function returns a tree-like structure representing the group inheritance architecture.
ucl.getGroupCanTargetGets what a group is allowed to target in the UCL.
Player:queryThis is an alias of ULib.ucl.query()
Player:IsAdminOverwrite garry’s IsAdmin function to check for membership in admin group.
Player:IsSuperAdminOverwrite garry’s IsSuperAdmin function to check for membership in superadmin group.
Player:GetUserGroupThis should have been included with garrysmod by default, so ULib is creating it for us.
Player:CheckGroupThis function is similar to IsUserGroup(), but this one checks the UCL group chain as well.

Tables

ucl

Holds all of the ucl variables and functions

Functions

ucl.query

function ucl.query(ply,
access,
hide)

This function is used to see if a user has access to a command.

Parameters

plyThe player to check access for
accessThe access string to check for.  (IE “ulx slap”, doesn’t have to be a command though).  If nil is passed in, this always returns true.
hide(Optional, defaults to false) Normally, a listen host is automatically given access to everything.  Set this to true if you want to treat the listen host as a normal user.  (Will be denied commands that no one has access to)

Returns

A bool signifying whether or not they have access.

Revisions

v2.40Rewrite.

ucl.groupInheritsFrom

function ucl.groupInheritsFrom(group)

This function is used to see if a specified group is inheriting from another

Parameters

groupThe group to check inheritance on.  Must be a valid group.

Returns

The group this group is inheriting from or nil (everything implicity inherits from “user”, “user” inherits from nil).

Revisions

v2.40Initial.

ucl.getInheritanceTree

function ucl.getInheritanceTree()

This function returns a tree-like structure representing the group inheritance architecture.

Returns

The inheritance tree.

Example return

PrintTable( ULib.ucl.getInheritanceTree() )
user:
   trusted:
       members:
   thedumbones:
   admin:
       superadmin:
       serverowner:
       clanowner:
   respected:

Revisions

v2.40Initial

ucl.getGroupCanTarget

function ucl.getGroupCanTarget(group)

Gets what a group is allowed to target in the UCL.

Parameters

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

Returns

The string of who they’re allowed to target (IE: !%admin) or nil if there’s no restriction.

Revisions

v2.40Initial.

Player:query

This is an alias of ULib.ucl.query()

Player:IsAdmin

Overwrite garry’s IsAdmin function to check for membership in admin group.  This is so if group “serverowner” inherits from admin, this function will still return true when checking on a member belonging to the “serverowner” group.

Returns

True is the user belongs in the admin group directly or indirectly, false otherwise.

Revisions

v2.40Rewrite.

Player:IsSuperAdmin

Overwrite garry’s IsSuperAdmin function to check for membership in superadmin group.  This is so if group “serverowner” inherits from superadmin, this function will still return true when checking on a member belonging to the “serverowner” group.

Returns

True is the user belongs in the superadmin group directly or indirectly, false otherwise.

Revisions

v2.40Rewrite.

Player:GetUserGroup

This should have been included with garrysmod by default, so ULib is creating it for us.

Returns

The group the player belongs to.

Revisions

v2.40Initial.

Player:CheckGroup

This function is similar to IsUserGroup(), but this one checks the UCL group chain as well.  For example, if a user is in group “superadmin” which inherits from “admin”, this function will return true if you check the user against “admin”, where IsUserGroup() wouldn’t.

Parameters

groupThe group you want to check a player’s membership in.

Returns

A boolean stating whether they have membership in the group or not.

Revisions

v2.40Initial.
function ucl.query(ply,
access,
hide)
This function is used to see if a user has access to a command.
function ucl.groupInheritsFrom(group)
This function is used to see if a specified group is inheriting from another
function ucl.getInheritanceTree()
This function returns a tree-like structure representing the group inheritance architecture.
function ucl.getGroupCanTarget(group)
Gets what a group is allowed to target in the UCL.
Close