- 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:
David Anderson
2007-09-10 23:38:58 +00:00
parent 93581bb296
commit 6aec628ab0
23 changed files with 815 additions and 233 deletions
+22 -24
View File
@@ -110,22 +110,7 @@ public SMCResult:ReadGroups_KeyValue(Handle:smc,
SetAdmGroupAddFlag(g_CurGrp, flag, true);
}
} else if (StrEqual(key, "immunity")) {
/* If it's a value we know about, use it */
if (StrEqual(value, "*"))
{
SetAdmGroupImmunity(g_CurGrp, Immunity_Global, true);
} else if (StrEqual(value, "$")) {
SetAdmGroupImmunity(g_CurGrp, Immunity_Default, true);
} else {
/* If we can't find the group, we'll need to schedule a reparse */
new GroupId:id = FindAdmGroup(value);
if (id != INVALID_GROUP_ID)
{
SetAdmGroupImmuneFrom(g_CurGrp, id);
} else {
g_NeedReparse = true;
}
}
g_NeedReparse = true;
}
} else if (g_GroupState == GROUP_STATE_OVERRIDES) {
new OverrideRule:rule = Command_Deny;
@@ -147,18 +132,31 @@ public SMCResult:ReadGroups_KeyValue(Handle:smc,
/* Check for immunity again, core should handle double inserts */
if (StrEqual(key, "immunity"))
{
if (StrEqual(value, "$"))
/* If it's a value we know about, use it */
if (StrEqual(value, "*"))
{
SetAdmGroupImmunity(g_CurGrp, Immunity_Default, true);
} else if (StrEqual(value, "*")) {
SetAdmGroupImmunity(g_CurGrp, Immunity_Global, true);
SetAdmGroupImmunityLevel(g_CurGrp, 2);
} else if (StrEqual(value, "$")) {
SetAdmGroupImmunityLevel(g_CurGrp, 1);
} else {
new GroupId:id = FindAdmGroup(value);
if (id != INVALID_GROUP_ID)
new level;
if (StringToIntEx(value, level))
{
SetAdmGroupImmuneFrom(g_CurGrp, id);
SetAdmGroupImmunityLevel(g_CurGrp, level);
} else {
ParseError("Unable to find group: \"%s\"", value);
new GroupId:id;
if (value[0] == '@')
{
id = FindAdmGroup(value[1]);
} else {
id = FindAdmGroup(value);
}
if (id != INVALID_GROUP_ID)
{
SetAdmGroupImmuneFrom(g_CurGrp, id);
} else {
ParseError("Unable to find group: \"%s\"", value);
}
}
}
}
+22 -9
View File
@@ -111,30 +111,42 @@ ReadAdminLine(const String:line[])
new String:flags[64];
cur_idx = BreakString(line[idx], flags, sizeof(flags));
idx += cur_idx;
if (flags[0] == '@')
/* Read immunity level, if any */
new level, flag_idx;
if ((flag_idx = StringToIntEx(flags, level)) > 0)
{
new GroupId:gid = FindAdmGroup(flags[1]);
SetAdminImmunityLevel(admin, level);
if (flags[flag_idx] == ':')
{
flag_idx++;
}
}
if (flags[flag_idx] == '@')
{
new GroupId:gid = FindAdmGroup(flags[flag_idx + 1]);
if (gid == INVALID_GROUP_ID)
{
ParseError("Invalid group detected: %s", flags[1]);
ParseError("Invalid group detected: %s", flags[flag_idx + 1]);
return;
}
AdminInheritGroup(admin, gid);
} else {
new len = strlen(flags);
new len = strlen(flags[flag_idx]);
new bool:is_default = false;
for (new i=0; i<len; i++)
{
if (flags[i] == '$')
if (!level && flags[flag_idx + i] == '$')
{
is_default = true;
SetAdminImmunityLevel(admin, 1);
} else {
new AdminFlag:flag;
if (!FindFlagByChar(flags[i], flag))
if (!FindFlagByChar(flags[flag_idx + i], flag))
{
ParseError("Invalid flag detected: %c", flags[i]);
ParseError("Invalid flag detected: %c", flags[flag_idx + i]);
continue;
}
SetAdminFlag(admin, flag, true);
@@ -172,3 +184,4 @@ ReadAdminLine(const String:line[])
}
}
}
+17 -4
View File
@@ -89,12 +89,18 @@ public SMCResult:ReadUsers_KeyValue(Handle:smc,
{
auth = true;
strcopy(g_CurAuth, sizeof(g_CurAuth), value);
} else if (StrEqual(key, "identity")) {
}
else if (StrEqual(key, "identity"))
{
auth = true;
strcopy(g_CurIdent, sizeof(g_CurIdent), value);
} else if (StrEqual(key, "password")) {
}
else if (StrEqual(key, "password"))
{
SetAdminPassword(g_CurUser, value);
} else if (StrEqual(key, "group")) {
}
else if (StrEqual(key, "group"))
{
new GroupId:id = FindAdmGroup(value);
if (id == INVALID_GROUP_ID)
{
@@ -102,7 +108,9 @@ public SMCResult:ReadUsers_KeyValue(Handle:smc,
} else if (!AdminInheritGroup(g_CurUser, id)) {
ParseError("Unable to inherit group \"%s\"", value);
}
} else if (StrEqual(key, "flags")) {
}
else if (StrEqual(key, "flags"))
{
new len = strlen(value);
new AdminFlag:flag;
@@ -114,6 +122,11 @@ public SMCResult:ReadUsers_KeyValue(Handle:smc,
}
SetAdminFlag(g_CurUser, flag, true);
}
}
else if (StrEqual(key, "immunity"))
{
new level = StringToInt(value);
SetAdminImmunityLevel(g_CurUser, level);
}
if (auth && g_CurIdent[0] && g_CurAuth[0])