SourceMod::IAdminSystem Class Reference

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

#include <public/IAdminSystem.h>

Inherits SourceMod::SMInterface.

Inheritance diagram for SourceMod::IAdminSystem:

[legend]
Collaboration diagram for SourceMod::IAdminSystem:
[legend]
List of all members.

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.
virtual bool GetCommandOverride (const char *cmd, OverrideType type, FlagBits *pFlags)=0
 Returns a command override.
virtual void UnsetCommandOverride (const char *cmd, OverrideType type)=0
 Unsets a command override.
virtual GroupId AddGroup (const char *group_name)=0
 Adds a new group. Name must be unique.
virtual GroupId FindGroupByName (const char *group_name)=0
 Finds a group by name.
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.
virtual bool GetGroupAddFlag (GroupId id, AdminFlag flag)=0
 Gets the set value of an add flag on a group's flag set.
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.
virtual void SetGroupGenericImmunity (GroupId id, ImmunityType type, bool enabled)=0
 DEPRECATED. Sets a group's immunity level using backwards compatible types.
virtual bool GetGroupGenericImmunity (GroupId id, ImmunityType type)=0
 DEPRECATED. Returns whether a group has an immunity level using backwards compatible types.
virtual void AddGroupImmunity (GroupId id, GroupId other_id)=0
 Adds immunity to a specific group.
virtual unsigned int GetGroupImmunityCount (GroupId id)=0
 Returns the number of specific group immunities.
virtual GroupId GetGroupImmunity (GroupId id, unsigned int number)=0
 Returns a group that this group is immune to given an index.
virtual void AddGroupCommandOverride (GroupId id, const char *name, OverrideType type, OverrideRule rule)=0
 Adds a group-specific override type.
virtual bool GetGroupCommandOverride (GroupId id, const char *name, OverrideType type, OverrideRule *pRule)=0
 Retrieves a group-specific command override.
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.
virtual void AddAdminListener (IAdminListener *pListener)=0
 Adds an admin interface listener.
virtual void RemoveAdminListener (IAdminListener *pListener)=0
 Removes an admin interface listener.
virtual void RegisterAuthIdentType (const char *name)=0
 Registers an authentication identity type. Note: Default types are "steam," "name," and "ip.".
virtual AdminId CreateAdmin (const char *name)=0
 Creates a new user entry.
virtual const char * GetAdminName (AdminId id)=0
 Gets an admin's user name.
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.
virtual void SetAdminFlag (AdminId id, AdminFlag flag, bool enabled)=0
 Sets whether or not a flag is enabled on an admin.
virtual bool GetAdminFlag (AdminId id, AdminFlag flag, AccessMode mode)=0
 Returns whether or not a flag is enabled on an admin.
virtual FlagBits GetAdminFlags (AdminId id, AccessMode mode)=0
 Returns the bitstring of access flags on an admin.
virtual void SetAdminFlags (AdminId id, AccessMode mode, FlagBits bits)=0
 Sets the bitstring of access flags on an admin.
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.
virtual unsigned int GetAdminGroupCount (AdminId id)=0
 Returns the number of groups this admin is a member of.
virtual GroupId GetAdminGroup (AdminId id, unsigned int index, const char **name)=0
 Returns group information from an admin.
virtual void SetAdminPassword (AdminId id, const char *password)=0
 Sets a password on an admin.
virtual const char * GetAdminPassword (AdminId id)=0
 Gets an admin's password.
virtual AdminId FindAdminByIdentity (const char *auth, const char *identity)=0
 Attempts to find an admin by an auth method and an identity.
virtual bool InvalidateAdmin (AdminId id)=0
 Invalidates an admin from the cache so its resources can be re-used.
virtual unsigned int FlagBitsToBitArray (FlagBits bits, bool array[], unsigned int maxSize)=0
 Converts a flag bit string to a bit array.
virtual FlagBits FlagBitArrayToBits (const bool array[], unsigned int maxSize)=0
 Converts a flag array to a bit string.
