From 95bfc797b43bd7f1d8f45ea629aa6119b51e8a29 Mon Sep 17 00:00:00 2001 From: David Lawrence Date: Fri, 28 Jan 2011 11:30:29 -0500 Subject: Bug 622080 - Change group which can moderate quips r/a=mkanat --- Bugzilla/Install.pm | 4 ++++ docs/en/xml/using.xml | 13 ++++++++++++- quips.cgi | 10 +++++----- template/en/default/admin/params/query.html.tmpl | 2 +- template/en/default/list/quips.html.tmpl | 8 ++++---- 5 files changed, 26 insertions(+), 11 deletions(-) diff --git a/Bugzilla/Install.pm b/Bugzilla/Install.pm index 9d4426bbe..6fbaa0b75 100644 --- a/Bugzilla/Install.pm +++ b/Bugzilla/Install.pm @@ -149,6 +149,10 @@ use constant SYSTEM_GROUPS => ( description => 'Can not be impersonated by other users', inherited_by => ['bz_sudoers'], }, + { + name => 'bz_quip_moderators', + description => 'Can moderate quips', + }, ); use constant DEFAULT_CLASSIFICATION => { diff --git a/docs/en/xml/using.xml b/docs/en/xml/using.xml index 0dbff34bc..6d575c0c1 100644 --- a/docs/en/xml/using.xml +++ b/docs/en/xml/using.xml @@ -1375,7 +1375,18 @@ Indicates user can configure whine reports for self. - + + + + + bz_quip_moderators + + + + Indicates user can moderate quips. + + + diff --git a/quips.cgi b/quips.cgi index 97993d488..74c0047a1 100755 --- a/quips.cgi +++ b/quips.cgi @@ -79,7 +79,7 @@ if ($action eq "add") { check_hash_token($token, ['create-quips']); # Add the quip 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"); $comment || ThrowUserError("need_quip"); trick_taint($comment); # Used in a placeholder below @@ -91,8 +91,8 @@ if ($action eq "add") { } if ($action eq 'approve') { - $user->in_group('admin') - || ThrowUserError("auth_failure", {group => "admin", + $user->in_group('bz_quip_moderators') + || ThrowUserError("auth_failure", {group => "bz_quip_moderators", action => "approve", object => "quips"}); @@ -131,8 +131,8 @@ if ($action eq 'approve') { } if ($action eq "delete") { - Bugzilla->user->in_group("admin") - || ThrowUserError("auth_failure", {group => "admin", + $user->in_group('bz_quip_moderators') + || ThrowUserError("auth_failure", {group => "bz_quip_moderators", action => "delete", object => "quips"}); my $quipid = $cgi->param("quipid"); diff --git a/template/en/default/admin/params/query.html.tmpl b/template/en/default/admin/params/query.html.tmpl index 34ea04381..c5bac6641 100644 --- a/template/en/default/admin/params/query.html.tmpl +++ b/template/en/default/admin/params/query.html.tmpl @@ -32,7 +32,7 @@
  • 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.
  • closed - no new additions to the quips list are allowed. diff --git a/template/en/default/list/quips.html.tmpl b/template/en/default/list/quips.html.tmpl index 62395d27f..512add995 100644 --- a/template/en/default/list/quips.html.tmpl +++ b/template/en/default/list/quips.html.tmpl @@ -37,7 +37,7 @@

    Your quip '[% added_quip FILTER html %]' 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. [% END %] @@ -66,7 +66,7 @@

    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. - [% 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. [% END %]

    @@ -86,7 +86,7 @@ [% END %] [% IF show_quips %] - [% IF !user.in_group('admin') %] + [% IF !user.in_group('bz_quip_moderators') %]

    Existing quips:

    @@ -163,7 +163,7 @@

    Those who like their wisdom in large doses can view - [% IF user.in_group('admin') %] + [% IF user.in_group('bz_quip_moderators') %] and edit [% END %] the whole quip list. -- cgit v1.2.3-24-g4f1b