SourceMod SDK  1.7
SourceMod::IAdminSystem Class Referenceabstract

Provides functions for manipulating the admin options cache. More...

#include <public/IAdminSystem.h>

Inheritance diagram for SourceMod::IAdminSystem:
SourceMod::SMInterface

Public Member Functions

const char * GetInterfaceName ()
 Must return a string defining the interface's unique name.
 
unsigned int GetInterfaceVersion ()
 Must return an integer defining the interface's version.
 
virtual void AddCommandOverride (const char *cmd, OverrideType type, FlagBits flags)=0
 Adds a global command flag override. Any command registered with this name will assume the new flag. This is applied retroactively as well. More...
 
virtual bool GetCommandOverride (const char *cmd, OverrideType type, FlagBits *pFlags)=0
 Returns a command override. More...
 
virtual void UnsetCommandOverride (const char *cmd, OverrideType type)=0
 Unsets a command override. More...
 
virtual GroupId AddGroup (const char *group_name)=0
 Adds a new group. Name must be unique. More...
 
virtual GroupId FindGroupByName (const char *group_name)=0
 Finds a group by name. More...
 
virtual void SetGroupAddFlag (GroupId id, AdminFlag flag, bool enabled)=0
 Adds or removes a flag from a group's flag set. Note: These are called "add flags" because they add to a user's flags. More...
 
virtual bool GetGroupAddFlag (GroupId id, AdminFlag flag)=0
 Gets the set value of an add flag on a group's flag set. More...
 
virtual FlagBits GetGroupAddFlags (GroupId id)=0
 Returns an array of flag bits that are added to a user from their group. Note: These are called "add flags" because they add to a user's flags. More...
 
virtual void SetGroupGenericImmunity (GroupId id, ImmunityType type, bool enabled)=0
 DEPRECATED. Sets a group's immunity level using backwards compatible types. More...
 
virtual bool GetGroupGenericImmunity (GroupId id, ImmunityType type)=0
 DEPRECATED. Returns whether a group has an immunity level using backwards compatible types. More...
 
virtual void AddGroupImmunity (GroupId id, GroupId other_id)=0
 Adds immunity to a specific group. More...
 
virtual unsigned int GetGroupImmunityCount (GroupId id)=0
 Returns the number of specific group immunities. More...
 
virtual GroupId GetGroupImmunity (GroupId id, unsigned int number)=0
 Returns a group that this group is immune to given an index. More...
 
virtual void AddGroupCommandOverride (GroupId id, const char *name, OverrideType type, OverrideRule rule)=0
 Adds a group-specific override type. More...
 
virtual bool GetGroupCommandOverride (GroupId id, const char *name, OverrideType type, OverrideRule *pRule)=0
 Retrieves a group-specific command override. More...
 
virtual void DumpAdminCache (AdminCachePart part, bool rebuild)=0
 Tells the admin system to dump a portion of the cache. This calls into plugin forwards to rebuild the cache. More...
 
virtual void AddAdminListener (IAdminListener *pListener)=0
 Adds an admin interface listener. More...
 
virtual void RemoveAdminListener (IAdminListener *pListener)=0
 Removes an admin interface listener. More...
 
virtual void RegisterAuthIdentType (const char *name)=0
 Registers an authentication identity type. Note: Default types are "steam," "name," and "ip.". More...
 
virtual AdminId CreateAdmin (const char *name)=0
 Creates a new user entry. More...
 
virtual const char * GetAdminName (AdminId id)=0
 Gets an admin's user name. More...
 
virtual bool BindAdminIdentity (AdminId id, const char *auth, const char *ident)=0
 Binds a user entry to a particular auth method. This bind must be unique. More...
 
virtual void SetAdminFlag (AdminId id, AdminFlag flag, bool enabled)=0
 Sets whether or not a flag is enabled on an admin. More...
 
virtual bool GetAdminFlag (AdminId id, AdminFlag flag, AccessMode mode)=0
 Returns whether or not a flag is enabled on an admin. More...
 
virtual FlagBits GetAdminFlags (AdminId id, AccessMode mode)=0
 Returns the bitstring of access flags on an admin. More...
 
virtual void SetAdminFlags (AdminId id, AccessMode mode, FlagBits bits)=0
 Sets the bitstring of access flags on an admin. More...
 
virtual bool AdminInheritGroup (AdminId id, GroupId gid)=0
 Adds a group to an admin's inherited group list. Any flags the group has will be added to the admin's effective flags. More...
 
virtual unsigned int GetAdminGroupCount (AdminId id)=0
 Returns the number of groups this admin is a member of. More...
 
virtual GroupId GetAdminGroup (AdminId id, unsigned int index, const char **name)=0
 Returns group information from an admin. More...
 
virtual void SetAdminPassword (AdminId id, const char *password)=0
 Sets a password on an admin. More...
 
virtual const char * GetAdminPassword (AdminId id)=0
 Gets an admin's password. More...
 
virtual AdminId FindAdminByIdentity (const char *auth, const char *identity)=0
 Attempts to find an admin by an auth method and an identity. More...
 
virtual bool InvalidateAdmin (AdminId id)=0
 Invalidates an admin from the cache so its resources can be re-used. More...
 
virtual unsigned int FlagBitsToBitArray (FlagBits bits, bool array[], unsigned int maxSize)=0
 Converts a flag bit string to a bit array. More...
 
virtual FlagBits FlagBitArrayToBits (const bool array[], unsigned int maxSize)=0
 Converts a flag array to a bit string. More...
 
virtual FlagBits FlagArrayToBits (const AdminFlag array[], unsigned int numFlags)=0
 Converts an array of flags to bits. More...
 
virtual unsigned int FlagBitsToArray (FlagBits bits, AdminFlag array[], unsigned int maxSize)=0
 Converts a bit string to an array of flags. More...
 
virtual bool CheckAdminFlags (AdminId id, FlagBits bits)=0
 Checks whether a user has access to a given set of flag bits. Note: This is a wrapper around GetAdminFlags(). More...
 
virtual bool CanAdminTarget (AdminId id, AdminId target)=0
 Checks whether an AdminId can target another AdminId. More...
 
virtual bool FindFlag (const char *flagname, AdminFlag *pAdmFlag)=0
 Returns a flag from a named string. More...
 
virtual bool FindFlag (char c, AdminFlag *pAdmFlag)=0
 Reads a single character as a flag. More...
 
virtual FlagBits ReadFlagString (const char *flags, const char **end)=0
 Reads a string of flag letters and returns its access value. More...
 
virtual unsigned int GetAdminSerialChange (AdminId id)=0
 Returns a "serial number" for an AdminId. If the serial number has changed for a given AdminId, it means the permissions have changed. More...
 
virtual bool CanAdminUseCommand (int client, const char *cmd)=0
 Checks whether an admin can use the given command name. More...
 
virtual const char * GetGroupName (GroupId gid)=0
 Returns the name of a group. More...
 
virtual unsigned int SetGroupImmunityLevel (GroupId gid, unsigned int level)=0
 Sets the immunity level of a group. More...
 
virtual unsigned int GetGroupImmunityLevel (GroupId gid)=0
 Retrieves the immunity level of a group. More...
 
virtual unsigned int SetAdminImmunityLevel (AdminId id, unsigned int level)=0
 Sets the immunity level of an admin. More...
 
virtual unsigned int GetAdminImmunityLevel (AdminId id)=0
 Retrieves the immunity level of an admin. More...
 
virtual bool CheckAccess (int client, const char *cmd, FlagBits flags, bool override_only)=0
 Computers access to an override. More...
 
virtual bool FindFlagChar (AdminFlag flag, char *c)=0
 Reads a flag as the corresponding character. More...
 
virtual bool IsValidAdmin (AdminId id)=0
 Returns whether or not an admin id is valid. More...
 
virtual bool CheckClientCommandAccess (int client, const char *cmd, FlagBits cmdflags)=0
 Returns whether or not a client has access to a given command. More...
 
- Public Member Functions inherited from SourceMod::SMInterface
virtual bool IsVersionCompatible (unsigned int version)
 Must return whether the requested version number is backwards compatible. Note: This can be overridden for breaking changes or custom versioning. More...
 

Detailed Description

Provides functions for manipulating the admin options cache.

Member Function Documentation

virtual void SourceMod::IAdminSystem::AddAdminListener ( IAdminListener pListener)
pure virtual

Adds an admin interface listener.

