Closed Bug 548198 Opened 15 years ago Closed 14 years ago

Add a method of limiting the User.get results by group id

Categories

(Bugzilla :: WebService, enhancement)

3.5.3
enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
Bugzilla 4.0

People

(Reporter: mkanat, Assigned: mkanat)

References

Details

Attachments

(1 file, 2 obsolete files)

There are a few use cases where we'd want to be able to send a group ID to User.get and have "match" only return users who are in that group. (For example, doing autocomplete for flag requestees.)
Attached patch Work In Progress (obsolete) (deleted) — Splinter Review
Still needs some testing and POD, though it's basically complete and compiles.
Assignee: webservice → mkanat
Status: NEW → ASSIGNED
Attached patch v1 (obsolete) (deleted) — Splinter Review
pyrzak: You can set up flag requestees to use AJAX now, using this patch.
Attachment #428632 - Attachment is obsolete: true
Attachment #451447 - Flags: review?(dkl)
Comment on attachment 451447 [details] [diff] [review] v1 >=== modified file 'Bugzilla/WebService/User.pm' > > if (Bugzilla->user->in_group('editusers')) { >+ my $in_group = $self->_filter_users_by_group( >+ \@user_objects, $params); > @users = > map {filter $params, { > id => $self->type('int', $_->id), >@@ -210,10 +215,12 @@ > can_login => $self->type('boolean', $_->is_disabled ? 0 : 1), > email_enabled => $self->type('boolean', $_->email_enabled), > login_denied_text => $self->type('string', $_->disabledtext), >- }} @user_objects; >+ }} @$in_group; > > } > else { >+ my $in_group = $self->_filter_users_by_group( >+ \@user_objects, $params); > @users = > map {filter $params, { > id => $self->type('int', $_->id), >@@ -221,12 +228,39 @@ > name => $self->type('string', $_->login), > email => $self->type('string', $_->email), > can_login => $self->type('boolean', $_->is_disabled ? 0 : 1), >- }} @user_objects; >+ }} @$in_group; > } You can move the following outside of the id {} else {} section as it is duplicated: >+ my $in_group = $self->_filter_users_by_group( >+ \@user_objects, $params); > __END__ >@@ -493,6 +527,14 @@ > addresses from Bugzilla, and also to enforce the user visibility > restrictions that are implemented on some Bugzillas.) > >+=item C<group_ids> (array) >+=item C<groups> (array) You need a new line between these otherwise it looks like: "group_ids" (array) =item "groups" (array) Dave
Attachment #451447 - Flags: review?(dkl) → review-
Attached patch v2 (deleted) — Splinter Review
Ah, thanks for catching all that! :-)
Attachment #451447 - Attachment is obsolete: true
Attachment #452097 - Flags: review?(dkl)
Comment on attachment 452097 [details] [diff] [review] v2 Looks good and works as expected. r=dkl
Attachment #452097 - Flags: review?(dkl) → review+
Flags: approval?
Thanks, dkl! :-) Committing to: bzr+ssh://bzr.mozilla.org/bugzilla/trunk/ modified Bugzilla/WebService/User.pm Committed revision 7218.
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Flags: approval? → approval+
Resolution: --- → FIXED
Keywords: relnote
Added to the release notes in bug 604256.
Keywords: relnote
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: