- completely overhauled the immunity system
- updated and reorganized database schema files - changed config files to show new immunity rules - updated sql-admin-manager so it can update+create tables - added compile.sh file for building plugins in batch - deprecated the old admin-cache immunity api relying on ImmunityType - added a new sm_config table to the schema for storing version numbers --HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%401409
This commit is contained in:
@@ -4,12 +4,15 @@ Groups
|
||||
* Allowed properties for a group:
|
||||
*
|
||||
* "flags" - Flag string.
|
||||
* "immunity" - Specifies a group to be immune to. Use "*" for all or "$" for users with no group.
|
||||
* This key may be used multiple times.
|
||||
* "immunity" - Immunity level number, or a group name.
|
||||
* If the group name is a number, prepend it with an
|
||||
* '@' symbol similar to admins_simple.ini. Users
|
||||
* will only inherit the level number if it's higher
|
||||
* than their current value.
|
||||
*/
|
||||
"Default"
|
||||
{
|
||||
"immunity" "$"
|
||||
"immunity" "1"
|
||||
}
|
||||
|
||||
"Full Admins"
|
||||
@@ -25,6 +28,9 @@ Groups
|
||||
{
|
||||
}
|
||||
"flags" "abcdefghiz"
|
||||
"immunity" "*"
|
||||
|
||||
/* Largish number for lots of in-between values. */
|
||||
"immunity" "99"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -41,7 +41,8 @@ Levels
|
||||
/**
|
||||
* Root is a magic access flag that grants all permissions.
|
||||
* This should only be given to trusted administrators.
|
||||
* Root users can only be targetted by other root users.
|
||||
* Root users can target anyone regardless of immunity,
|
||||
* however, they themselves are not automatically immune.
|
||||
*/
|
||||
"root" "z"
|
||||
}
|
||||
|
||||
@@ -14,3 +14,4 @@ Overrides
|
||||
* any setting that csdm_enable previously had.
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,10 @@
|
||||
* "password" - Optional password to require.
|
||||
* "group" - Adds one group to the user's group table.
|
||||
* "flags" - Adds one or more flags to the user's permissions.
|
||||
* "immunity" - Sets the user's immunity level (0 = no immunity).
|
||||
* Immunity can be any value. Admins with higher
|
||||
* values cannot be targetted. See sm_immunity_mode
|
||||
* to tweak the rules. Default value is 0.
|
||||
*
|
||||
* Example:
|
||||
"BAILOPAN"
|
||||
@@ -32,3 +36,4 @@
|
||||
Admins
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -11,11 +11,18 @@
|
||||
// Flag definitions are in "admin_levels.cfg"
|
||||
// You can combine flags into a string like this:
|
||||
// "abcdefgh"
|
||||
// There is also one additional "magic" flag, $, which gives admins default immunity.
|
||||
//
|
||||
// If you want to specify a group instead of a flag, use an @ symbol. Example:
|
||||
// "@Full Admins"
|
||||
//
|
||||
// You can also specify immunity values. Two examples:
|
||||
// "83:abcdefg" //Immunity is 83, flags are abcefgh
|
||||
// "6:@Full Admins" //Immunity is 6, group is "Full Admins"
|
||||
//
|
||||
// Immunity values can be any number. An admin cannot target an admin with
|
||||
// a higher access value (see sm_immunity_mode to tweak the rules). Default
|
||||
// immunity value is 0 (no immunity).
|
||||
//
|
||||
// PASSWORDS:
|
||||
// Passwords are generally not needed unless you have name-based authentication.
|
||||
// In this case, admins must type this in their console:
|
||||
@@ -28,9 +35,10 @@
|
||||
// the password being set.
|
||||
//
|
||||
////////////////////////////////
|
||||
// Examples:
|
||||
// "STEAM_0:1:16" "bce" //kick, ban, slay for this steam ID
|
||||
// "127.0.0.1" "z" //all permissions for this ip
|
||||
// Examples: (do not put // in front of real lines, as // means 'comment')
|
||||
//
|
||||
// "STEAM_0:1:16" "bce" //kick, ban, slay for this steam ID, no immunity
|
||||
// "127.0.0.1" "99:z" //all permissions for this ip, immunity value is 99
|
||||
// "BAILOPAN" "abc" "Gab3n" //name BAILOPAN, password "Gab3n": gets reservation, kick, ban
|
||||
//
|
||||
////////////////////////////////
|
||||
|
||||
@@ -33,6 +33,16 @@ sm_vote_delay 30
|
||||
// 12 hour format: %m/%d/%Y - %I:%M:%S %p
|
||||
sm_datetime_format "%m/%d/%Y - %H:%M:%S"
|
||||
|
||||
// Sets how SourceMod should check immunity levels when administrators target
|
||||
// each other.
|
||||
// 0: Ignore immunity levels (except for specific group immunities).
|
||||
// 1: Protect from admins of lower access only.
|
||||
// 2: Protect from admins of equal to or lower access.
|
||||
// 3: Same as 2, except admins with no immunity can affect each other.
|
||||
// --
|
||||
// Default: 1
|
||||
sm_immunity_mode 1
|
||||
|
||||
// Sets how many seconds SourceMod should adjust time values for incorrect
|
||||
// server clocks. This can be positive or negative and will affect every
|
||||
// system time in SourceMod, including logging stamps.
|
||||
|
||||
+11
-1
@@ -6,14 +6,15 @@ CREATE TABLE sm_admins (
|
||||
password varchar(65),
|
||||
flags varchar(30) NOT NULL,
|
||||
name varchar(65) NOT NULL,
|
||||
immunity int(10) unsigned NOT NULL,
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
|
||||
CREATE TABLE sm_groups (
|
||||
id int(10) unsigned NOT NULL auto_increment,
|
||||
immunity enum('none','global','default') NOT NULL,
|
||||
flags varchar(30) NOT NULL,
|
||||
name varchar(120) NOT NULL,
|
||||
immunity_level int(1) unsigned NOT NULL,
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
|
||||
@@ -44,3 +45,12 @@ CREATE TABLE sm_admins_groups (
|
||||
inherit_order int(10) NOT NULL,
|
||||
PRIMARY KEY (admin_id, group_id)
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS sm_config (
|
||||
cfg_key varchar(32) NOT NULL,
|
||||
cfg_value varchar(255) NOT NULL,
|
||||
PRIMARY KEY (cfg_key)
|
||||
);
|
||||
|
||||
INSERT INTO sm_config (cfg_key, cfg_value) VALUES ('admin_version', '1.0.0.1409') ON DUPLICATE KEY UPDATE cfg_value = '1.0.0.1409';
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
|
||||
ALTER TABLE sm_admins ADD immunity INT UNSIGNED NOT NULL;
|
||||
|
||||
ALTER TABLE sm_groups ADD immunity_level INT UNSIGNED NOT NULL;
|
||||
UPDATE sm_groups SET immunity_level = 2 WHERE immunity = 'default';
|
||||
UPDATE sm_groups SET immunity_level = 1 WHERE immunity = 'global';
|
||||
ALTER TABLE sm_groups DROP immunity;
|
||||
|
||||
CREATE TABLE sm_config (
|
||||
cfg_key varchar(32) NOT NULL,
|
||||
cfg_value varchar(255) NOT NULL,
|
||||
PRIMARY KEY (cfg_key)
|
||||
);
|
||||
INSERT INTO sm_config (cfg_key, cfg_value) VALUES ('admin_version', '1.0.0.1409') ON DUPLICATE KEY UPDATE cfg_value = '1.0.0.1409';
|
||||
|
||||
Binary file not shown.
+13
-3
@@ -5,14 +5,15 @@ CREATE TABLE sm_admins (
|
||||
identity varchar(65) NOT NULL,
|
||||
password varchar(65),
|
||||
flags varchar(30) NOT NULL,
|
||||
name varchar(65) NOT NULL
|
||||
name varchar(65) NOT NULL,
|
||||
immunity INTEGER NOT NULL
|
||||
);
|
||||
|
||||
CREATE TABLE sm_groups (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
immunity varchar(16) NOT NULL CHECK(immunity IN ('none', 'default', 'global', 'all')),
|
||||
flags varchar(30) NOT NULL,
|
||||
name varchar(120) NOT NULL
|
||||
name varchar(120) NOT NULL,
|
||||
immunity_level INTEGER NOT NULL
|
||||
);
|
||||
|
||||
CREATE TABLE sm_group_immunity (
|
||||
@@ -42,3 +43,12 @@ CREATE TABLE sm_admins_groups (
|
||||
inherit_order int(10) NOT NULL,
|
||||
PRIMARY KEY (admin_id, group_id)
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS sm_config (
|
||||
cfg_key varchar(32) NOT NULL,
|
||||
cfg_value varchar(255) NOT NULL,
|
||||
PRIMARY KEY (cfg_key)
|
||||
);
|
||||
|
||||
REPLACE INTO sm_config (cfg_key, cfg_value) VALUES ('admin_version', '1.0.0.1409');
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
|
||||
ALTER TABLE sm_admins ADD immunity INTEGER DEFAULT 0 NOT NULL;
|
||||
|
||||
CREATE TABLE _sm_groups_temp (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
flags varchar(30) NOT NULL,
|
||||
name varchar(120) NOT NULL,
|
||||
immunity_level INTEGER DEFAULT 0 NOT NULL
|
||||
);
|
||||
INSERT INTO _sm_groups_temp (id, flags, name) SELECT id, flags, name FROM sm_groups;
|
||||
UPDATE _sm_groups_temp SET immunity_level = 2 WHERE id IN (SELECT g.id FROM sm_groups g WHERE g.immunity = 'global');
|
||||
UPDATE _sm_groups_temp SET immunity_level = 1 WHERE id IN (SELECT g.id FROM sm_groups g WHERE g.immunity = 'default');
|
||||
DROP TABLE sm_groups;
|
||||
ALTER TABLE _sm_groups_temp RENAME TO sm_groups;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS sm_config (
|
||||
cfg_key varchar(32) NOT NULL,
|
||||
cfg_value varchar(255) NOT NULL,
|
||||
PRIMARY KEY (cfg_key)
|
||||
);
|
||||
|
||||
REPLACE INTO sm_config (cfg_key, cfg_value) VALUES ('admin_version', '1.0.0.1409');
|
||||
|
||||
Reference in New Issue
Block a user