virtual FlagBits FlagArrayToBits (const AdminFlag array[], unsigned int numFlags)=0
 Converts an array of flags to bits.
virtual unsigned int FlagBitsToArray (FlagBits bits, AdminFlag array[], unsigned int maxSize)=0
 Converts a bit string to an array of flags.
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().
virtual bool CanAdminTarget (AdminId id, AdminId target)=0
 Checks whether an AdminId can target another AdminId.
virtual bool FindFlag (const char *flagname, AdminFlag *pAdmFlag)=0
 Returns a flag from a named string.
virtual bool FindFlag (char c, AdminFlag *pAdmFlag)=0
 Reads a single character as a flag.
virtual FlagBits ReadFlagString (const char *flags, const char **end)=0
 Reads a string of flag letters and returns its access value.
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.
virtual bool CanAdminUseCommand (int client, const char *cmd)=0
 Checks whether an admin can use the given command name.
virtual const char * GetGroupName (GroupId gid)=0
 Returns the name of a group.
virtual unsigned int SetGroupImmunityLevel (GroupId gid, unsigned int level)=0
 Sets the immunity level of a group.
virtual unsigned int GetGroupImmunityLevel (GroupId gid)=0
 Retrieves the immunity level of a group.
virtual unsigned int SetAdminImmunityLevel (AdminId id, unsigned int level)=0
 Sets the immunity level of an admin.
virtual unsigned int GetAdminImmunityLevel (AdminId id)=0
 Retrieves the immunity level of an admin.
virtual bool CheckAccess (int client, const char *cmd, FlagBits flags, bool override_only)=0
 Computers access to an override.

Detailed Description

Provides functions for manipulating the admin options cache.

Definition at line 220 of file IAdminSystem.h.


Member Function Documentation

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:
cmd String containing command name (case sensitive).
type Override type (specific command or group).
flags New admin flag.

virtual bool SourceMod::IAdminSystem::GetCommandOverride ( const char *  cmd,
OverrideType  type,
FlagBits pFlags 
) [pure virtual]

Returns a command override.

Parameters:
cmd String containing command name (case sensitive).
type Override type (specific command or group).
pFlags Optional pointer to the set flag.
Returns:
True if there is an override, false otherwise.

virtual void SourceMod::IAdminSystem::UnsetCommandOverride ( const char *  cmd,
OverrideType  type 
) [pure virtual]

Unsets a command override.

Parameters:
cmd String containing command name (case sensitive).
type Override type (specific command or group).

virtual GroupId SourceMod::IAdminSystem::AddGroup ( const char *  group_name  )  [pure virtual]

Adds a new group. Name must be unique.

Parameters:
group_name String containing the group name.
Returns:
A new group id, INVALID_GROUP_ID if it already exists.

virtual GroupId SourceMod::IAdminSystem::FindGroupByName ( const char *  group_name  )  [pure virtual]

Finds a group by name.

Parameters:
group_name String containing the group name.
Returns:
A group id, or INVALID_GROUP_ID if not found.

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:
id Group id.
flag Admin flag to toggle.
enabled True to set the flag, false to unset/disable.

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:
id Group id.
flag Admin 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:
id GroupId of the group.
Returns:
Bit string containing the bits of each flag.

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:
id Group id.
type Immunity type which will be converted to a numerical level.
enabled True to set the level. False sets the group's immunity value to 0.

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:
id Group id.
type Generic immunity type.
Returns:
True if the group has this immunity, false otherwise.

virtual void SourceMod::IAdminSystem::AddGroupImmunity ( GroupId  id,
GroupId  other_id 
) [pure virtual]

Adds immunity to a specific group.

Parameters:
id Group id.
other_id Group id to receive immunity to.

virtual unsigned int SourceMod::IAdminSystem::GetGroupImmunityCount ( GroupId  id  )  [pure virtual]

Returns the number of specific group immunities.

Parameters:
id Group id.
Returns:
Number of group immunities.

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:
id Group id.
number Index from 0 to N-1, from GetGroupImmunities().
Returns:
GroupId that this group is immune to.