Parameters
pListenerPointer to an IAdminListener to add.
virtual void SourceMod::IAdminSystem::AddCommandOverride ( const char *  cmd,
OverrideType  type,
FlagBits  flags 
)
pure virtual

Adds a global command flag override. Any command registered with this name will assume the new flag. This is applied retroactively as well.

Parameters
cmdString containing command name (case sensitive).
typeOverride type (specific command or group).
flagsNew admin flag.
virtual GroupId SourceMod::IAdminSystem::AddGroup ( const char *  group_name)
pure virtual

Adds a new group. Name must be unique.

Parameters
group_nameString containing the group name.
Returns
A new group id, INVALID_GROUP_ID if it already exists.
virtual void SourceMod::IAdminSystem::AddGroupCommandOverride ( GroupId  id,
const char *  name,
OverrideType  type,
OverrideRule  rule 
)
pure virtual

Adds a group-specific override type.

Parameters
idGroup id.
nameString containing command name (case sensitive).
typeOverride type (specific command or group).
ruleOverride allow/deny setting.
virtual void SourceMod::IAdminSystem::AddGroupImmunity ( GroupId  id,
GroupId  other_id 
)
pure virtual

Adds immunity to a specific group.

Parameters
idGroup id.
other_idGroup id to receive immunity to.
virtual bool SourceMod::IAdminSystem::AdminInheritGroup ( AdminId  id,
GroupId  gid 
)
pure virtual

Adds a group to an admin's inherited group list. Any flags the group has will be added to the admin's effective flags.

Parameters
idAdminId index of the admin.
gidGroupId index of the group.
Returns
True on success, false on invalid input or duplicate membership.
virtual bool SourceMod::IAdminSystem::BindAdminIdentity ( AdminId  id,
const char *  auth,
const char *  ident 
)
pure virtual

Binds a user entry to a particular auth method. This bind must be unique.

Parameters
idAdminId index of the admin.
authAuth method to use.
identIdentity string to bind to.
Returns
True on success, false if auth method was not found, id was invalid, or ident was already taken.
virtual bool SourceMod::IAdminSystem::CanAdminTarget ( AdminId  id,
AdminId  target 
)
pure virtual

Checks whether an AdminId can target another AdminId.

