name => $self->type('email', $user->login),
email => $self->type('email', $user->email),
can_login => $self->type('boolean', $user->is_enabled ? 1 : 0),
- groups => $self->_filter_bless_groups($user->groups),
};
if (Bugzilla->user->in_group('editusers')) {
$user_info->{saved_reports} = [map { $self->_report_to_hash($_) } @{ $user->reports }];
}
+ if (Bugzilla->user->id == $user->id || Bugzilla->user->in_group('editusers')) {
+ $user_info->{groups} = [map {$self->_group_to_hash($_)} @{ $user->groups }];
+ }
+ else {
+ $user_info->{groups} = $self->_filter_bless_groups($user->groups);
+ }
+
push(@users, filter($params, $user_info));
}
my @filtered_groups;
foreach my $group (@$groups) {
- next unless ($user->in_group('editusers') || $user->can_bless($group->id));
+ next unless $user->can_bless($group->id);
push(@filtered_groups, $self->_group_to_hash($group));
}
=item groups
-C<array> An array of group hashes the user is a member of. Each hash describes
-the group and contains the following items:
+C<array> An array of group hashes the user is a member of. If the currently
+logged in user is querying his own account or is a member of the 'editusers'
+group, the array will contain all the groups that the user is a
+member of. Otherwise, the array will only contain groups that the logged in
+user can bless. Each hash describes the group and contains the following items:
=over