public/IAdminSystem.h
changeset 1403 ecb9c66fd4bb
parent 1356 4688fae59bcf
child 1473 f3f39075066d
     1.1 --- a/public/IAdminSystem.h	Mon Sep 10 22:28:22 2007 +0000
     1.2 +++ b/public/IAdminSystem.h	Mon Sep 10 23:38:58 2007 +0000
     1.3 @@ -35,7 +35,7 @@
     1.4  #include <IShareSys.h>
     1.5  
     1.6  #define SMINTERFACE_ADMINSYS_NAME		"IAdminSys"
     1.7 -#define SMINTERFACE_ADMINSYS_VERSION	3
     1.8 +#define SMINTERFACE_ADMINSYS_VERSION	4
     1.9  
    1.10  /**
    1.11   * @file IAdminSystem.h
    1.12 @@ -133,12 +133,12 @@
    1.13  	};
    1.14  
    1.15  	/**
    1.16 -	 * @brief Specifies a generic immunity type.
    1.17 +	 * @brief DEPRECATED.  Specifies a generic immunity type.
    1.18  	 */
    1.19  	enum ImmunityType
    1.20  	{
    1.21 -		Immunity_Default = 1,	/**< Immune from everyone with no immunity */
    1.22 -		Immunity_Global,		/**< Immune from everyone (except root admins) */
    1.23 +		Immunity_Default = 1,	/**< Immunity value of 1 */
    1.24 +		Immunity_Global,		/**< Immunity value of 2 */
    1.25  	};
    1.26  
    1.27  	/**
    1.28 @@ -302,20 +302,31 @@
    1.29  		virtual FlagBits GetGroupAddFlags(GroupId id) =0;
    1.30  
    1.31  		/**
    1.32 -		 * @brief Toggles a generic immunity type.
    1.33 +		 * @brief DEPRECATED.  Sets a group's immunity level using backwards 
    1.34 +		 * compatible types.  
    1.35 +		 *
    1.36 +		 * If the new level being set is lower than the group's actual immunity 
    1.37 +		 * level, no operation takes place.
    1.38  		 *
    1.39  		 * @param id			Group id.
    1.40 -		 * @param type			Generic immunity type.
    1.41 -		 * @param enabled		True to enable, false otherwise.
    1.42 +		 * @param type			Immunity type which will be converted to a 
    1.43 +		 * 						numerical level.
    1.44 +		 * @param enabled		True to set the level.  False sets the 
    1.45 +		 * 						group's immunity value to 0.
    1.46  		 */
    1.47  		virtual void SetGroupGenericImmunity(GroupId id, ImmunityType type, bool enabled) =0;
    1.48  
    1.49  		/**
    1.50 -		 * @brief Returns whether or not a group has global immunity.
    1.51 +		 * @brief DEPRECATED.  Returns whether a group has an immunity level
    1.52 +		 * using backwards compatible types.
    1.53 +		 * 
    1.54 +		 * This simply checks whether the group's immunity value is greater 
    1.55 +		 * than or equal to the new-style value for the old type.
    1.56  		 *
    1.57  		 * @param id			Group id.
    1.58  		 * @param type			Generic immunity type.
    1.59 -		 * @return				True if the group has this immunity, false otherwise.
    1.60 +		 * @return				True if the group has this immunity, false 
    1.61 +		 * 						otherwise.
    1.62  		 */
    1.63  		virtual bool GetGroupGenericImmunity(GroupId id, ImmunityType type) =0;
    1.64  
    1.65 @@ -583,15 +594,17 @@
    1.66  		/**
    1.67  		 * @brief Checks whether an AdminId can target another AdminId.
    1.68  		 * 
    1.69 -		 * Zeroth, if the targeting AdminId is INVALID_ADMIN_ID, targeting fails.
    1.70 -		 * First, if the targeted AdminId is INVALID_ADMIN_ID, targeting succeeds.
    1.71 -		 * Second, if the targeting admin is root, targeting succeeds.
    1.72 -		 * Third, if the targeted admin has global immunity, targeting fails.
    1.73 -		 * Fourth, if the targeted admin has default immunity,
    1.74 -		 *  and the admin belongs to no groups, targeting fails.
    1.75 -		 * Fifth, if the targeted admin has specific immunity from the
    1.76 -		 *  targeting admin via group immunities, targeting fails.
    1.77 -		 * Sixth, targeting succeeds if it passes these tests.
    1.78 +		 * The hueristics for this check are as follows:
    1.79 +		 * 0. If the targeting AdminId is INVALID_ADMIN_ID, targeting fails.
    1.80 +		 * 1. If the targeted AdminId is INVALID_ADMIN_ID, targeting succeeds.
    1.81 +		 * 2. If the targeted AdminId is the same as the targeting AdminId,
    1.82 +		 *    (self) targeting succeeds.
    1.83 +		 * 3. If the targeting admin is root, targeting succeeds.
    1.84 +		 * 4. If the targeted admin has access higher (as interpreted by 
    1.85 +		 *    (sm_immunity_mode) than the targeting admin, then targeting fails.
    1.86 +		 * 5. If the targeted admin has specific immunity from the
    1.87 +		 *    targeting admin via group immunities, targeting fails.
    1.88 +		 * 6. Targeting succeeds.
    1.89  		 *
    1.90  		 * @param id		AdminId index of admin doing the targeting.  Can be INVALID_ADMIN_ID.
    1.91  		 * @param target	AdminId index of the target admin.  Can be INVALID_ADMIN_ID.
    1.92 @@ -655,7 +668,42 @@
    1.93  		 * @return			Group name, or NULL on failure.
    1.94  		 */
    1.95  		virtual const char *GetGroupName(GroupId gid) =0;
    1.96 +
    1.97 +		/**
    1.98 +		 * @brief Sets the immunity level of a group.
    1.99 +		 * 
   1.100 +		 * @param gid		Group Id.
   1.101 +		 * @param level		Immunity level value.
   1.102 +		 * @return			Old immunity level.
   1.103 +		 */
   1.104 +		virtual unsigned int SetGroupImmunityLevel(GroupId gid, unsigned int level) =0;
   1.105 +
   1.106 +		/**
   1.107 +		 * @brief Retrieves the immunity level of a group.
   1.108 +		 *
   1.109 +		 * @param gid		Group Id.
   1.110 +		 * @return			Immunity level value.
   1.111 +		 */
   1.112 +		virtual unsigned int GetGroupImmunityLevel(GroupId gid) =0;
   1.113 +
   1.114 +		/**
   1.115 +		 * @brief Sets the immunity level of an admin.
   1.116 +		 *
   1.117 +		 * @param id		Admin Id.
   1.118 +		 * @param level		Immunity level value.
   1.119 +		 * @return			Old immunity level.
   1.120 +		 */
   1.121 +		virtual unsigned int SetAdminImmunityLevel(AdminId id, unsigned int level) =0;
   1.122 +
   1.123 +		/**
   1.124 +		 * @brief Retrieves the immunity level of an admin.
   1.125 +		 *
   1.126 +		 * @param id		Admin Id.
   1.127 +		 * @return			Immunity level value.
   1.128 +		 */
   1.129 +		virtual unsigned int GetAdminImmunityLevel(AdminId id) =0;
   1.130  	};
   1.131  }
   1.132  
   1.133  #endif //_INCLUDE_SOURCEMOD_ADMINISTRATION_SYSTEM_H_
   1.134 +