Use Config::is_in_list() to allow for multiple admins
This commit is contained in:
committed by
louiz’
parent
a429b2ea27
commit
0d487f40c5
@@ -41,7 +41,7 @@ XmlNode AdhocCommandsHandler::handle_request(const std::string& executor_jid, co
|
|||||||
XmlSubNode condition(error, STANZA_NS":item-not-found");
|
XmlSubNode condition(error, STANZA_NS":item-not-found");
|
||||||
}
|
}
|
||||||
else if (command_it->second.is_admin_only() &&
|
else if (command_it->second.is_admin_only() &&
|
||||||
Config::get("admin", "") != jid.bare())
|
!Config::is_in_list("admin", jid.bare()))
|
||||||
{
|
{
|
||||||
XmlSubNode error(command_node, ADHOC_NS":error");
|
XmlSubNode error(command_node, ADHOC_NS":error");
|
||||||
error["type"] = "cancel";
|
error["type"] = "cancel";
|
||||||
|
|||||||
@@ -658,7 +658,7 @@ bool handle_irc_channel_configuration_form(XmppComponent& xmpp_component, const
|
|||||||
void DisconnectUserFromServerStep1(XmppComponent& xmpp_component, AdhocSession& session, XmlNode& command_node)
|
void DisconnectUserFromServerStep1(XmppComponent& xmpp_component, AdhocSession& session, XmlNode& command_node)
|
||||||
{
|
{
|
||||||
const Jid owner(session.get_owner_jid());
|
const Jid owner(session.get_owner_jid());
|
||||||
if (owner.bare() != Config::get("admin", ""))
|
if (!Config::is_in_list("admin", owner.bare()))
|
||||||
{ // A non-admin is not allowed to disconnect other users, only
|
{ // A non-admin is not allowed to disconnect other users, only
|
||||||
// him/herself, so we just skip this step
|
// him/herself, so we just skip this step
|
||||||
auto next_step = session.get_next_step();
|
auto next_step = session.get_next_step();
|
||||||
|
|||||||
@@ -551,24 +551,21 @@ void BiboumiComponent::handle_iq(const Stanza& stanza)
|
|||||||
if (to.local.empty())
|
if (to.local.empty())
|
||||||
{ // Get biboumi's adhoc commands
|
{ // Get biboumi's adhoc commands
|
||||||
this->send_adhoc_commands_list(id, from, this->served_hostname,
|
this->send_adhoc_commands_list(id, from, this->served_hostname,
|
||||||
(Config::get("admin", "") ==
|
Config::is_in_list("admin", from_jid.bare()),
|
||||||
from_jid.bare()),
|
|
||||||
this->adhoc_commands_handler);
|
this->adhoc_commands_handler);
|
||||||
stanza_error.disable();
|
stanza_error.disable();
|
||||||
}
|
}
|
||||||
else if (iid.type == Iid::Type::Server)
|
else if (iid.type == Iid::Type::Server)
|
||||||
{ // Get the server's adhoc commands
|
{ // Get the server's adhoc commands
|
||||||
this->send_adhoc_commands_list(id, from, to_str,
|
this->send_adhoc_commands_list(id, from, to_str,
|
||||||
(Config::get("admin", "") ==
|
Config::is_in_list("admin", from_jid.bare()),
|
||||||
from_jid.bare()),
|
|
||||||
this->irc_server_adhoc_commands_handler);
|
this->irc_server_adhoc_commands_handler);
|
||||||
stanza_error.disable();
|
stanza_error.disable();
|
||||||
}
|
}
|
||||||
else if (iid.type == Iid::Type::Channel && to.resource.empty())
|
else if (iid.type == Iid::Type::Channel && to.resource.empty())
|
||||||
{ // Get the channel's adhoc commands
|
{ // Get the channel's adhoc commands
|
||||||
this->send_adhoc_commands_list(id, from, to_str,
|
this->send_adhoc_commands_list(id, from, to_str,
|
||||||
(Config::get("admin", "") ==
|
Config::is_in_list("admin", from_jid.bare()),
|
||||||
from_jid.bare()),
|
|
||||||
this->irc_channel_adhoc_commands_handler);
|
this->irc_channel_adhoc_commands_handler);
|
||||||
stanza_error.disable();
|
stanza_error.disable();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user