smauth
index
e:\spiele\server\css\orangebox\cstrike\addons\eventscripts\_libs\python\smauth.py

addons/eventscripts/_libs/python/smauth.py
Version 1.02.000
 
Licensed under:
http://creativecommons.org/licenses/by-nc-nd/3.0/
 
If wish to alter the file/contents or re-use some parts please contact me.
 
(C) [#OMEGA] - K2 2009-2011

 
Modules
       
es
gamethread
keyvalues
psyco
pubcvarlib
smauth

 
Classes
       
__builtin__.object
PlayerAccess
exceptions.Exception(exceptions.BaseException)
InputError

 
class InputError(exceptions.Exception)
    
Method resolution order:
InputError
exceptions.Exception
exceptions.BaseException
__builtin__.object

Data descriptors defined here:
__weakref__
list of weak references to the object (if defined)

Methods inherited from exceptions.Exception:
__init__(...)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Data and other attributes inherited from exceptions.Exception:
__new__ = <built-in method __new__ of type object at 0x1E1CBBE8>
T.__new__(S, ...) -> a new object with type S, a subtype of T

Methods inherited from exceptions.BaseException:
__delattr__(...)
x.__delattr__('name') <==> del x.name
__getattribute__(...)
x.__getattribute__('name') <==> x.name
__getitem__(...)
x.__getitem__(y) <==> x[y]
__getslice__(...)
x.__getslice__(i, j) <==> x[i:j]
 
Use of negative indices is not supported.
__reduce__(...)
__repr__(...)
x.__repr__() <==> repr(x)
__setattr__(...)
x.__setattr__('name', value) <==> x.name = value
__setstate__(...)
__str__(...)
x.__str__() <==> str(x)

Data descriptors inherited from exceptions.BaseException:
__dict__
args
message
exception message

 
class PlayerAccess(__builtin__.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:
CanTarget(self, userid)
This functions checks whether the user can target the player with the specified userid 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.
 
@userid - The userid of the targeted player
 
Returns True if the user can target the specified userid with an admin command.
Returns False if the user does not exist or if the userid can not be targeted by the user.
GetImmunity(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
HasFlag(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.
HasFlags(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.
InGroup(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.
IsAdmin(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.
IsRoot(self)
Checks whether the user has root admin access (z) or not.
 
Returns True if the user has root access.
Returns False otherwise.
IsUser(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
__init__(self, userid, authtype='steam')
Creates a new player object for the specified userid.
 
@userid         - The userid of the player
@authtype       - The authtype that is used when checking permissions. Can be either steam, ip or name (Default: steam)
 
Raises InputError if the type is invalid (not steam, ip or name)

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Data and other attributes defined here:
authinfo = None
authtype = None
user = None
userid = None

 
Functions
       
FlagToLevel(flag)
Converts the flag to the according sm access level.
 
@flag   - the flag that is supposed to be converted to the coressponding level
 
Raises InputError if the flag doesn't exist.
IsValidFlag(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
IsValidGroup(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
IsValidLevel(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
LevelToFlag(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 InputError if the level doesn't exist.

 
Data
        Admin = <smauth.__Admin object at 0x1B4A6670>
config = <ConfigParser.SafeConfigParser instance at 0x1B4A4738>
gamedir = r'E:\Spiele\Server\CSS\orangebox\cstrike'
info = {'description': 'Provides auth access to sm file...'tags'], 'name': 'Sourcemod Python Authprovider'}