}
}
- $vars->{'groups'} = [Bugzilla::Group->get_all];
+ $vars->{'groups'} = get_settable_groups();
$vars->{'action'} = $action;
my $type = {};
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());
}
# 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());
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;
[% BLOCK group_select %]
<select name="[% selname %]" id="[% selname %]" [%- ' disabled="disabled"' UNLESS can_fully_edit %]>
<option value="">(no group)</option>
+ [% group_found = 0 %]
[% FOREACH group = groups %]
<option value="[% group.name FILTER html %]"
- [% " selected" IF (type.${selname} && type.${selname}.name == group.name) %]>
- [%- group.name FILTER html %]
+ [% IF type.${selname} && type.${selname}.name == group.name %]
+ [% ' selected="selected"' %]
+ [% group_found = 1 %]
+ [% END %]>
+ [%- group.name FILTER html ~%]
+ </option>
+ [% END %]
+ [% IF !group_found && type.${selname} %]
+ <option value="[% type.${selname}.name FILTER html %]" selected="selected">
+ [%- type.${selname}.name FILTER html ~%]
</option>
[% END %]
</select>