| | |
- builtins.object
-
- PlayerAccess
- _Admin
class PlayerAccess(builtins.object) |
| |
The purpose of this class is to simplify the access to the data parsed by the libary. It is possible to use the Admin object directly, however, unless it's not avoidable this class should be preferred. |
| |
Methods defined here:
- __init__(self, userid=None, index=None, player=None, authtype='steam', authinfo=None)
- Creates a new player object for the specified index.
Only one of these is required:
@userid - The userid of the player
@index - The index of the player
@player - IPlayerInfo instance of the player
Optional:
@authtype - The authtype that is used when checking permissions. Can be either steam, ip or name (Default: steam)
@authinfo - Argument that represenets the authentification tag depending on authtype, can be one of the following:
- SteamID of player (for authtype 'steam')
- IP Address of player (for authtype 'ip')
- Name of player (for authtype 'name')
Raises ValueError if the type is invalid (not steam, ip or name)
- can_target(self, *a, userid=None, index=None, player=None)
- This functions checks whether the user can target the player with the specified index with an admin command. Depending on sm_immunity_mode the according value may vary. See SourceMod documentation for more info on what sm_immunity_mode changes.
Keyword only (only one required):
@userid - The userid of the targeted player
@index - The index of the targeted player
@player - IPlayerInfo instance of the targeted player
Returns True if the user can target the specified index with an admin command.
Returns False if the user does not exist or if the index can not be targeted by the user.
- get_immunity(self)
- This function is used to receive the immunity level of the user. It will always return the highest applicable immnunity.
Returns the immunity value of th euser
Returns False otherwise
- has_flag(self, adminflag='')
- This functions checks whether the user has the specified flag. It also checks against whether he has root access and thus is able to use the function without having the flag itself.
@adminflag - A single character which represents the admin flag.
Returns True if the user has the specified flag or has root access.
Returns False if the user does not exist or if the flag can not be found.
Raises TypeError if adminflag is not a string.
- has_flags(self, adminflags=())
- This functions checks whether the user has all specified flag. It also checks against whether he has root access and thus is able to use the function without having the flag itself.
@adminflags - Any iterable type (dict, list, tuple or strings)
Returns True if the user has all the specified flags (or root flag).
Returns False if the has one of the specified flags or if the flag can not be found.
Raises TypeError if the type is invalid.
- in_group(self, group)
- This functions checks whether the user is in the specifed admin group. This functino is case-senstive.
@group - The admin group
Returns True if the user is in the specified group.
Returns False if the user does not exist or if the group can not be found.
- is_admin(self)
- Checks whether the user has basic admin access (b) or not.
Returns True if the user has the basic admin (b) flag
Returns False if the user does not exist or if the flag can not be found.
- is_root(self)
- Checks whether the user has root admin access (z) or not.
Returns True if the user has root access.
Returns False otherwise.
- is_user(self)
- Checks whether the user is stored in the database
Returns True if the user with the specified auth is stored in admin files
Returns False otherwise
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
|
class _Admin(builtins.object) |
| |
Using this class (or rather the object of this class) should be avoided
unless you really need it. |
| |
Methods defined here:
- __init__(self)
- add_group(self, name=None, flags='', immunity=0)
- Add group to the cache.
@name - Name of the group
@flags - Flags for this group
@immunity - Immunity level of this group
- add_user(self, auth='steam', identity=None, options=None)
- Add user to the cache
@auth - Authtype
- steam : SteamID
- name : Name
- IP : IP Address
@identity - Identification string for the authtype
@options - Dictionary of options containing the following:
- name : name of the admin
- flags : admin flags
- password : user password
- group : list of groups
- immunity : immunity level
- get_user(self, identity, auth='steam')
- Gets the user object with parsed permissions.
If the user is not in there, it returns False.
- parse(self)
- Clears the cache and reparses all admins.
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
| |