diff --git a/configs/admins_simple.cfg b/configs/admins_simple.cfg new file mode 100644 index 00000000..11b9a1d8 --- /dev/null +++ b/configs/admins_simple.cfg @@ -0,0 +1,45 @@ +/*************************************** + * READ THIS CAREFULLY! SEE BOTTOM FOR EXAMPLES + * + * For each admin, you need two settings: + * "identity" "permissions" + * + * For the Identity, you can use a SteamID, IP address, or Name (the type will be auto-detected). + * For the Permissions, you can use a flag string or group (read below), and an optional password. + * + * There are 26 flags (a-z), and each flag has a specific meaning/role. + * For example, the "b" flag means "kick permissions." + * + * You can combine flags into a string like this: + * "abcdefgh" + * + * The default flags are: + * + * "reservation" "a" //Slot reservation + "kick" "b" //Kick other players + "ban" "c" //Ban other players + "unban" "d" //Unban other players + "slay" "e" //Slay other players + "changemap" "f" //Change the map or gameplay type + "cvars" "g" //Change cvars + "configs" "h" //Run config files + "chat" "i" //See dead/team chat and chat with other admins + "votes" "j" //Display votes + "password" "h" //Change server password + "rcon" "i" //Use RCON + "root" "z" //All permissions + * + * NOTE: If you specify a - in a flag string, each subsequent flag will be subtracted instead of added. + * You can specify a + to "undo" this in the same string. + * + * Examples: + * "STEAM_0:1:16" "bce" //kick, ban, slay for this steam ID + * "127.0.0.1" "z" //all permissions for this ip + * "BAILOPAN" "mypassword:abc" //name BAILOPAN, password "mypassword" gets reservation, kick, ban + * + ***************************************/ + +FastAdmins: +{ + "127.0.0.1" "z" +} diff --git a/configs/permissions.cfg b/configs/permissions.cfg new file mode 100644 index 00000000..971f4926 --- /dev/null +++ b/configs/permissions.cfg @@ -0,0 +1,124 @@ + +/** + * USE THIS SECTION TO DECLARE DETAILED ADMIN PROPERTIES. + * + * Each admin should have its own "Admin" section, followed by a name. + * The name does not have to be unique. + * + * Available properties: (Anything else is filtered as custom) + * "auth" - REQUIRED - Auth method to use. Built-in methods are: + * "steam" - Steam based authentication + * "name" - Name based authentication + * "ip" - IP based authentication + * Anything else is treated as custom. + * + * "identity" - REQUIRED - Identification string, for example, a steamid or name. + * "password" - Optional password to use. + * "group" - Inherits a set of group permissions. + * "flags" - Inherits a set of flags. + * "immunity" - Sets an immunity to a group (* for all, empty string for default users) + * CommandGroups - See the Permissions section. + * Commands - See the Permissions section. + * + * Example: + Admin: "BAILOPAN" + { + "auth" "steam" + "identity" "STEAM_0:1:16" + "flags" "abcdef" + } + * + */ +Admins: +{ +} + + +/** + * Use this section to tweak admin permission levels and groupings. + * You can also define admin roles in this section. + */ +Levels: +{ + /** + * These are the default role flag mappings. + * You can assign new letters for custom purposes, however you should + * not change the default names, as SourceMod hardcodes these. + */ + Flags: + { + "reservation" "a" + "kick" "b" + "ban" "c" + "unban" "d" + "slay" "e" + "changemap" "f" + "cvars" "g" + "configs" "h" + "chat" "i" + "votes" "j" + "password" "h" + "rcon" "i" + + //Custom flags START + //Custom flags END + + //Note - root is a magic access flag that grants all permissions. + "root" "z" + } + + /** + * By default, commands are registered with three pieces of information: + * 1)Command Name (for example, "csdm_enable") + * 2)Command Group Name (for example, "CSDM") + * 3)Command Level (for example, "changemap") + * You can override the default flags assigned to individual commands or command groups in this way. + * You can specify either a one-character, lower-case flag, or a named flag from "Levels." + * Examples: + * "CSDM" "i" + * "csdm_enable" "j" + */ + Overrides: + { + CommandGroups: + { + } + Commands: + { + } + } +} + +Permissions: +{ + + //Lastly, you can define groups for admins. This helps organize large admin lists. + Groups: + { + /** + * Allowed properties for a group: + * + * "flags" - Flag string (you can use -/+ as allowed earlier). + * "inherit" - Inherits permissions from another group. + * "immunity" - Specifies a group to be immune to. Use "*" for all or "" for users with no group. + * Note: You can use - to strip immunity from a group, in the case of inheritance. + */ + Group: "Sample" + { + /** + * You can override commands and command groups here. + * Specify a command name or group and either "allow" or "deny" + * You can have multiple entries for both sections in order to override/tweak them. + * Examples: + * "CSDM" "allow" + * "csdm_enable" "deny" + */ + CommandGroups: + { + } + Commands: + { + } + } + } +} diff --git a/core/interfaces/ITextParsers.h b/core/interfaces/ITextParsers.h new file mode 100644 index 00000000..d626e414 --- /dev/null +++ b/core/interfaces/ITextParsers.h @@ -0,0 +1,96 @@ +#ifndef _INCLUDE_SOURCEMOD_TEXTPARSERS_H_ +#define _INCLUDE_SOURCEMOD_TEXTPARSERS_H_ + +#include + +namespace SourceMod +{ + class ITextListener_INI + { + public: + /** + * @brief Called when a new section is encountered in an INI file. + * + * @param section Name of section in between the [ and ] characters. + * @return True to keep parsing, false otherwise. + */ + virtual bool ReadINI_NewSection(const char *section) + { + return true; + } + + /** + * @brief Called when encountering a key/value pair in an INI file. + * + * @param key Name of key. + * @param value Name of value. + * @return True to keep parsing, false otherwise. + */ + virtual bool ReadINI_KeyValue(const char *key, const char *value) + { + return true; + } + }; + + class ITextListener_SMC + { + public: + enum SMCParseResult + { + SMCParse_Continue, + SMCParse_SkipSection, + SMCParse_Halt, + SMCParse_HaltFail + }; + + /** + * @brief Called when entering a new section + * + * @param name Name of section, with the colon omitted. + * @param option Optional text after the colon, quotes removed. NULL if none. + * @param colon Whether or not the required ':' was encountered. + * @return SMCParseResult directive. + */ + virtual SMCParseResult ReadSMC_NewSection(const char *name, const char *option, bool colon) + { + return SMCParse_Continue; + } + + /** + * @brief Called when encountering a key/value pair in a section. + * + * @param key Key string. + * @param value Value string. If no quotes were specified, this will be NULL, + and key will contain the entire string. + * @param key_quotes Whether or not the key was in quotation marks. + * @param value_quotes Whether or not the value was in quotation marks. + * @return SMCParseResult directive. + */ + virtual SMCParseResult ReadSMC_KeyValue(const char *key, + const char *value, + bool key_quotes, + bool value_quotes) + { + return SMCParse_Continue; + } + + /** + * @brief Called when leaving the current section. + * + * @return SMCParseResult directive. + */ + virtual SMCParseResult ReadSMC_LeavingSection() + { + return SMCParse_Continue; + } + }; + + class ITextParsers : public SMInterface + { + public: + virtual bool ParseFile_INI(const char *file, ITextListener_INI *ini_listener) =0; + virtual bool ParseFile_SMC(const char *file, ITextListener_SMC *smc_listener) =0; + }; +}; + +#endif //_INCLUDE_SOURCEMOD_TEXTPARSERS_H_ diff --git a/core/msvc8/sourcemod_mm.vcproj b/core/msvc8/sourcemod_mm.vcproj index 07ab0db1..601f50e8 100644 --- a/core/msvc8/sourcemod_mm.vcproj +++ b/core/msvc8/sourcemod_mm.vcproj @@ -226,6 +226,10 @@ RelativePath="..\interfaces\IShareSys.h" > + +