32 #ifndef _INCLUDE_SOURCEMOD_ADMINISTRATION_SYSTEM_H_
33 #define _INCLUDE_SOURCEMOD_ADMINISTRATION_SYSTEM_H_
37 #define SMINTERFACE_ADMINSYS_NAME "IAdminSys"
38 #define SMINTERFACE_ADMINSYS_VERSION 8
70 Admin_Reservation = 0,
95 #define ADMFLAG_RESERVATION (1<<0)
96 #define ADMFLAG_GENERIC (1<<1)
97 #define ADMFLAG_KICK (1<<2)
98 #define ADMFLAG_BAN (1<<3)
99 #define ADMFLAG_UNBAN (1<<4)
100 #define ADMFLAG_SLAY (1<<5)
101 #define ADMFLAG_CHANGEMAP (1<<6)
102 #define ADMFLAG_CONVARS (1<<7)
103 #define ADMFLAG_CONFIG (1<<8)
104 #define ADMFLAG_CHAT (1<<9)
105 #define ADMFLAG_VOTE (1<<10)
106 #define ADMFLAG_PASSWORD (1<<11)
107 #define ADMFLAG_RCON (1<<12)
108 #define ADMFLAG_CHEATS (1<<13)
109 #define ADMFLAG_ROOT (1<<14)
110 #define ADMFLAG_CUSTOM1 (1<<15)
111 #define ADMFLAG_CUSTOM2 (1<<16)
112 #define ADMFLAG_CUSTOM3 (1<<17)
113 #define ADMFLAG_CUSTOM4 (1<<18)
114 #define ADMFLAG_CUSTOM5 (1<<19)
115 #define ADMFLAG_CUSTOM6 (1<<20)
122 Override_Command = 1,
123 Override_CommandGroup,
140 Immunity_Default = 1,
166 #define INVALID_GROUP_ID -1
171 #define INVALID_ADMIN_ID -1
178 AdminCache_Overrides = 0,
179 AdminCache_Groups = 1,
180 AdminCache_Admins = 2,
189 virtual unsigned int GetInterfaceVersion()
191 return SMINTERFACE_ADMINSYS_VERSION;
215 typedef unsigned int FlagBits;
229 return SMINTERFACE_ADMINSYS_VERSION;
240 virtual void AddCommandOverride(
const char *cmd, OverrideType type, FlagBits flags) =0;
250 virtual bool GetCommandOverride(
const char *cmd, OverrideType type, FlagBits *pFlags) =0;
266 virtual GroupId
AddGroup(
const char *group_name) =0;
284 virtual void SetGroupAddFlag(GroupId
id, AdminFlag flag,
bool enabled) =0;
369 OverrideRule rule) =0;
383 OverrideRule *pRule) =0;
392 virtual void DumpAdminCache(AdminCachePart part,
bool rebuild) =0;
444 virtual bool BindAdminIdentity(AdminId
id,
const char *auth,
const char *ident) =0;
453 virtual void SetAdminFlag(AdminId
id, AdminFlag flag,
bool enabled) =0;
463 virtual bool GetAdminFlag(AdminId
id, AdminFlag flag, AccessMode mode) =0;
472 virtual FlagBits
GetAdminFlags(AdminId
id, AccessMode mode) =0;
481 virtual void SetAdminFlags(AdminId
id, AccessMode mode, FlagBits bits) =0;
511 virtual GroupId
GetAdminGroup(AdminId
id,
unsigned int index,
const char **name) =0;
554 virtual unsigned int FlagBitsToBitArray(FlagBits bits,
bool array[],
unsigned int maxSize) =0;
572 virtual FlagBits
FlagArrayToBits(
const AdminFlag array[],
unsigned int numFlags) =0;
582 virtual unsigned int FlagBitsToArray(FlagBits bits, AdminFlag array[],
unsigned int maxSize) =0;
622 virtual bool FindFlag(
const char *flagname, AdminFlag *pAdmFlag) =0;
631 virtual bool FindFlag(
char c, AdminFlag *pAdmFlag) =0;
641 virtual FlagBits
ReadFlagString(
const char *flags,
const char **end) =0;
719 bool override_only) =0;
750 #endif //_INCLUDE_SOURCEMOD_ADMINISTRATION_SYSTEM_H_
virtual void SetAdminPassword(AdminId id, const char *password)=0
Sets a password on an admin.
virtual GroupId GetGroupImmunity(GroupId id, unsigned int number)=0
Returns a group that this group is immune to given an index.
const char * GetInterfaceName()
Must return a string defining the interface's unique name.
Definition: IAdminSystem.h:223
virtual bool FindFlagChar(AdminFlag flag, char *c)=0
Reads a flag as the corresponding character.
virtual GroupId AddGroup(const char *group_name)=0
Adds a new group. Name must be unique.
virtual FlagBits ReadFlagString(const char *flags, const char **end)=0
Reads a string of flag letters and returns its access value.
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 GetAdmin...
virtual void UnsetCommandOverride(const char *cmd, OverrideType type)=0
Unsets a command override.
virtual bool GetGroupGenericImmunity(GroupId id, ImmunityType type)=0
DEPRECATED. Returns whether a group has an immunity level using backwards compatible types...
virtual bool IsValidAdmin(AdminId id)=0
Returns whether or not an admin id is valid.
virtual void OnRebuildOverrideCache()=0
Called when the global override cache needs to be rebuilt.
#define SMINTERFACE_ADMINSYS_NAME
Definition: IAdminSystem.h:37
virtual GroupId FindGroupByName(const char *group_name)=0
Finds a group by name.
virtual bool GetGroupAddFlag(GroupId id, AdminFlag flag)=0
Gets the set value of an add flag on a group's flag set.
virtual void AddGroupCommandOverride(GroupId id, const char *name, OverrideType type, OverrideRule rule)=0
Adds a group-specific override type.
Defines the Share System, responsible for shared resources and dependencies.
virtual void SetAdminFlag(AdminId id, AdminFlag flag, bool enabled)=0
Sets whether or not a flag is enabled on an admin.
virtual GroupId GetAdminGroup(AdminId id, unsigned int index, const char **name)=0
Returns group information from an admin.
virtual unsigned int SetAdminImmunityLevel(AdminId id, unsigned int level)=0
Sets the immunity level of an admin.
Defines the base functionality required by a shared interface.
Definition: IShareSys.h:92
virtual FlagBits FlagArrayToBits(const AdminFlag array[], unsigned int numFlags)=0
Converts an array of flags to bits.
virtual unsigned int FlagBitsToBitArray(FlagBits bits, bool array[], unsigned int maxSize)=0
Converts a flag bit string to a bit array.
Provides functions for manipulating the admin options cache.
Definition: IAdminSystem.h:220
virtual void RegisterAuthIdentType(const char *name)=0
Registers an authentication identity type. Note: Default types are "steam," "name," and "ip.".
virtual void RemoveAdminListener(IAdminListener *pListener)=0
Removes an admin interface listener.
virtual unsigned int GetGroupImmunityLevel(GroupId gid)=0
Retrieves the immunity level of a group.
virtual unsigned int FlagBitsToArray(FlagBits bits, AdminFlag array[], unsigned int maxSize)=0
Converts a bit string to an array of flags.
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...
virtual FlagBits GetAdminFlags(AdminId id, AccessMode mode)=0
Returns the bitstring of access flags on an admin.
virtual void OnRebuildGroupCache()=0
Called when the group cache needs to be rebuilt.
unsigned int GetInterfaceVersion()
Must return an integer defining the interface's version.
Definition: IAdminSystem.h:227
virtual bool InvalidateAdmin(AdminId id)=0
Invalidates an admin from the cache so its resources can be re-used.
virtual void SetGroupGenericImmunity(GroupId id, ImmunityType type, bool enabled)=0
DEPRECATED. Sets a group's immunity level using backwards compatible types.
virtual const char * GetAdminName(AdminId id)=0
Gets an admin's user name.
virtual bool CanAdminUseCommand(int client, const char *cmd)=0
Checks whether an admin can use the given command name.
virtual void AddAdminListener(IAdminListener *pListener)=0
Adds an admin interface listener.
virtual unsigned int SetGroupImmunityLevel(GroupId gid, unsigned int level)=0
Sets the immunity level of a group.
virtual const char * GetGroupName(GroupId gid)=0
Returns the name of a group.
virtual bool CheckAccess(int client, const char *cmd, FlagBits flags, bool override_only)=0
Computers access to an override.
virtual unsigned int GetGroupImmunityCount(GroupId id)=0
Returns the number of specific group immunities.
virtual const char * GetAdminPassword(AdminId id)=0
Gets an admin's password.
virtual bool CanAdminTarget(AdminId id, AdminId target)=0
Checks whether an AdminId can target another AdminId.
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...
virtual AdminId CreateAdmin(const char *name)=0
Creates a new user entry.
virtual bool GetAdminFlag(AdminId id, AdminFlag flag, AccessMode mode)=0
Returns whether or not a flag is enabled on an admin.
virtual FlagBits FlagBitArrayToBits(const bool array[], unsigned int maxSize)=0
Converts a flag array to a bit string.
virtual bool FindFlag(const char *flagname, AdminFlag *pAdmFlag)=0
Returns a flag from a named string.
virtual bool GetCommandOverride(const char *cmd, OverrideType type, FlagBits *pFlags)=0
Returns a command override.
Definition: IAdminSystem.h:63
virtual AdminId FindAdminByIdentity(const char *auth, const char *identity)=0
Attempts to find an admin by an auth method and an identity.
Provides callbacks for admin cache operations.
Definition: IAdminSystem.h:186
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 unsigned int GetAdminImmunityLevel(AdminId id)=0
Retrieves the immunity level of an admin.
virtual void SetAdminFlags(AdminId id, AccessMode mode, FlagBits bits)=0
Sets the bitstring of access flags on an admin.
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 ...
virtual void OnRebuildAdminCache(bool auto_rebuild)=0
Called when the admin cache needs to be rebuilt.
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...
virtual bool CheckClientCommandAccess(int client, const char *cmd, FlagBits cmdflags)=0
Returns whether or not a client has access to a given command.
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 t...
virtual unsigned int GetAdminSerialChange(AdminId id)=0
Returns a "serial number" for an AdminId. If the serial number has changed for a given AdminId...
virtual void AddGroupImmunity(GroupId id, GroupId other_id)=0
Adds immunity to a specific group.
virtual unsigned int GetAdminGroupCount(AdminId id)=0
Returns the number of groups this admin is a member of.
virtual bool GetGroupCommandOverride(GroupId id, const char *name, OverrideType type, OverrideRule *pRule)=0
Retrieves a group-specific command override.