virtual void SourceMod::IAdminSystem::AddGroupCommandOverride ( GroupId  id,
const char *  name,
OverrideType  type,
OverrideRule  rule 
) [pure virtual]

Adds a group-specific override type.

Parameters:
id Group id.
name String containing command name (case sensitive).
type Override type (specific command or group).
rule Override allow/deny setting.

virtual bool SourceMod::IAdminSystem::GetGroupCommandOverride ( GroupId  id,
const char *  name,
OverrideType  type,
OverrideRule pRule 
) [pure virtual]

Retrieves a group-specific command override.

Parameters:
id Group id.
name String containing command name (case sensitive).
type Override type (specific command or group).
pRule Optional pointer to store allow/deny setting.
Returns:
True if an override exists, false otherwise.

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:
part Portion of the cache to dump.
rebuild If true, the rebuild forwards/events will fire.

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

Adds an admin interface listener.

Parameters:
pListener Pointer to an IAdminListener to add.

virtual void SourceMod::IAdminSystem::RemoveAdminListener ( IAdminListener pListener  )  [pure virtual]

Removes an admin interface listener.

Parameters:
pListener Pointer to an IAdminListener to remove.

virtual void SourceMod::IAdminSystem::RegisterAuthIdentType ( const char *  name  )  [pure virtual]

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

Parameters:
name String containing the type name.

virtual AdminId SourceMod::IAdminSystem::CreateAdmin ( const char *  name  )  [pure virtual]

Creates a new user entry.

Parameters:
name Name for this entry (does not have to be unique). Specify NULL for an anonymous admin.
Returns:
A new AdminId index.

virtual const char* SourceMod::IAdminSystem::GetAdminName ( AdminId  id  )  [pure virtual]

Gets an admin's user name.

Parameters:
id AdminId index for this admin.
Returns:
A string containing the admin's name, or NULL if the admin was created anonymously.

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:
id AdminId index of the admin.
auth Auth method to use.
ident Identity string to bind to.
Returns:
True on success, false if auth method was not found, id was invalid, or ident was already taken.

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:
id AdminId index of the admin.
flag Admin flag to use.
enabled True to enable, false to disable.

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:
id AdminId index of the admin.
flag Admin flag to use.
mode Access 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:
id AdminId index of the admin.
mode Access mode to use.
Returns:
A bit string containing which flags are enabled.

virtual void SourceMod::IAdminSystem::SetAdminFlags ( AdminId  id,
AccessMode  mode,
FlagBits  bits 
) [pure virtual]

Sets the bitstring of access flags on an admin.

Parameters:
id AdminId index of the admin.
mode Access mode to use (real affects both).
bits Bitstring to set.

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:
id AdminId index of the admin.
gid GroupId index of the group.
Returns:
True on success, false on invalid input or duplicate membership.

virtual unsigned int SourceMod::IAdminSystem::GetAdminGroupCount ( AdminId  id  )  [pure virtual]

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

Parameters:
id AdminId index of the admin.
Returns:
Number of groups this admin is a member of.

virtual GroupId SourceMod::IAdminSystem::GetAdminGroup ( AdminId  id,
unsigned int  index,
const char **  name 
) [pure virtual]

Returns group information from an admin.

Parameters:
id AdminId index of the admin.
index Group number to retrieve, from 0 to N-1, where N is the value of GetAdminGroupCount(id).
name Optional 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 void SourceMod::IAdminSystem::SetAdminPassword ( AdminId  id,
const char *  password 
) [pure virtual]

Sets a password on an admin.

Parameters:
id AdminId index of the admin.
password String containing the password.

virtual const char* SourceMod::IAdminSystem::GetAdminPassword ( AdminId  id  )  [pure virtual]

Gets an admin's password.

Parameters:
id AdminId index of the admin.
Returns:
Password of the admin, or NULL if none.

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:
auth Auth method to try.
identity Identity string to look up.
Returns:
An AdminId index if found, INVALID_ADMIN_ID otherwise.

