summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Fargeix <t.fargeix@gmail.com>2014-10-11 22:56:31 +0200
committerAdam <Adam@anope.org>2014-10-12 10:52:48 -0400
commit96583892c6a0bc48029348ddcf86b1afc5a9915d (patch)
treea232b6a1dcbc2a5b0ad839b9a14b9a85e6645549
parent0991d4e1998c5a87c8deb3f9460685eed0212160 (diff)
Add a chanserv/access/list privilege
Replace the existing chanserv/access/list command access, only used in cs_xop, by a privilege with the same name. It which allows read-only access to cs_access, cs_flags, cs_xop and cs_akick, while the already-existing chanserv/access/modify privilege allows to modify them.
-rw-r--r--data/example.conf3
-rw-r--r--docs/Changes.conf4
-rw-r--r--modules/commands/cs_access.cpp2
-rw-r--r--modules/commands/cs_akick.cpp10
-rw-r--r--modules/commands/cs_flags.cpp2
-rw-r--r--modules/commands/cs_xop.cpp2
6 files changed, 20 insertions, 3 deletions
diff --git a/data/example.conf b/data/example.conf
index 5e0904573..f8db60b23 100644
--- a/data/example.conf
+++ b/data/example.conf
@@ -749,6 +749,7 @@ log
* botserv/administration - Can view and assign private BotServ bots
* botserv/fantasy - Can use fantasy commands without the FANTASIA privilege
* chanserv/administration - Can modify the settings of any channel (including changing of the owner!)
+ * chanserv/access/list - Can view channel access and akick lists, but not modify them
* chanserv/access/modify - Can modify channel access and akick lists, and use /chanserv enforce
* chanserv/auspex - Can see any information with /chanserv info
* chanserv/no-register-limit - May register an unlimited number of channels and nicknames
@@ -768,7 +769,7 @@ log
* botserv/bot/del botserv/bot/add botserv/bot/change botserv/set/private
* botserv/set/nobot
*
- * chanserv/access/list chanserv/drop chanserv/getkey chanserv/invite
+ * chanserv/drop chanserv/getkey chanserv/invite
* chanserv/list chanserv/suspend chanserv/topic
*
* chanserv/saset/bantype chanserv/saset/description chanserv/saset/email chanserv/saset/keepmodes
diff --git a/docs/Changes.conf b/docs/Changes.conf
index de9074f11..d63cf9c15 100644
--- a/docs/Changes.conf
+++ b/docs/Changes.conf
@@ -1,3 +1,7 @@
+Anope Version 2.0.2
+-------------------
+Add a chanserv/access/list privilege, which allow readonly access to ChanServ access and akick lists
+
Anope Version 2.0.1
-------------------
Add MUTE command to BotServ fantasy configuration
diff --git a/modules/commands/cs_access.cpp b/modules/commands/cs_access.cpp
index d5f934862..309105998 100644
--- a/modules/commands/cs_access.cpp
+++ b/modules/commands/cs_access.cpp
@@ -518,6 +518,8 @@ class CommandCSAccess : public Command
bool has_access = false;
if (source.HasPriv("chanserv/access/modify"))
has_access = true;
+ else if (is_list && source.HasPriv("chanserv/access/list"))
+ has_access = true;
else if (is_list && source.AccessFor(ci).HasPriv("ACCESS_LIST"))
has_access = true;
else if (source.AccessFor(ci).HasPriv("ACCESS_CHANGE"))
diff --git a/modules/commands/cs_akick.cpp b/modules/commands/cs_akick.cpp
index 1fac25335..03db4c623 100644
--- a/modules/commands/cs_akick.cpp
+++ b/modules/commands/cs_akick.cpp
@@ -441,9 +441,17 @@ class CommandCSAKick : public Command
return;
}
+ bool is_list = cmd.equals_ci("LIST") || cmd.equals_ci("VIEW");
+
+ bool has_access = false;
+ if (source.AccessFor(ci).HasPriv("AKICK") || source.HasPriv("chanserv/access/modify"))
+ has_access = true;
+ else if (is_list && source.HasPriv("chanserv/access/list"))
+ has_access = true;
+
if (mask.empty() && (cmd.equals_ci("ADD") || cmd.equals_ci("DEL")))
this->OnSyntaxError(source, cmd);
- else if (!source.AccessFor(ci).HasPriv("AKICK") && !source.HasPriv("chanserv/access/modify"))
+ else if (!has_access)
source.Reply(ACCESS_DENIED);
else if (!cmd.equals_ci("LIST") && !cmd.equals_ci("VIEW") && !cmd.equals_ci("ENFORCE") && Anope::ReadOnly)
source.Reply(_("Sorry, channel autokick list modification is temporarily disabled."));
diff --git a/modules/commands/cs_flags.cpp b/modules/commands/cs_flags.cpp
index 5f9e070fc..cb2e1fd9f 100644
--- a/modules/commands/cs_flags.cpp
+++ b/modules/commands/cs_flags.cpp
@@ -388,6 +388,8 @@ class CommandCSFlags : public Command
bool has_access = false;
if (source.HasPriv("chanserv/access/modify"))
has_access = true;
+ else if (is_list && source.HasPriv("chanserv/access/list"))
+ has_access = true;
else if (is_list && source.AccessFor(ci).HasPriv("ACCESS_LIST"))
has_access = true;
else if (source.AccessFor(ci).HasPriv("ACCESS_CHANGE"))
diff --git a/modules/commands/cs_xop.cpp b/modules/commands/cs_xop.cpp
index 340369901..bf86c06ce 100644
--- a/modules/commands/cs_xop.cpp
+++ b/modules/commands/cs_xop.cpp
@@ -365,7 +365,7 @@ class CommandCSXOP : public Command
AccessGroup access = source.AccessFor(ci);
- if (!access.HasPriv("ACCESS_LIST") && !source.HasCommand("chanserv/access/list"))
+ if (!access.HasPriv("ACCESS_LIST") && !source.HasPriv("chanserv/access/list"))
{
source.Reply(ACCESS_DENIED);
return;