1
0
mirror of https://github.com/anope/anope.git synced 2026-07-04 05:33:12 +02:00

Added options:hideprivilegedcommands config option to hide privileged commands from normal users

This commit is contained in:
Adam
2010-07-10 22:50:18 -04:00
parent a495213026
commit 63d7142465
11 changed files with 23 additions and 7 deletions
+6
View File
@@ -572,6 +572,12 @@ options
* How long to wait between connection retries, in seconds.
*/
retrywait = 60
/*
* If set, Services will hide commands that users doesn't have the privilege to execute
* from HELP output.
*/
hideprivilegedcommands = no
}
+1
View File
@@ -10,6 +10,7 @@ chanserv:modules added many new cs_set_command modules
opertype:commands added nickserv/saset/* and chanserv/saset/*
options:socketengine added to choose what socket engine to use
module:cs_set_misc and module:ns_set_misc added to replace the old set url/icq/email modules
options:hideprivilegedcommands added to hide privileged commands from normal users
** MODIFIED CONFIGURATION DIRECTIVES **
opertype:commands changed operserv/sgline to opserv/snline
+2
View File
@@ -555,6 +555,8 @@ class ServerConfig
unsigned MaxRetries;
/* How long to wait between connection attempts */
int RetryWait;
/* If services should hide unprivileged commands */
bool HidePrivilegedCommands;
/* Services can use email */
bool UseMail;
+1 -1
View File
@@ -167,7 +167,7 @@ void mod_help_cmd(BotInfo *bi, User *u, const ci::string &cmd)
ci::string subcommand = tokens.StreamEnd() ? "" : tokens.GetRemaining().c_str();
if (!c || !c->OnHelp(u, subcommand))
if (!c || (Config.HidePrivilegedCommands && !c->permission.empty() && (!u->Account() || !u->Account()->HasCommand(c->permission))) || !c->OnHelp(u, subcommand))
notice_lang(bi->nick, u, NO_HELP_AVAILABLE, cmd.c_str());
else
{
+1
View File
@@ -664,6 +664,7 @@ int ServerConfig::Read(bool bail)
{"options", "botmodes", "", new ValueContainerCIString(&Config.BotModes), DT_CISTRING, NoValidation},
{"options", "maxretries", "10", new ValueContainerUInt(&Config.MaxRetries), DT_UINTEGER, NoValidation},
{"options", "retrywait", "60", new ValueContainerInt(&Config.RetryWait), DT_INTEGER, ValidateNotZero},
{"options", "hideprivilegedcommands", "no", new ValueContainerBool(&Config.HidePrivilegedCommands), DT_BOOLEAN, ValidateEmailReg},
{"nickserv", "nick", "NickServ", new ValueContainerChar(&Config.s_NickServ), DT_CHARPTR | DT_NORELOAD, ValidateNotEmpty},
{"nickserv", "description", "Nickname Registration Service", new ValueContainerChar(&Config.desc_NickServ), DT_CHARPTR | DT_NORELOAD, ValidateNotEmpty},
{"nickserv", "emailregistration", "no", new ValueContainerBool(&Config.NSEmailReg), DT_BOOLEAN, NoValidation},
+2 -1
View File
@@ -33,7 +33,8 @@ class CommandBSHelp : public Command
// Abuse syntax error to display general list help.
notice_help(Config.s_BotServ, u, BOT_HELP);
for (CommandMap::const_iterator it = BotServ->Commands.begin(), it_end = BotServ->Commands.end(); it != it_end; ++it)
it->second->OnServHelp(u);
if (!Config.HidePrivilegedCommands || it->second->permission.empty() || (u->Account() && u->Account()->HasCommand(it->second->permission)))
it->second->OnServHelp(u);
notice_help(Config.s_BotServ, u, BOT_HELP_FOOTER, Config.BSMinUsers);
}
};
+2 -1
View File
@@ -50,7 +50,8 @@ class CommandCSHelp : public Command
{
notice_help(Config.s_ChanServ, u, CHAN_HELP);
for (CommandMap::const_iterator it = ChanServ->Commands.begin(); it != ChanServ->Commands.end(); ++it)
it->second->OnServHelp(u);
if (!Config.HidePrivilegedCommands || it->second->permission.empty() || (u->Account() && u->Account()->HasCommand(it->second->permission)))
it->second->OnServHelp(u);
if (Config.CSExpire >= 86400)
notice_help(Config.s_ChanServ, u, CHAN_HELP_EXPIRES, Config.CSExpire / 86400);
if (u->Account() && u->Account()->IsServicesOper())
+2 -1
View File
@@ -31,7 +31,8 @@ class CommandHSHelp : public Command
{
notice_help(Config.s_HostServ, u, HOST_HELP, Config.s_HostServ);
for (CommandMap::const_iterator it = HostServ->Commands.begin(), it_end = HostServ->Commands.end(); it != it_end; ++it)
it->second->OnServHelp(u);
if (!Config.HidePrivilegedCommands || it->second->permission.empty() || (u->Account() && u->Account()->HasCommand(it->second->permission)))
it->second->OnServHelp(u);
}
};
+2 -1
View File
@@ -31,7 +31,8 @@ class CommandMSHelp : public Command
{
notice_help(Config.s_MemoServ, u, MEMO_HELP_HEADER);
for (CommandMap::const_iterator it = MemoServ->Commands.begin(), it_end = MemoServ->Commands.end(); it != it_end; ++it)
it->second->OnServHelp(u);
if (!Config.HidePrivilegedCommands || it->second->permission.empty() || (u->Account() && u->Account()->HasCommand(it->second->permission)))
it->second->OnServHelp(u);
notice_help(Config.s_MemoServ, u, MEMO_HELP_FOOTER, Config.s_ChanServ);
}
};
+2 -1
View File
@@ -42,7 +42,8 @@ class CommandNSHelp : public Command
{
notice_help(Config.s_NickServ, u, NICK_HELP);
for (CommandMap::const_iterator it = NickServ->Commands.begin(), it_end = NickServ->Commands.end(); it != it_end; ++it)
it->second->OnServHelp(u);
if (!Config.HidePrivilegedCommands || it->second->permission.empty() || (u->Account() && u->Account()->HasCommand(it->second->permission)))
it->second->OnServHelp(u);
if (u->Account() && u->Account()->IsServicesOper())
notice_help(Config.s_NickServ, u, NICK_SERVADMIN_HELP);
if (Config.NSExpire >= 86400)
+2 -1
View File
@@ -30,7 +30,8 @@ class CommandOSHelp : public Command
{
notice_help(Config.s_OperServ, u, OPER_HELP);
for (CommandMap::const_iterator it = OperServ->Commands.begin(), it_end = OperServ->Commands.end(); it != it_end; ++it)
it->second->OnServHelp(u);
if (!Config.HidePrivilegedCommands || it->second->permission.empty() || (u->Account() && u->Account()->HasCommand(it->second->permission)))
it->second->OnServHelp(u);
notice_help(Config.s_OperServ, u, OPER_HELP_LOGGED);
}
};