k2tools.smauth (version 1.00.000 $Rev: 15 $, $Date: 2013-07-07 14:57:07 +0200 (So, 07 Jul 2013) $)
index
y:\server\csgo\csgo\addons\source-python\_libs\k2tools\smauth.py

Path     addons/source-python/_libs/k2tools/smauth.py
Name     SourceMod Authentification Libary
Version  1.00.000
Revision $Rev: 15 $
Author   (C) [#OMEGA] - K2
 
 
INFO
 
Parser for the sourcemod authentification files.
 
 
AGREEMENT
 
See addons/source-python/_libs/k2tools/license.txt

 
Modules
       
re

 
Classes
       
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)

 
Functions
       
flag_to_level(flag)
Converts the flag to the according sm access level.
 
@flag    - the flag that is supposed to be converted to the coressponding level
 
Raises ValueError if the flag doesn't exist.
is_valid_flag(flag)
This function can be used to check whether the specified flag is valid. This function is case-sensitive.
 
@flag    - the flag you want to validate
 
Returns True if the specified flag is valid and exists.
Returns False otherwise
is_valid_group(group)
This function can be used to check whether the specified admin group is valid. This function is case-sensitive.
 
@group    - the name of the group you want to validate
 
Returns True if the specified group is valid and exists.
Returns False otherwise
is_valid_level(level)
This function can be used to check whether the specified admin level is valid. This function is case-sensitive.
 
@level    - the level you want to validate
 
Returns True if the specified level is valid and exists.
Returns False otherwise
level_to_flag(level)
Converts the sm accesslevel to the according sm flag.
This is case-sensitive.
 
@level    - the name of the admin level that is supposed to be converted to the coressponding flag
 
Raises ValueError if the level doesn't exist.

 
Data
        Admin = <k2tools.smauth._Admin object>
__all__ = ['Admin', '_Admin', 'PlayerAccess', 'flag_to_level', 'level_to_flag', 'is_valid_flag', 'is_valid_level', 'is_valid_group']

 
Author
        [#OMEGA] - K2