added CheckCommandAccess() equivalent to IAdminSystem
--HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%401479
This commit is contained in:
@@ -1707,3 +1707,25 @@ unsigned int AdminCache::GetAdminImmunityLevel(AdminId id)
|
||||
return pUser->immunity_level;
|
||||
}
|
||||
|
||||
bool AdminCache::CheckAccess(int client, const char *cmd, AdminFlag flags, bool override_only)
|
||||
{
|
||||
if (client == 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Auto-detect a command if we can */
|
||||
FlagBits bits = flags;
|
||||
bool found_command = false;
|
||||
if (!override_only)
|
||||
{
|
||||
found_command = g_ConCmds.LookForCommandAdminFlags(cmd, &bits);
|
||||
}
|
||||
|
||||
if (!found_command)
|
||||
{
|
||||
GetCommandOverride(cmd, Override_Command, &bits);
|
||||
}
|
||||
|
||||
return g_ConCmds.CheckCommandAccess(client, cmd, bits) ? 1 : 0;
|
||||
}
|
||||
|
||||
+8
-4
@@ -156,10 +156,14 @@ public: //IAdminSystem
|
||||
unsigned int GetAdminSerialChange(AdminId id);
|
||||
bool CanAdminUseCommand(int client, const char *cmd);
|
||||
const char *GetGroupName(GroupId gid);
|
||||
virtual unsigned int SetGroupImmunityLevel(GroupId gid, unsigned int level);
|
||||
virtual unsigned int GetGroupImmunityLevel(GroupId gid);
|
||||
virtual unsigned int SetAdminImmunityLevel(AdminId id, unsigned int level);
|
||||
virtual unsigned int GetAdminImmunityLevel(AdminId id);
|
||||
unsigned int SetGroupImmunityLevel(GroupId gid, unsigned int level);
|
||||
unsigned int GetGroupImmunityLevel(GroupId gid);
|
||||
unsigned int SetAdminImmunityLevel(AdminId id, unsigned int level);
|
||||
unsigned int GetAdminImmunityLevel(AdminId id);
|
||||
bool CheckAccess(int client,
|
||||
const char *cmd,
|
||||
AdminFlag flags,
|
||||
bool override_only);
|
||||
public:
|
||||
bool IsValidAdmin(AdminId id);
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user