From 77a3c5bc2fe22cf744ba74144532459a46ac5571 Mon Sep 17 00:00:00 2001 From: Frédéric Buclin Date: Mon, 4 Jul 2011 22:43:06 +0200 Subject: Bug 616679: A user with local editcomponents privs should be able to set the grant and request groups to groups the user belongs to only a=LpSolit --- editflagtypes.cgi | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'editflagtypes.cgi') diff --git a/editflagtypes.cgi b/editflagtypes.cgi index 4d11eecdb..d78942c07 100755 --- a/editflagtypes.cgi +++ b/editflagtypes.cgi @@ -122,7 +122,7 @@ if (my ($category_action) = grep { $_ =~ /^categoryAction-(?:\w+)$/ } $cgi->para } } - $vars->{'groups'} = [Bugzilla::Group->get_all]; + $vars->{'groups'} = get_settable_groups(); $vars->{'action'} = $action; my $type = {}; @@ -226,7 +226,7 @@ if ($action eq 'enter') { if $user->in_group('editcomponents'); $vars->{'can_fully_edit'} = 1; # Get a list of groups available to restrict this flag type against. - $vars->{'groups'} = [Bugzilla::Group->get_all]; + $vars->{'groups'} = get_settable_groups(); $template->process("admin/flag-type/edit.html.tmpl", $vars) || ThrowTemplateError($template->error()); @@ -258,7 +258,7 @@ if ($action eq 'edit' || $action eq 'copy') { } # Get a list of groups available to restrict this flag type against. - $vars->{'groups'} = [Bugzilla::Group->get_all]; + $vars->{'groups'} = get_settable_groups(); $template->process("admin/flag-type/edit.html.tmpl", $vars) || ThrowTemplateError($template->error()); @@ -490,6 +490,12 @@ sub get_editable_flagtypes { return $flagtypes; } +sub get_settable_groups { + my $user = Bugzilla->user; + my $groups = $user->in_group('editcomponents') ? [Bugzilla::Group->get_all] : $user->groups; + return $groups; +} + sub filter_group { my ($flag_types, $gid) = @_; return $flag_types unless $gid; -- cgit v1.2.3-24-g4f1b