public/IAdminSystem.h
author David Anderson <dvander@alliedmods.net>
Wed Jun 06 17:34:35 2007 +0000 (2007-06-06)
changeset 888 b3c080b0e9bb
parent 729 110c14c99545
child 1226 478550a4d5ec
permissions -rw-r--r--
- fixed a serious bug where %T arguments were read backwards (they now match the wiki documentation of phrase and then client)
- fixed a bug where the argument count for %T was not checked properly
     1 /**
     2  * vim: set ts=4 :
     3  * ===============================================================
     4  * SourceMod, Copyright (C) 2004-2007 AlliedModders LLC. 
     5  * All rights reserved.
     6  * ===============================================================
     7  *
     8  *  This file is part of the SourceMod/SourcePawn SDK.  This file may only be 
     9  * used or modified under the Terms and Conditions of its License Agreement, 
    10  * which is found in public/licenses/LICENSE.txt.  As of this notice, derivative 
    11  * works must be licensed under the GNU General Public License (version 2 or 
    12  * greater).  A copy of the GPL is included under public/licenses/GPL.txt.
    13  * 
    14  * To view the latest information, see: http://www.sourcemod.net/license.php
    15  *
    16  * Version: $Id$
    17  */
    18 
    19 #ifndef _INCLUDE_SOURCEMOD_ADMINISTRATION_SYSTEM_H_
    20 #define _INCLUDE_SOURCEMOD_ADMINISTRATION_SYSTEM_H_
    21 
    22 #include <IShareSys.h>
    23 
    24 #define SMINTERFACE_ADMINSYS_NAME		"IAdminSys"
    25 #define SMINTERFACE_ADMINSYS_VERSION	1
    26 
    27 /**
    28  * @file IAdminSystem.h
    29  * @brief Defines the interface to manage the Admin Users/Groups and Override caches.
    30  *
    31  *   The administration system is more of a volatile cache than a system.  It is designed to be 
    32  * temporary rather than permanent, in order to compensate for more storage methods.  For example,
    33  * a flat file might be read into the cache all at once.  But a MySQL-based system might only cache
    34  * admin permissions when that specific admin connects.  
    35  *
    36  *   The override cache is the simplest to explain.  Any time an override is added, any existing 
    37  * and all future commands will gain a new access level set by the override.  If unset, the default
    38  * access level is restored.  This cache is dynamically changeable.
    39  *
    40  *   The group cache contains, for each group:
    41  *	1] A set of inherent flags - fully readable/writable.
    42  *  2] An immunity table - insertion and retrieval only.
    43  *  3] An override table - insertion and retrieval only.
    44  *   Individual groups can be invalidated entirely.  It should be considered an expensive
    45  *  operation, since each admin needs to be patched up to not reference the group.
    46  *
    47  *   For more information, see the SourceMod Development wiki.
    48  */
    49 
    50 namespace SourceMod
    51 {
    52 	/**
    53 	 * @brief Access levels (flags) for admins.
    54 	 */
    55 	enum AdminFlag
    56 	{
    57 		Admin_Reservation = 0,	/**< Reserved slot */
    58 		Admin_Generic,			/**< Generic admin abilities */
    59 		Admin_Kick,				/**< Kick another user */
    60 		Admin_Ban,				/**< Ban another user */
    61 		Admin_Unban,			/**< Unban another user */
    62 		Admin_Slay,				/**< Slay/kill/damage another user */
    63 		Admin_Changemap,		/**< Change the map */
    64 		Admin_Convars,			/**< Change basic convars */
    65 		Admin_Config,			/**< Change configuration */
    66 		Admin_Chat,				/**< Special chat privileges */
    67 		Admin_Vote,				/**< Special vote privileges */
    68 		Admin_Password,			/**< Set a server password */
    69 		Admin_RCON,				/**< Use RCON */
    70 		Admin_Cheats,			/**< Change sv_cheats and use its commands */
    71 		Admin_Root,				/**< All access by default */
    72 		Admin_Custom1,			/**< First custom flag type */
    73 		Admin_Custom2,			/**< Second custom flag type */
    74 		Admin_Custom3,			/**< Third custom flag type */
    75 		Admin_Custom4,			/**< Fourth custom flag type */
    76 		Admin_Custom5,			/**< Fifth custom flag type */
    77 		Admin_Custom6,			/**< Sixth custom flag type */
    78 		/* --- */
    79 		AdminFlags_TOTAL,
    80 	};
    81 
    82 	#define ADMFLAG_RESERVATION			(1<<0)		/**< Convenience macro for Admin_Reservation as a FlagBit */
    83 	#define ADMFLAG_GENERIC				(1<<1)		/**< Convenience macro for Admin_Generic as a FlagBit */
    84 	#define ADMFLAG_KICK				(1<<2)		/**< Convenience macro for Admin_Kick as a FlagBit */
    85 	#define ADMFLAG_BAN					(1<<3)		/**< Convenience macro for Admin_Ban as a FlagBit */
    86 	#define ADMFLAG_UNBAN				(1<<4)		/**< Convenience macro for Admin_Unban as a FlagBit */
    87 	#define ADMFLAG_SLAY				(1<<5)		/**< Convenience macro for Admin_Slay as a FlagBit */
    88 	#define ADMFLAG_CHANGEMAP			(1<<6)		/**< Convenience macro for Admin_Changemap as a FlagBit */
    89 	#define ADMFLAG_CONVARS				(1<<7)		/**< Convenience macro for Admin_Convars as a FlagBit */
    90 	#define ADMFLAG_CONFIG				(1<<8)		/**< Convenience macro for Admin_Config as a FlagBit */
    91 	#define ADMFLAG_CHAT				(1<<9)		/**< Convenience macro for Admin_Chat as a FlagBit */
    92 	#define ADMFLAG_VOTE				(1<<10)		/**< Convenience macro for Admin_Vote as a FlagBit */
    93 	#define ADMFLAG_PASSWORD			(1<<11)		/**< Convenience macro for Admin_Password as a FlagBit */
    94 	#define ADMFLAG_RCON				(1<<12)		/**< Convenience macro for Admin_RCON as a FlagBit */
    95 	#define ADMFLAG_CHEATS				(1<<13)		/**< Convenience macro for Admin_Cheats as a FlagBit */
    96 	#define ADMFLAG_ROOT				(1<<14)		/**< Convenience macro for Admin_Root as a FlagBit */
    97 	#define ADMFLAG_CUSTOM1				(1<<15)		/**< Convenience macro for Admin_Custom1 as a FlagBit */
    98 	#define ADMFLAG_CUSTOM2				(1<<16)		/**< Convenience macro for Admin_Custom2 as a FlagBit */
    99 	#define ADMFLAG_CUSTOM3				(1<<17)		/**< Convenience macro for Admin_Custom3 as a FlagBit */
   100 	#define ADMFLAG_CUSTOM4				(1<<18)		/**< Convenience macro for Admin_Custom4 as a FlagBit */
   101 	#define ADMFLAG_CUSTOM5				(1<<19)		/**< Convenience macro for Admin_Custom5 as a FlagBit */
   102 	#define ADMFLAG_CUSTOM6				(1<<20)		/**< Convenience macro for Admin_Custom6 as a FlagBit */
   103 
   104 	/**
   105 	 * @brief Specifies which type of command to override (command or command group).
   106 	 */
   107 	enum OverrideType
   108 	{
   109 		Override_Command = 1,	/**< Command */
   110 		Override_CommandGroup,	/**< Command group */
   111 	};
   112 
   113 	/**
   114 	 * @brief Specifies how a command is overridden for a user group.
   115 	 */
   116 	enum OverrideRule
   117 	{
   118 		Command_Deny = 0,		/**< Deny access */
   119 		Command_Allow = 1,		/**< Allow access */
   120 	};
   121 
   122 	/**
   123 	 * @brief Specifies a generic immunity type.
   124 	 */
   125 	enum ImmunityType
   126 	{
   127 		Immunity_Default = 1,	/**< Immune from everyone with no immunity */
   128 		Immunity_Global,		/**< Immune from everyone (except root admins) */
   129 	};
   130 
   131 	/**
   132 	 * @brief Defines user access modes.
   133 	 */
   134 	enum AccessMode
   135 	{
   136 		Access_Real,		/**< Access the user has inherently */
   137 		Access_Effective,	/**< Access the user has from their groups */
   138 	};
   139 
   140 	/**
   141 	 * @brief Represents an index to one group.
   142 	 */
   143 	typedef int		GroupId;
   144 
   145 	/**
   146 	 * @brief Represents an index to one user entry.
   147 	 */
   148 	typedef int		AdminId;
   149 
   150 	/**
   151 	 * @brief Represents an invalid/nonexistent group or an erroneous operation.
   152 	 */
   153 	#define INVALID_GROUP_ID	-1
   154 
   155 	/**
   156 	 * @brief Represents an invalid/nonexistent user or an erroneous operation.
   157 	 */
   158 	#define INVALID_ADMIN_ID	-1
   159 
   160 	/**
   161 	 * @brief Represents the various cache regions.
   162 	 */
   163 	enum AdminCachePart
   164 	{
   165 		AdminCache_Overrides = 0,		/**< Global overrides */
   166 		AdminCache_Groups = 1,			/**< All groups (automatically invalidates admins too) */
   167 		AdminCache_Admins = 2,			/**< All admins */
   168 	};
   169 
   170 	/**
   171 	 * @brief Provides callbacks for admin cache operations.
   172 	 */
   173 	class IAdminListener
   174 	{
   175 	public:
   176 		virtual unsigned int GetInterfaceVersion()
   177 		{
   178 			return SMINTERFACE_ADMINSYS_VERSION;
   179 		}
   180 	public:
   181 		/**
   182 		 * @brief Called when the admin cache needs to be rebuilt.  
   183 		 *
   184 		 * @param auto_rebuild		True if this is being called because of a group rebuild.
   185 		 */
   186 		virtual void OnRebuildAdminCache(bool auto_rebuild) =0;
   187 
   188 		/**
   189 		 * @brief Called when the group cache needs to be rebuilt.
   190 		 */
   191 		virtual void OnRebuildGroupCache() =0;
   192 		
   193 		/**
   194 		 * @brief Called when the global override cache needs to be rebuilt.
   195 		 */
   196 		virtual void OnRebuildOverrideCache() =0;
   197 	};
   198 
   199 	/**
   200 	 * @brief Admin permission levels.
   201 	 */
   202 	typedef unsigned int FlagBits;
   203 
   204 	/**
   205 	 * @brief Provides functions for manipulating the admin options cache.
   206 	 */
   207 	class IAdminSystem : public SMInterface
   208 	{
   209 	public:
   210 		const char *GetInterfaceName()
   211 		{
   212 			return SMINTERFACE_ADMINSYS_NAME;
   213 		}
   214 		unsigned int GetInterfaceVersion()
   215 		{
   216 			return SMINTERFACE_ADMINSYS_VERSION;
   217 		}
   218 	public:
   219 		/**
   220 		 * @brief Adds a global command flag override.  Any command registered with this name
   221 		 * will assume the new flag.  This is applied retroactively as well.
   222 		 *
   223 		 * @param cmd			String containing command name (case sensitive).
   224 		 * @param type			Override type (specific command or group).
   225 		 * @param flags			New admin flag.
   226 		 */
   227 		virtual void AddCommandOverride(const char *cmd, OverrideType type, FlagBits flags) =0;
   228 
   229 		/**
   230 		 * @brief Returns a command override.
   231 		 *
   232 		 * @param cmd			String containing command name (case sensitive).
   233 		 * @param type			Override type (specific command or group).
   234 		 * @param pFlags		Optional pointer to the set flag.
   235 		 * @return				True if there is an override, false otherwise.
   236 		 */
   237 		virtual bool GetCommandOverride(const char *cmd, OverrideType type, FlagBits *pFlags) =0;
   238 
   239 		/**
   240 		 * @brief Unsets a command override.
   241 		 *
   242 		 * @param cmd			String containing command name (case sensitive).
   243 		 * @param type			Override type (specific command or group).
   244 		 */
   245 		virtual void UnsetCommandOverride(const char *cmd, OverrideType type) =0;
   246 
   247 		/**
   248 		 * @brief Adds a new group.  Name must be unique.
   249 		 *
   250 		 * @param group_name	String containing the group name.
   251 		 * @return				A new group id, INVALID_GROUP_ID if it already exists.
   252 		 */
   253 		virtual GroupId AddGroup(const char *group_name) =0;
   254 
   255 		/**
   256 		 * @brief Finds a group by name.
   257 		 *
   258 		 * @param group_name	String containing the group name.
   259 		 * @return				A group id, or INVALID_GROUP_ID if not found.
   260 		 */
   261 		virtual GroupId FindGroupByName(const char *group_name) =0;
   262 
   263 		/**
   264 		 * @brief Adds or removes a flag from a group's flag set.
   265 		 * Note: These are called "add flags" because they add to a user's flags.
   266 		 *
   267 		 * @param id			Group id.
   268 		 * @param flag			Admin flag to toggle.
   269 		 * @param enabled		True to set the flag, false to unset/disable.
   270 		 */
   271 		virtual void SetGroupAddFlag(GroupId id, AdminFlag flag, bool enabled) =0;
   272 
   273 		/**
   274 		 * @brief Gets the set value of an add flag on a group's flag set.
   275 		 *
   276 		 * @param id			Group id.
   277 		 * @param flag			Admin flag to retrieve.
   278 		 * @return				True if enabled, false otherwise,
   279 		 */
   280 		virtual bool GetGroupAddFlag(GroupId id, AdminFlag flag) =0;
   281 
   282 		/**
   283 		 * @brief Returns an array of flag bits that are added to a user from their group.
   284 		 * Note: These are called "add flags" because they add to a user's flags.
   285 		 *
   286 		 * @param id			GroupId of the group.
   287 		 * @return				Bit string containing the bits of each flag.
   288 		 */
   289 		virtual FlagBits GetGroupAddFlags(GroupId id) =0;
   290 
   291 		/**
   292 		 * @brief Toggles a generic immunity type.
   293 		 *
   294 		 * @param id			Group id.
   295 		 * @param type			Generic immunity type.
   296 		 * @param enabled		True to enable, false otherwise.
   297 		 */
   298 		virtual void SetGroupGenericImmunity(GroupId id, ImmunityType type, bool enabled) =0;
   299 
   300 		/**
   301 		 * @brief Returns whether or not a group has global immunity.
   302 		 *
   303 		 * @param id			Group id.
   304 		 * @param type			Generic immunity type.
   305 		 * @return				True if the group has this immunity, false otherwise.
   306 		 */
   307 		virtual bool GetGroupGenericImmunity(GroupId id, ImmunityType type) =0;
   308 
   309 		/**
   310 		 * @brief Adds immunity to a specific group.
   311 		 *
   312 		 * @param id			Group id.
   313 		 * @param other_id		Group id to receive immunity to.
   314 		 */
   315 		virtual void AddGroupImmunity(GroupId id, GroupId other_id) =0;
   316 
   317 		/**
   318 		 * @brief Returns the number of specific group immunities.
   319 		 *
   320 		 * @param id			Group id.
   321 		 * @return				Number of group immunities.
   322 		 */
   323 		virtual unsigned int GetGroupImmunityCount(GroupId id) =0;
   324 
   325 		/**
   326 		 * @brief Returns a group that this group is immune to given an index.
   327 		 *
   328 		 * @param id			Group id.
   329 		 * @param number		Index from 0 to N-1, from GetGroupImmunities().
   330 		 * @return				GroupId that this group is immune to.
   331 		 */
   332 		virtual GroupId GetGroupImmunity(GroupId id, unsigned int number) =0;
   333 
   334 		/**
   335 		 * @brief Adds a group-specific override type.
   336 		 *
   337 		 * @param id			Group id.
   338 		 * @param name			String containing command name (case sensitive).
   339 		 * @param type			Override type (specific command or group).
   340 		 * @param rule			Override allow/deny setting.
   341 		 */
   342 		virtual void AddGroupCommandOverride(GroupId id,
   343 											 const char *name,
   344 											 OverrideType type,
   345 											 OverrideRule rule) =0;
   346 
   347 		/**
   348 		 * @brief Retrieves a group-specific command override.
   349 		 *
   350 		 * @param id			Group id.
   351 		 * @param name			String containing command name (case sensitive).
   352 		 * @param type			Override type (specific command or group).
   353 		 * @param pRule			Optional pointer to store allow/deny setting.
   354 		 * @return				True if an override exists, false otherwise.
   355 		 */
   356 		virtual bool GetGroupCommandOverride(GroupId id,
   357 											 const char *name,
   358 											 OverrideType type,
   359 											 OverrideRule *pRule) =0;
   360 
   361 		/**
   362 		 * @brief Tells the admin system to dump a portion of the cache.  
   363 		 * This calls into plugin forwards to rebuild the cache.
   364 		 *
   365 		 * @param part			Portion of the cache to dump.
   366 		 * @param rebuild		If true, the rebuild forwards/events will fire.
   367 		 */
   368 		virtual void DumpAdminCache(AdminCachePart part, bool rebuild) =0;
   369 
   370 		/**
   371 		 * @brief Adds an admin interface listener.
   372 		 *
   373 		 * @param pListener		Pointer to an IAdminListener to add.
   374 		 */
   375 		virtual void AddAdminListener(IAdminListener *pListener) =0;
   376 
   377 		/**
   378 		 * @brief Removes an admin interface listener.
   379 		 *
   380 		 * @param pListener		Pointer to an IAdminListener to remove.
   381 		 */
   382 		virtual void RemoveAdminListener(IAdminListener *pListener) =0;
   383 
   384 		/**
   385 		 * @brief Registers an authentication identity type.
   386 		 * Note: Default types are "steam," "name," and "ip."
   387 		 *
   388 		 * @param name			String containing the type name.
   389 		 */
   390 		virtual void RegisterAuthIdentType(const char *name) =0;
   391 
   392 		/**
   393 		 * @brief Creates a new user entry.
   394 		 *
   395 		 * @param name		Name for this entry (does not have to be unique).
   396 		 *					Specify NULL for an anonymous admin.
   397 		 * @return			A new AdminId index.
   398 		 */
   399 		virtual AdminId CreateAdmin(const char *name) =0;
   400 
   401 		/**
   402 		 * @brief Gets an admin's user name.
   403 		 *
   404 		 * @param id		AdminId index for this admin.
   405 		 * @return			A string containing the admin's name, or NULL
   406 		 *					if the admin was created anonymously.
   407 		 */
   408 		virtual const char *GetAdminName(AdminId id) =0;
   409 
   410 		/**
   411 		 * @brief Binds a user entry to a particular auth method.
   412 		 * This bind must be unique.
   413 		 *
   414 		 * @param id		AdminId index of the admin.
   415 		 * @param auth		Auth method to use.
   416 		 * @param ident		Identity string to bind to.
   417 		 * @return			True on success, false if auth method was not found,
   418 		 *					id was invalid, or ident was already taken.
   419 		 */
   420 		virtual bool BindAdminIdentity(AdminId id, const char *auth, const char *ident) =0;
   421 
   422 		/**
   423 		 * @brief Sets whether or not a flag is enabled on an admin.
   424 		 *
   425 		 * @param id		AdminId index of the admin.
   426 		 * @param flag		Admin flag to use.
   427 		 * @param enabled	True to enable, false to disable.
   428 		 */
   429 		virtual void SetAdminFlag(AdminId id, AdminFlag flag, bool enabled) =0;
   430 
   431 		/**
   432 		 * @brief Returns whether or not a flag is enabled on an admin.
   433 		 *
   434 		 * @param id		AdminId index of the admin.
   435 		 * @param flag		Admin flag to use.
   436 		 * @param mode		Access mode to check.
   437 		 * @return			True if enabled, false otherwise.
   438 		 */
   439 		virtual bool GetAdminFlag(AdminId id, AdminFlag flag, AccessMode mode) =0;
   440 
   441 		/**
   442 		 * @brief Returns the bitstring of access flags on an admin.
   443 		 *
   444 		 * @param id		AdminId index of the admin.
   445 		 * @param mode		Access mode to use.
   446 		 * @return			A bit string containing which flags are enabled.
   447 		 */
   448 		virtual FlagBits GetAdminFlags(AdminId id, AccessMode mode) =0;
   449 
   450 		/**
   451 		 * @brief Sets the bitstring of access flags on an admin.
   452 		 *
   453 		 * @param id		AdminId index of the admin.
   454 		 * @param mode		Access mode to use (real affects both).
   455 		 * @param bits		Bitstring to set.
   456 		 */
   457 		virtual void SetAdminFlags(AdminId id, AccessMode mode, FlagBits bits) =0;
   458 
   459 		/**
   460 		 * @brief Adds a group to an admin's inherited group list.  
   461 		 * Any flags the group has will be added to the admin's effective flags.
   462 		 *
   463 		 * @param id		AdminId index of the admin.
   464 		 * @param gid		GroupId index of the group.
   465 		 * @return			True on success, false on invalid input or duplicate membership.
   466 		 */
   467 		virtual bool AdminInheritGroup(AdminId id, GroupId gid) =0;
   468 
   469 		/**
   470 		 * @brief Returns the number of groups this admin is a member of.
   471 		 * 
   472 		 * @param id		AdminId index of the admin.
   473 		 * @return			Number of groups this admin is a member of.
   474 		 */
   475 		virtual unsigned int GetAdminGroupCount(AdminId id) =0;
   476 
   477 		/**
   478 		 * @brief Returns group information from an admin.
   479 		 *
   480 		 * @param id		AdminId index of the admin.
   481 		 * @param index		Group number to retrieve, from 0 to N-1, where N
   482 		 *					is the value of GetAdminGroupCount(id).
   483 		 * @param name		Optional pointer to store the group's name.
   484 		 * @return			A GroupId index and a name pointer, or
   485 		 *					INVALID_GROUP_ID and NULL if an error occurred.
   486 		 */
   487 		virtual GroupId GetAdminGroup(AdminId id, unsigned int index, const char **name) =0;
   488 		
   489 		/**
   490 		 * @brief Sets a password on an admin.
   491 		 *
   492 		 * @param id		AdminId index of the admin.
   493 		 * @param password	String containing the password.
   494 		 */
   495 		virtual void SetAdminPassword(AdminId id, const char *password) =0;
   496 
   497 		/**
   498 		 * @brief Gets an admin's password.
   499 		 *
   500 		 * @param id		AdminId index of the admin.
   501 		 * @return			Password of the admin, or NULL if none.
   502 		 */
   503 		virtual const char *GetAdminPassword(AdminId id) =0;
   504 		
   505 		/**
   506 		 * @brief Attempts to find an admin by an auth method and an identity.
   507 		 *
   508 		 * @param auth		Auth method to try.
   509 		 * @param identity	Identity string to look up.
   510 		 * @return			An AdminId index if found, INVALID_ADMIN_ID otherwise.
   511 		 */
   512 		virtual AdminId FindAdminByIdentity(const char *auth, const char *identity) =0;
   513 
   514 		/**
   515 		 * @brief Invalidates an admin from the cache so its resources can be re-used.
   516 		 *
   517 		 * @param id		AdminId index to invalidate.
   518 		 * @return			True on success, false otherwise.
   519 		 */
   520 		virtual bool InvalidateAdmin(AdminId id) =0;
   521 
   522 		/**
   523 		 * @brief Converts a flag bit string to a bit array.
   524 		 *
   525 		 * @param bits		Bit string containing the flags.
   526 		 * @param array		Array to write the flags to.  Enabled flags will be 'true'.
   527 		 * @param maxSize	Maximum number of flags the array can store.
   528 		 * @return			Number of flags written.
   529 		 */
   530 		virtual unsigned int FlagBitsToBitArray(FlagBits bits, bool array[], unsigned int maxSize) =0;
   531 
   532 		/**
   533 		 * @brief Converts a flag array to a bit string.
   534 		 *
   535 		 * @param array		Array containing true or false for each AdminFlag.
   536 		 * @param maxSize	Maximum size of the flag array.
   537 		 * @return			A bit string composed of the array bits.
   538 		 */
   539 		virtual FlagBits FlagBitArrayToBits(const bool array[], unsigned int maxSize) =0;
   540 
   541 		/**
   542 		 * @brief Converts an array of flags to bits.
   543 		 *
   544 		 * @param array		Array containing flags that are enabled.
   545 		 * @param numFlags	Number of flags in the array.
   546 		 * @return			A bit string composed of the array flags.
   547 		 */
   548 		virtual FlagBits FlagArrayToBits(const AdminFlag array[], unsigned int numFlags) =0;
   549 
   550 		/**
   551 		 * @brief Converts a bit string to an array of flags.
   552 		 *
   553 		 * @param bits		Bit string containing the flags.
   554 		 * @param array		Output array to write flags.
   555 		 * @param maxSize	Maximum size of the flag array.
   556 		 * @return			Number of flags written.
   557 		 */
   558 		virtual unsigned int FlagBitsToArray(FlagBits bits, AdminFlag array[], unsigned int maxSize) =0;
   559 
   560 		/**
   561 		 * @brief Checks whether a user has access to a given set of flag bits.
   562 		 * Note: This is a wrapper around GetAdminFlags().
   563 		 *
   564 		 * @param id		AdminId index of admin.
   565 		 * @param bits		Bitstring containing the permissions to check.
   566 		 * @return			True if user has permission, false otherwise.
   567 		 */
   568 		virtual bool CheckAdminFlags(AdminId id, FlagBits bits) =0;
   569 
   570 		/**
   571 		 * @brief Checks whether an AdminId can target another AdminId.
   572 		 * 
   573 		 * Zeroth, if the targeting AdminId is INVALID_ADMIN_ID, targeting fails.
   574 		 * First, if the targeted AdminId is INVALID_ADMIN_ID, targeting succeeds.
   575 		 * Second, if the targeting admin is root, targeting succeeds.
   576 		 * Third, if the targeted admin has global immunity, targeting fails.
   577 		 * Fourth, if the targeted admin has default immunity,
   578 		 *  and the admin belongs to no groups, targeting fails.
   579 		 * Fifth, if the targeted admin has specific immunity from the
   580 		 *  targeting admin via group immunities, targeting fails.
   581 		 * Sixth, targeting succeeds if it passes these tests.
   582 		 *
   583 		 * @param id		AdminId index of admin doing the targeting.  Can be INVALID_ADMIN_ID.
   584 		 * @param target	AdminId index of the target admin.  Can be INVALID_ADMIN_ID.
   585 		 * @return			True if this admin has permission to target the other admin.
   586 		 */
   587 		virtual bool CanAdminTarget(AdminId id, AdminId target) =0;
   588 	};
   589 }
   590 
   591 #endif //_INCLUDE_SOURCEMOD_ADMINISTRATION_SYSTEM_H_