Commit 95bfc797 authored by David Lawrence's avatar David Lawrence

Bug 622080 - Change group which can moderate quips

r/a=mkanat
parent f6142bf5
...@@ -149,6 +149,10 @@ use constant SYSTEM_GROUPS => ( ...@@ -149,6 +149,10 @@ use constant SYSTEM_GROUPS => (
description => 'Can not be impersonated by other users', description => 'Can not be impersonated by other users',
inherited_by => ['bz_sudoers'], inherited_by => ['bz_sudoers'],
}, },
{
name => 'bz_quip_moderators',
description => 'Can moderate quips',
},
); );
use constant DEFAULT_CLASSIFICATION => { use constant DEFAULT_CLASSIFICATION => {
......
...@@ -1375,7 +1375,18 @@ ...@@ -1375,7 +1375,18 @@
Indicates user can configure whine reports for self. Indicates user can configure whine reports for self.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry>
<term>
bz_quip_moderators
</term>
<listitem>
<para>
Indicates user can moderate quips.
</para>
</listitem>
</varlistentry>
<varlistentry> <varlistentry>
<term> <term>
......
...@@ -79,7 +79,7 @@ if ($action eq "add") { ...@@ -79,7 +79,7 @@ if ($action eq "add") {
check_hash_token($token, ['create-quips']); check_hash_token($token, ['create-quips']);
# Add the quip # Add the quip
my $approved = (Bugzilla->params->{'quip_list_entry_control'} eq "open") my $approved = (Bugzilla->params->{'quip_list_entry_control'} eq "open")
|| Bugzilla->user->in_group('admin') || 0; || $user->in_group('bz_quip_moderators') || 0;
my $comment = $cgi->param("quip"); my $comment = $cgi->param("quip");
$comment || ThrowUserError("need_quip"); $comment || ThrowUserError("need_quip");
trick_taint($comment); # Used in a placeholder below trick_taint($comment); # Used in a placeholder below
...@@ -91,8 +91,8 @@ if ($action eq "add") { ...@@ -91,8 +91,8 @@ if ($action eq "add") {
} }
if ($action eq 'approve') { if ($action eq 'approve') {
$user->in_group('admin') $user->in_group('bz_quip_moderators')
|| ThrowUserError("auth_failure", {group => "admin", || ThrowUserError("auth_failure", {group => "bz_quip_moderators",
action => "approve", action => "approve",
object => "quips"}); object => "quips"});
...@@ -131,8 +131,8 @@ if ($action eq 'approve') { ...@@ -131,8 +131,8 @@ if ($action eq 'approve') {
} }
if ($action eq "delete") { if ($action eq "delete") {
Bugzilla->user->in_group("admin") $user->in_group('bz_quip_moderators')
|| ThrowUserError("auth_failure", {group => "admin", || ThrowUserError("auth_failure", {group => "bz_quip_moderators",
action => "delete", action => "delete",
object => "quips"}); object => "quips"});
my $quipid = $cgi->param("quipid"); my $quipid = $cgi->param("quipid");
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
</li> </li>
<li> <li>
moderated - quips can be entered, but need to be approved moderated - quips can be entered, but need to be approved
by an admin before they will be shown. by a moderator before they will be shown.
</li> </li>
<li> <li>
closed - no new additions to the quips list are allowed. closed - no new additions to the quips list are allowed.
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
<p> <p>
<font color="red"> <font color="red">
Your quip '<tt>[% added_quip FILTER html %]</tt>' has been added. Your quip '<tt>[% added_quip FILTER html %]</tt>' has been added.
[% IF Param("quip_list_entry_control") == "moderated" AND !user.in_group('admin') %] [% IF Param("quip_list_entry_control") == "moderated" AND !user.in_group('bz_quip_moderators') %]
It will be used as soon as it gets approved. It will be used as soon as it gets approved.
[% END %] [% END %]
</font> </font>
...@@ -66,7 +66,7 @@ ...@@ -66,7 +66,7 @@
<p> <p>
You can extend the quip list. Type in something clever or funny or boring You can extend the quip list. Type in something clever or funny or boring
(but not obscene or offensive, please) and bonk on the button. (but not obscene or offensive, please) and bonk on the button.
[% IF Param("quip_list_entry_control") == "moderated" AND !user.in_group('admin') %] [% IF Param("quip_list_entry_control") == "moderated" AND !user.in_group('bz_quip_moderators') %]
Note that your quip has to be approved before it is used. Note that your quip has to be approved before it is used.
[% END %] [% END %]
</p> </p>
...@@ -86,7 +86,7 @@ ...@@ -86,7 +86,7 @@
[% END %] [% END %]
[% IF show_quips %] [% IF show_quips %]
[% IF !user.in_group('admin') %] [% IF !user.in_group('bz_quip_moderators') %]
<h2> <h2>
Existing quips: Existing quips:
</h2> </h2>
...@@ -163,7 +163,7 @@ ...@@ -163,7 +163,7 @@
<p> <p>
Those who like their wisdom in large doses can Those who like their wisdom in large doses can
<a href="quips.cgi?action=show">view <a href="quips.cgi?action=show">view
[% IF user.in_group('admin') %] [% IF user.in_group('bz_quip_moderators') %]
and edit and edit
[% END %] [% END %]
the whole quip list</a>. the whole quip list</a>.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment