diff options
author | Koosha Khajeh Moogahi <koosha.khajeh@gmail.com> | 2012-11-08 19:53:37 +0100 |
---|---|---|
committer | Frédéric Buclin <LpSolit@gmail.com> | 2012-11-08 19:53:37 +0100 |
commit | 3240c54086a8e2397fe7a22f48da9ed88a6ab56c (patch) | |
tree | 3c2cc8b5ccfe24de3b5420cbc472e9c72aee3a5f | |
parent | 1c405dbab89089c11eaa3ef4347f7558805ec87d (diff) | |
download | bugs-3240c54086a8e2397fe7a22f48da9ed88a6ab56c.tar bugs-3240c54086a8e2397fe7a22f48da9ed88a6ab56c.tar.gz bugs-3240c54086a8e2397fe7a22f48da9ed88a6ab56c.tar.bz2 bugs-3240c54086a8e2397fe7a22f48da9ed88a6ab56c.tar.xz bugs-3240c54086a8e2397fe7a22f48da9ed88a6ab56c.zip |
Bug 808300: Requesting data for your own account using User.get should also returns groups you belong to
r/a=LpSolit
-rw-r--r-- | Bugzilla/WebService/User.pm | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/Bugzilla/WebService/User.pm b/Bugzilla/WebService/User.pm index 4dc209277..93fece580 100644 --- a/Bugzilla/WebService/User.pm +++ b/Bugzilla/WebService/User.pm @@ -212,7 +212,6 @@ sub get { 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')) { @@ -225,6 +224,13 @@ sub get { $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)); } @@ -332,7 +338,7 @@ sub _filter_bless_groups { 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)); } @@ -791,8 +797,11 @@ disabled/closed. =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 |