summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Bugzilla/WebService/User.pm64
-rw-r--r--extensions/TagNewUsers/Extension.pm3
2 files changed, 39 insertions, 28 deletions
diff --git a/Bugzilla/WebService/User.pm b/Bugzilla/WebService/User.pm
index 7aa1a626b..c84d2e07b 100644
--- a/Bugzilla/WebService/User.pm
+++ b/Bugzilla/WebService/User.pm
@@ -28,7 +28,7 @@ use Bugzilla::Error;
use Bugzilla::Group;
use Bugzilla::User;
use Bugzilla::Util qw(trim);
-use Bugzilla::WebService::Util qw(filter validate);
+use Bugzilla::WebService::Util qw(filter filter_wants validate);
use Bugzilla::Hook;
use List::Util qw(first);
@@ -224,33 +224,41 @@ sub get {
}
}
- my $in_group = $self->_filter_users_by_group(
- \@user_objects, $params);
- if (Bugzilla->user->in_group('editusers')) {
- @users =
- map {filter $params, {
- id => $self->type('int', $_->id),
- real_name => $self->type('string', $_->name),
- name => $self->type('email', $_->login),
- email => $self->type('email', $_->email),
- can_login => $self->type('boolean', $_->is_enabled ? 1 : 0),
- groups => $self->_filter_bless_groups($_->groups),
- email_enabled => $self->type('boolean', $_->email_enabled),
- login_denied_text => $self->type('string', $_->disabledtext),
- saved_searches => [map { $self->_query_to_hash($_) } @{ $_->queries }],
- }} @$in_group;
- }
- else {
- @users =
- map {filter $params, {
- id => $self->type('int', $_->id),
- real_name => $self->type('string', $_->name),
- name => $self->type('email', $_->login),
- email => $self->type('email', $_->email),
- can_login => $self->type('boolean', $_->is_enabled ? 1 : 0),
- groups => $self->_filter_bless_groups($_->groups),
- saved_searches => [map { $self->_query_to_hash($_) } @{ $_->queries }],
- }} @$in_group;
+ my $in_group = $self->_filter_users_by_group(\@user_objects, $params);
+ foreach my $user (@$in_group) {
+ my $user_info = {
+ id => $self->type('int', $user->id),
+ real_name => $self->type('string', $user->name),
+ name => $self->type('email', $user->login),
+ email => $self->type('email', $user->email),
+ can_login => $self->type('boolean', $user->is_enabled ? 1 : 0),
+ };
+
+ if (Bugzilla->user->in_group('editusers')) {
+ $user_info->{email_enabled} = $self->type('boolean', $user->email_enabled);
+ $user_info->{login_denied_text} = $self->type('string', $user->disabledtext);
+ }
+
+ if (Bugzilla->user->id == $user->id) {
+ if (filter_wants($params, 'saved_searches')) {
+ $user_info->{saved_searches} = [
+ map { $self->_query_to_hash($_) } @{ $user->queries }
+ ];
+ }
+ }
+
+ if (filter_wants($params, 'groups')) {
+ 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));
}
Bugzilla::Hook::process('webservice_user_get',
diff --git a/extensions/TagNewUsers/Extension.pm b/extensions/TagNewUsers/Extension.pm
index 13a517406..599504225 100644
--- a/extensions/TagNewUsers/Extension.pm
+++ b/extensions/TagNewUsers/Extension.pm
@@ -11,6 +11,7 @@ use base qw(Bugzilla::Extension);
use Bugzilla::Field;
use Bugzilla::User;
use Bugzilla::Install::Util qw(indicate_progress);
+use Bugzilla::WebService::Util qw(filter_wants);
use Date::Parse;
use Scalar::Util qw(blessed);
@@ -245,6 +246,8 @@ sub webservice_user_get {
my ($self, $args) = @_;
my ($webservice, $params, $users) = @$args{qw(webservice params users)};
+ return unless filter_wants($params, 'is_new');
+
foreach my $user (@$users) {
# Most of the time the hash values are XMLRPC::Data objects
my $email = blessed $user->{'email'} ? $user->{'email'}->value : $user->{'email'};