The hueristics for this check are as follows: 0. If the targeting AdminId is INVALID_ADMIN_ID, targeting fails.

  1. If the targeted AdminId is INVALID_ADMIN_ID, targeting succeeds.
  2. If the targeted AdminId is the same as the targeting AdminId, (self) targeting succeeds.
  3. If the targeting admin is root, targeting succeeds.
  4. If the targeted admin has access higher (as interpreted by (sm_immunity_mode) than the targeting admin, then targeting fails.
  5. If the targeted admin has specific immunity from the targeting admin via group immunities, targeting fails.
  6. Targeting succeeds.
Parameters
idAdminId index of admin doing the targeting. Can be INVALID_ADMIN_ID.
targetAdminId index of the target admin. Can be INVALID_ADMIN_ID.
Returns
True if this admin has permission to target the other admin.
virtual bool SourceMod::IAdminSystem::CanAdminUseCommand ( int  client,
const char *  cmd 
)
pure virtual

Checks whether an admin can use the given command name.

If the command does not exist, this will return true.

Parameters
clientClient index.
cmdCommand name.
Returns
True on success, false on failure.
virtual bool SourceMod::IAdminSystem::CheckAccess ( int  client,
const char *  cmd,
FlagBits  flags,
bool  override_only 
)
pure virtual

Computers access to an override.

Parameters
clientClient index.
cmdOverride name.
flagsDefault flags.
override_onlyIf false, if a command matches the override, then its flags will override the default.
Returns
True if the client has access, false otherwise.
virtual bool SourceMod::IAdminSystem::CheckAdminFlags ( AdminId  id,
FlagBits  bits 
)
pure virtual

Checks whether a user has access to a given set of flag bits. Note: This is a wrapper around GetAdminFlags().

Parameters
idAdminId index of admin.
bitsBitstring containing the permissions to check.
Returns
True if user has permission, false otherwise.
virtual bool SourceMod::IAdminSystem::CheckClientCommandAccess ( int  client,
const char *  cmd,
FlagBits  cmdflags 
)
pure virtual

Returns whether or not a client has access to a given command.

Parameters
clientClient index.
cmdCommand name.
flagsCommand admin flags.
Returns
True if allowed access, otherwise false;
virtual AdminId SourceMod::IAdminSystem::CreateAdmin ( const char *  name)
pure virtual

Creates a new user entry.

Parameters
nameName for this entry (does not have to be unique). Specify NULL for an anonymous admin.
Returns
A new AdminId index.
virtual void SourceMod::IAdminSystem::DumpAdminCache ( AdminCachePart  part,
bool  rebuild 
)
pure virtual

Tells the admin system to dump a portion of the cache. This calls into plugin forwards to rebuild the cache.

Parameters
partPortion of the cache to dump.
rebuildIf true, the rebuild forwards/events will fire.
virtual AdminId SourceMod::IAdminSystem::FindAdminByIdentity ( const char *  auth,
const char *  identity 
)
pure virtual

Attempts to find an admin by an auth method and an identity.

Parameters
authAuth method to try.
identityIdentity string to look up.
Returns
An AdminId index if found, INVALID_ADMIN_ID otherwise.
virtual bool SourceMod::IAdminSystem::FindFlag ( const char *  flagname,
AdminFlag *  pAdmFlag 
)
pure virtual

Returns a flag from a named string.

Parameters
flagnameCase sensitive flag name string (like "kick").
pAdmFlagPointer to store the found admin flag in.
Returns
True on success, false on failure.
virtual bool SourceMod::IAdminSystem::FindFlag ( char  c,
AdminFlag *  pAdmFlag 
)
pure virtual

Reads a single character as a flag.

Parameters
cFlag character.
pAdmFlagPointer to store the admin flag.
Returns
True on success, false if invalid.
virtual bool SourceMod::IAdminSystem::FindFlagChar ( AdminFlag  flag,
char *  c 
)
pure virtual

Reads a flag as the corresponding character.

Parameters
flagFlag to look up.
cVariable to store flag char.
Returns
True on success, false if not found.
virtual GroupId SourceMod::IAdminSystem::FindGroupByName ( const char *  group_name)
pure virtual

Finds a group by name.

Parameters
group_nameString containing the group name.
Returns
A group id, or INVALID_GROUP_ID if not found.
virtual FlagBits SourceMod::IAdminSystem::FlagArrayToBits ( const AdminFlag  array[],
unsigned int  numFlags 
)
pure virtual

Converts an array of flags to bits.

Parameters
arrayArray containing flags that are enabled.
numFlagsNumber of flags in the array.
Returns
A bit string composed of the array flags.
virtual FlagBits SourceMod::IAdminSystem::FlagBitArrayToBits ( const bool  array[],
unsigned int  maxSize 
)
pure virtual

Converts a flag array to a bit string.

Parameters
arrayArray containing true or false for each AdminFlag.
maxSizeMaximum size of the flag array.
Returns
A bit string composed of the array bits.
virtual unsigned int SourceMod::IAdminSystem::FlagBitsToArray ( FlagBits  bits,
AdminFlag  array[],
unsigned int  maxSize 
)
pure virtual

Converts a bit string to an array of flags.

Parameters
bitsBit string containing the flags.
arrayOutput array to write flags.
maxSizeMaximum size of the flag array.
Returns
Number of flags written.
virtual unsigned int SourceMod::IAdminSystem::FlagBitsToBitArray ( FlagBits  bits,
bool  array[],
unsigned int  maxSize 
)
pure virtual

Converts a flag bit string to a bit array.

Parameters
bitsBit string containing the flags.
arrayArray to write the flags to. Enabled flags will be 'true'.
maxSizeMaximum number of flags the array can store.
Returns
Number of flags written.
virtual bool SourceMod::IAdminSystem::GetAdminFlag ( AdminId  id,
AdminFlag  flag,
AccessMode  mode 
)
pure virtual

Returns whether or not a flag is enabled on an admin.

Parameters
idAdminId index of the admin.
flagAdmin flag to use.
modeAccess mode to check.
Returns
True if enabled, false otherwise.
virtual FlagBits SourceMod::IAdminSystem::GetAdminFlags ( AdminId  id,
AccessMode  mode 
)
pure virtual

Returns the bitstring of access flags on an admin.

Parameters
idAdminId index of the admin.
modeAccess mode to use.
Returns
A bit string containing which flags are enabled.
virtual GroupId SourceMod::IAdminSystem::GetAdminGroup ( AdminId  id,
unsigned int  index,
const char **  name 
)
pure virtual

Returns group information from an admin.

Parameters
idAdminId index of the admin.
indexGroup number to retrieve, from 0 to N-1, where N is the value of GetAdminGroupCount(id).
nameOptional pointer to store the group's name.
Returns
A GroupId index and a name pointer, or INVALID_GROUP_ID and NULL if an error occurred.
virtual unsigned int SourceMod::IAdminSystem::GetAdminGroupCount ( AdminId  id)
pure virtual

Returns the number of groups this admin is a member of.

Parameters
idAdminId index of the admin.
Returns
Number of groups this admin is a member of.
virtual unsigned int SourceMod::IAdminSystem::GetAdminImmunityLevel ( AdminId  id)
pure virtual

Retrieves the immunity level of an admin.

Parameters
idAdmin Id.
Returns
Immunity level value.
virtual const char* SourceMod::IAdminSystem::GetAdminName ( AdminId  id)
pure virtual

Gets an admin's user name.

Parameters
idAdminId index for this admin.
Returns
A string containing the admin's name, or NULL if the admin was created anonymously.
virtual const char* SourceMod::IAdminSystem::GetAdminPassword ( AdminId  id)
pure virtual

Gets an admin's password.

Parameters
idAdminId index of the admin.
Returns
Password of the admin, or NULL if none.
virtual unsigned int SourceMod::IAdminSystem::GetAdminSerialChange ( AdminId  id)
pure virtual

Returns a "serial number" for an AdminId. If the serial number has changed for a given AdminId, it means the permissions have changed.

Parameters
idAdminId value.
Returns
Serial number, or 0 on failure.
virtual bool SourceMod::IAdminSystem::GetCommandOverride ( const char *  cmd,
OverrideType  type,
FlagBits *  pFlags 
)
pure virtual

Returns a command override.

Parameters
cmdString containing command name (case sensitive).
typeOverride type (specific command or group).
pFlagsOptional pointer to the set flag.
Returns
True if there is an override, false otherwise.
virtual bool SourceMod::IAdminSystem::GetGroupAddFlag ( GroupId  id,
AdminFlag  flag 
)
pure virtual

Gets the set value of an add flag on a group's flag set.

Parameters
idGroup id.
flagAdmin flag to retrieve.
Returns
True if enabled, false otherwise,
virtual FlagBits SourceMod::IAdminSystem::GetGroupAddFlags ( GroupId  id)
pure virtual

Returns an array of flag bits that are added to a user from their group. Note: These are called "add flags" because they add to a user's flags.

Parameters
idGroupId of the group.
Returns
Bit string containing the bits of each flag.
virtual bool SourceMod::IAdminSystem::GetGroupCommandOverride ( GroupId  id,
const char *  name,
OverrideType  type,
OverrideRule *  pRule 
)
pure virtual

Retrieves a group-specific command override.

Parameters
idGroup id.
nameString containing command name (case sensitive).
typeOverride type (specific command or group).
pRuleOptional pointer to store allow/deny setting.
Returns
True if an override exists, false otherwise.
virtual bool SourceMod::IAdminSystem::GetGroupGenericImmunity ( GroupId  id,
ImmunityType  type 
)
pure virtual

DEPRECATED. Returns whether a group has an immunity level using backwards compatible types.

This simply checks whether the group's immunity value is greater than or equal to the new-style value for the old type.

Parameters
idGroup id.
typeGeneric immunity type.
Returns
True if the group has this immunity, false otherwise.
virtual GroupId SourceMod::IAdminSystem::GetGroupImmunity ( GroupId  id,
unsigned int  number 
)
pure virtual

Returns a group that this group is immune to given an index.

Parameters
idGroup id.
numberIndex from 0 to N-1, from GetGroupImmunities().
Returns
GroupId that this group is immune to.
virtual unsigned int SourceMod::IAdminSystem::GetGroupImmunityCount ( GroupId  id)
pure virtual

Returns the number of specific group immunities.

Parameters
idGroup id.
Returns
Number of group immunities.
virtual unsigned int SourceMod::IAdminSystem::GetGroupImmunityLevel ( GroupId  gid)
pure virtual

Retrieves the immunity level of a group.

Parameters
gidGroup Id.
Returns
Immunity level value.
virtual const char* SourceMod::IAdminSystem::GetGroupName ( GroupId  gid)
pure virtual

Returns the name of a group.

Parameters
gidGroup Id.
Returns
Group name, or NULL on failure.
virtual bool SourceMod::IAdminSystem::InvalidateAdmin ( AdminId  id)
pure virtual

Invalidates an admin from the cache so its resources can be re-used.

Parameters
idAdminId index to invalidate.
Returns
True on success, false otherwise.
virtual bool SourceMod::IAdminSystem::IsValidAdmin ( AdminId  id)
pure virtual

Returns whether or not an admin id is valid.

Parameters
idAdmin id to check.
Returns
True if valid, otherwise false.
virtual FlagBits SourceMod::IAdminSystem::ReadFlagString ( const char *  flags,
const char **  end 
)
pure virtual

Reads a string of flag letters and returns its access value.

Parameters
flagsFlag string.
endPointer to store the last value read. On success, this will store a pointer to the null terminator.
Returns
FlagBits value of the flags.
virtual void SourceMod::IAdminSystem::RegisterAuthIdentType ( const char *  name)
pure virtual

Registers an authentication identity type. Note: Default types are "steam," "name," and "ip.".

Parameters
nameString containing the type name.
virtual void SourceMod::IAdminSystem::RemoveAdminListener ( IAdminListener pListener)
pure virtual

Removes an admin interface listener.

Parameters
pListenerPointer to an IAdminListener to remove.
virtual void SourceMod::IAdminSystem::SetAdminFlag ( AdminId  id,
AdminFlag  flag,
bool  enabled 
)
pure virtual

Sets whether or not a flag is enabled on an admin.

Parameters
idAdminId index of the admin.
flagAdmin flag to use.
enabledTrue to enable, false to disable.
virtual void SourceMod::IAdminSystem::SetAdminFlags ( AdminId  id,
AccessMode  mode,
FlagBits  bits 
)
pure virtual

Sets the bitstring of access flags on an admin.

Parameters
idAdminId index of the admin.
modeAccess mode to use (real affects both).
bitsBitstring to set.
virtual unsigned int SourceMod::IAdminSystem::SetAdminImmunityLevel ( AdminId  id,
unsigned int  level 
)
pure virtual

Sets the immunity level of an admin.

Parameters
idAdmin Id.
levelImmunity level value.
Returns
Old immunity level.
virtual void SourceMod::IAdminSystem::SetAdminPassword ( AdminId  id,
const char *  password 
)
pure virtual

Sets a password on an admin.

Parameters
idAdminId index of the admin.
passwordString containing the password.
virtual void SourceMod::IAdminSystem::SetGroupAddFlag ( GroupId  id,
AdminFlag  flag,
bool  enabled 
)
pure virtual

Adds or removes a flag from a group's flag set. Note: These are called "add flags" because they add to a user's flags.

Parameters
idGroup id.
flagAdmin flag to toggle.
enabledTrue to set the flag, false to unset/disable.
virtual void SourceMod::IAdminSystem::SetGroupGenericImmunity ( GroupId  id,
ImmunityType  type,
bool  enabled 
)
pure virtual

DEPRECATED. Sets a group's immunity level using backwards compatible types.

If the new level being set is lower than the group's actual immunity level, no operation takes place.

Parameters
idGroup id.
typeImmunity type which will be converted to a numerical level.
enabledTrue to set the level. False sets the group's immunity value to 0.
virtual unsigned int SourceMod::IAdminSystem::SetGroupImmunityLevel ( GroupId  gid,
unsigned int  level 
)
pure virtual

Sets the immunity level of a group.

Parameters
gidGroup Id.
levelImmunity level value.
Returns
Old immunity level.
virtual void SourceMod::IAdminSystem::UnsetCommandOverride ( const char *  cmd,
OverrideType  type 
)
pure virtual

Unsets a command override.

Parameters
cmdString containing command name (case sensitive).
typeOverride type (specific command or group).

The documentation for this class was generated from the following file: