summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKoosha Khajeh Moogahi <koosha.khajeh@gmail.com>2012-07-24 18:34:22 +0200
committerDave Lawrence <dlawrence@mozilla.com>2012-07-24 18:34:22 +0200
commit3c12e5aa267fe9c89a79a65c36ea8f29317d6121 (patch)
tree2ad37832df135dc010d77c41b15dcf27c0db24ed
parent72ce8ddb3ef34d31237f5969dbea07652bd4c5cb (diff)
downloadbugzilla-3c12e5aa267fe9c89a79a65c36ea8f29317d6121.tar.gz
bugzilla-3c12e5aa267fe9c89a79a65c36ea8f29317d6121.tar.xz
Bug 697224 - Add methods to get a user's saved searches to the WebService (new "User.saved_searches" or add to User.get)
r=dkl, a=LpSolit
-rw-r--r--Bugzilla/WebService/User.pm43
1 files changed, 43 insertions, 0 deletions
diff --git a/Bugzilla/WebService/User.pm b/Bugzilla/WebService/User.pm
index 07c36bd9c..5d47ece69 100644
--- a/Bugzilla/WebService/User.pm
+++ b/Bugzilla/WebService/User.pm
@@ -214,6 +214,7 @@ sub get {
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 {
@@ -225,6 +226,7 @@ sub get {
email => $self->type('string', $_->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;
}
@@ -347,6 +349,17 @@ sub _group_to_hash {
return $item;
}
+sub _query_to_hash {
+ my ($self, $query) = @_;
+ my $item = {
+ id => $self->type('int', $query->id),
+ name => $self->type('string', $query->name),
+ url => $self->type('string', $query->url),
+ };
+
+ return $item;
+}
+
1;
__END__
@@ -788,6 +801,34 @@ C<string> The description for the group
=back
+=over
+
+=item saved_searches
+
+C<array> An array of hashes, each of which represents a user's saved search and has
+the following keys:
+
+=over
+
+=item id
+
+C<int> An integer id uniquely identifying the saved search.
+
+=item name
+
+C<string> The name of the saved search.
+
+=item url
+
+C<string> The CGI parameters for the saved search.
+
+=back
+
+B<Note>: The elements of the returned array (i.e. hashes) are ordered by the
+name of each saved search.
+
+=back
+
B<Note>: If you are not logged in to Bugzilla when you call this function, you
will only be returned the C<id>, C<name>, and C<real_name> items. If you are
logged in and not in editusers group, you will only be returned the C<id>, C<name>,
@@ -830,6 +871,8 @@ for C<match> has changed to only returning enabled accounts.
=item C<groups> Added in Bugzilla B<4.4>.
+=item C<saved_searches> Added in Bugzilla B<4.4>.
+
=back
=back