virtual bool SourceMod::IAdminSystem::InvalidateAdmin ( AdminId  id  )  [pure virtual]

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

Parameters:
id AdminId index to invalidate.
Returns:
True on success, false otherwise.

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:
bits Bit string containing the flags.
array Array to write the flags to. Enabled flags will be 'true'.
maxSize Maximum number of flags the array can store.
Returns:
Number of flags written.

virtual FlagBits SourceMod::IAdminSystem::FlagBitArrayToBits ( const bool  array[],
unsigned int  maxSize 
) [pure virtual]

Converts a flag array to a bit string.

Parameters:
array Array containing true or false for each AdminFlag.
maxSize Maximum size of the flag array.
Returns:
A bit string composed of the array bits.

virtual FlagBits SourceMod::IAdminSystem::FlagArrayToBits ( const AdminFlag  array[],
unsigned int  numFlags 
) [pure virtual]

Converts an array of flags to bits.

Parameters:
array Array containing flags that are enabled.
numFlags Number of flags in the array.
Returns:
A bit string composed of the array flags.

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:
bits Bit string containing the flags.
array Output array to write flags.
maxSize Maximum size of the flag array.
Returns:
Number of flags written.

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:
id AdminId index of admin.
bits Bitstring containing the permissions to check.
Returns:
True if user has permission, false otherwise.

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:
id AdminId index of admin doing the targeting. Can be INVALID_ADMIN_ID.
target AdminId 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::FindFlag ( const char *  flagname,
AdminFlag pAdmFlag 
) [pure virtual]

Returns a flag from a named string.

Parameters:
flagname Case sensitive flag name string (like "kick").
pAdmFlag Pointer 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:
c Flag character.
pAdmFlag Pointer to store the admin flag.
Returns:
True on success, false if invalid.

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:
flags Flag string.
end Pointer to store the last value read. On success, this will store a pointer to the null terminator.
Returns:
FlagBits value of the flags.

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:
id AdminId value.
Returns:
Serial number, or 0 on failure.

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:
client Client index.
cmd Command name.
Returns:
True on success, false on failure.

virtual const char* SourceMod::IAdminSystem::GetGroupName ( GroupId  gid  )  [pure virtual]

Returns the name of a group.

Parameters:
gid Group Id.
Returns:
Group name, or NULL on failure.

virtual unsigned int SourceMod::IAdminSystem::SetGroupImmunityLevel ( GroupId  gid,
unsigned int  level 
) [pure virtual]

Sets the immunity level of a group.

Parameters:
gid Group Id.
level Immunity level value.
Returns:
Old immunity level.

virtual unsigned int SourceMod::IAdminSystem::GetGroupImmunityLevel ( GroupId  gid  )  [pure virtual]

Retrieves the immunity level of a group.

Parameters:
gid Group Id.
Returns:
Immunity level value.

virtual unsigned int SourceMod::IAdminSystem::SetAdminImmunityLevel ( AdminId  id,
unsigned int  level 
) [pure virtual]

Sets the immunity level of an admin.

Parameters:
id Admin Id.
level Immunity level value.
Returns:
Old immunity level.

virtual unsigned int SourceMod::IAdminSystem::GetAdminImmunityLevel ( AdminId  id  )  [pure virtual]

Retrieves the immunity level of an admin.

Parameters:
id Admin Id.
Returns:
Immunity level value.

virtual bool SourceMod::IAdminSystem::CheckAccess ( int  client,
const char *  cmd,
FlagBits  flags,
bool  override_only 
) [pure virtual]

Computers access to an override.

Parameters:
client Client index.
cmd Override name.
flags Default flags.
override_only If false, if a command matches the override, then its flags will override the default.
Returns:
True if the client has access, false otherwise.


The documentation for this class was generated from the following file:
Generated on Fri Nov 21 06:10:04 2008 for SourceMod SDK by  doxygen 1.5.1