From 298bffb5b496415b2f42d705e3d0fb4038a19194 Mon Sep 17 00:00:00 2001 From: "lpsolit%gmail.com" <> Date: Sat, 26 Aug 2006 03:19:44 +0000 Subject: [PATCH] =?utf8?q?Bug=20350181:=20Check=20whether=20the=20requeste?= =?utf8?q?e=20is=20allowed=20to=20set=20a=20flag=20-=20Patch=20by=20Fr?= =?utf8?q?=C3=A9d=C3=A9ric=20Buclin=20=20a=3Dmyk?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- Bugzilla/Flag.pm | 9 +++++++++ template/en/default/global/user-error.html.tmpl | 8 +++++++- 2 files changed, 16 insertions(+), 1 deletion(-) 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', -- 2.47.2