From eb2423b1c5e3090d09db856e7020f4dd24232674 Mon Sep 17 00:00:00 2001 From: "jocuri%softhome.net" <> Date: Wed, 24 Nov 2004 06:41:43 +0000 Subject: Patch for bug 180879: Implement privs for bug flags modification; patch by Frédéric Buclin , r=joel, a=justdave. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- editgroups.cgi | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'editgroups.cgi') diff --git a/editgroups.cgi b/editgroups.cgi index b3b6135e4..bc22d518e 100755 --- a/editgroups.cgi +++ b/editgroups.cgi @@ -317,12 +317,20 @@ if ($action eq 'del') { $hasproduct = 1; } + my $hasflags = 0; + SendSQL("SELECT id FROM flagtypes + WHERE grant_group_id = $gid OR request_group_id = $gid"); + if (FetchOneColumn()) { + $hasflags = 1; + } + $vars->{'gid'} = $gid; $vars->{'name'} = $name; $vars->{'description'} = $desc; $vars->{'hasusers'} = $hasusers; $vars->{'hasbugs'} = $hasbugs; $vars->{'hasproduct'} = $hasproduct; + $vars->{'hasflags'} = $hasflags; $vars->{'buglist'} = $buglist; print Bugzilla->cgi->header(); @@ -365,8 +373,19 @@ if ($action eq 'delete') { $cantdelete = 1; } } + SendSQL("SELECT id FROM flagtypes + WHERE grant_group_id = $gid OR request_group_id = $gid"); + if (FetchOneColumn()) { + if (!defined $cgi->param('removeflags')) { + $cantdelete = 1; + } + } if (!$cantdelete) { + SendSQL("UPDATE flagtypes SET grant_group_id = NULL + WHERE grant_group_id = $gid"); + SendSQL("UPDATE flagtypes SET request_group_id = NULL + WHERE request_group_id = $gid"); SendSQL("DELETE FROM user_group_map WHERE group_id = $gid"); SendSQL("DELETE FROM group_group_map WHERE grantor_id = $gid"); SendSQL("DELETE FROM bug_group_map WHERE group_id = $gid"); -- cgit v1.2.3-24-g4f1b