From: lpsolit%gmail.com <> Date: Sat, 26 Aug 2006 03:19:44 +0000 (+0000) Subject: Bug 350181: Check whether the requestee is allowed to set a flag - Patch by Frédéric... X-Git-Tag: bugzilla-2.23.3~108 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=298bffb5b496415b2f42d705e3d0fb4038a19194;p=thirdparty%2Fbugzilla.git Bug 350181: Check whether the requestee is allowed to set a flag - Patch by Frédéric Buclin a=myk --- diff --git a/Bugzilla/Flag.pm b/Bugzilla/Flag.pm index de90170a32..b82165e809 100644 --- a/Bugzilla/Flag.pm +++ b/Bugzilla/Flag.pm @@ -414,6 +414,15 @@ sub _validate { bug_id => $bug_id, attach_id => $attach_id }); } + + # Throw an error if the user won't be allowed to set the flag. + if ($flag_type->grant_group + && !$requestee->in_group_id($flag_type->grant_group->id)) + { + ThrowUserError('flag_requestee_needs_privs', + {'requestee' => $requestee, + 'flagtype' => $flag_type}); + } } } diff --git a/template/en/default/global/user-error.html.tmpl b/template/en/default/global/user-error.html.tmpl index 4a5634d4ac..76823cdbc7 100644 --- a/template/en/default/global/user-error.html.tmpl +++ b/template/en/default/global/user-error.html.tmpl @@ -475,7 +475,13 @@ 'flags.html' => 'Using Flags'} %] You can't ask more than one person at a time for [% type.name FILTER html %]. - + + [% ELSIF error == "flag_requestee_needs_privs" %] + [% title = "Flag Requestee Needs Privileges" %] + [% requestee.identity FILTER html %] does not have permission to set the + [% flagtype.name FILTER html %] flag. Please select a user who is + a member of the [% flagtype.grant_group.name FILTER html %] group. + [% ELSIF error == "flag_requestee_unauthorized" %] [% title = "Flag Requestee Not Authorized" %] [% admindocslinks = {'flags-overview.html#flags-admin' => 'Administering Flags',