Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 296303 Details for
Bug 427893
XMLRPC functions idToName and nameToId replaced by User.get() function
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
Bugzilla::WebService::User::get()
patch.diff (text/plain), 5.94 KB, created by
Noura El hawary
on 2008-02-29 05:03:26 UTC
(
hide
)
Description:
Bugzilla::WebService::User::get()
Filename:
MIME Type:
Creator:
Noura El hawary
Created:
2008-02-29 05:03:26 UTC
Size:
5.94 KB
patch
obsolete
>Index: Bugzilla/WebService/User.pm >=================================================================== >RCS file: /cvs/qa/rh_bugzilla_3/Bugzilla/WebService/User.pm,v >retrieving revision 1.1.1.1 >diff -r1.1.1.1 User.pm >17a18 >> # Noura Elhawary <nelhawar@redhat.com> >115a117,187 >> >> # function to return user information by passing either user ids or >> # login names or both together: >> # $call = $rpc->call( 'User.get', { ids => [1,2,3], >> # names => ['testusera@redhat.com', 'testuserb@redhat.com'] }); >> sub get { >> my ($self, $params) = @_; >> >> my @names = ref($params->{names}) ? @{$params->{names}} : >> ($params->{names}); >> >> my @user_objects; >> @user_objects = map { Bugzilla::User->check($_) } @names >> if $params->{names}; >> >> # store the current user objects by login into >> # a hash with the ids as the keys to use it later >> # for checking dupliated user objects. >> my %unique_users; >> map { $unique_users{$_->id} = $_ } @user_objects; >> @user_objects = values %unique_users; >> >> my @users; >> >> # if user not logged return an error is the passed any >> # user ids, otherwise return real names and names for >> # valid passed login names. >> if (!Bugzilla->user->id){ >> if ($params->{ids}){ >> ThrowUserError("user_info_access_denied"); >> } >> @users = map {{ >> real_name => type('string')->value($_->name), >> name => type('string')->value($_->login), >> }} @user_objects; >> >> return { users => \@users }; >> } >> >> my @ids = ref($params->{ids}) ? @{$params->{ids}} : ($params->{ids}); >> >> my $obj_by_ids; >> $obj_by_ids = Bugzilla::User->new_from_list(\@ids) if $params->{ids}; >> >> # obj_by_ids are only visible to the user if he can see >> # the otheruser, for non visible otheruser throw an error >> foreach my $obj (@$obj_by_ids){ >> if (Bugzilla->user->can_see_user($obj)){ >> push (@user_objects, $obj) if !$unique_users{$obj->id}; >> } >> else { >> ThrowUserError('auth_failure', {reason => "not_visible", >> action => "access", >> object => "user", >> userid => $obj->id}); >> } >> } >> >> @users = >> map {{ >> id => type('int')->value($_->id), >> real_name => type('string')->value($_->name), >> name => type('string')->value($_->login), >> email => type('string')->value($_->email), >> can_login => type('boolean')->value($_->is_disabled), >> email_enabled => type('boolean')->value($_->email_disabled), >> }} @user_objects; >> >> return { users => \@users }; >> } >> >306a379,473 >> >> =head2 List Accounts >> >> =over >> >> =item C<get> B<UNSTABLE> >> >> =over >> >> =item B<Description> >> >> Gets information about user accounts in Bugzilla. >> >> =item B<Params> >> >> =over >> >> =item C<ids> (array), or (int) B<Optional> - An array of integers, or a single >> integer representing user ids. >> Logged-out users cannot pass this parameter to this function. If they try, >> they will get an error. Logged-in users will get an error if they specify the >> id of a user they cannot see. >> >> =item C<names> (array), or (string) B<Optional> - An array of strings or single >> string representing login names. >> >> =back >> >> =item B<Returns> >> >> A hash containing one item, C<users>, that is an array of >> hashes. Each hash describes a user, and has the following items: >> >> =over >> >> =item id >> >> C<int> The id of the user. >> >> =item real_name >> >> C<string> The actual name of the user. >> >> =item email >> >> C<string> The email address of the user. >> >> =item name >> >> C<string> The login name of the user. Note that in some situations this is >> different than their email. >> >> =item can_login >> >> C<boolean> A boolean value to indicate if the user can login into bugzilla. >> >> =item email_enabled >> >> C<boolean> A boolean value to indicate if bug-related mail will be sent >> to the user or not. >> >> =item disabled_text >> >> C<string> A text field that holds the reason for disabling a user from logging >> into bugzilla, if empty then the user account is enabled otherwise it is >> disabled/closed. >> >> B<Note>: If you are not logged in to Bugzilla when you call this function, you >> will only be returned the C<name> and C<real_name> items. >> >> =back >> >> =item B<Errors> >> >> =over >> >> =item 51 (Bad Login Name) >> >> You passed an invalid login name in the "names" array. >> >> =item 304 (Authorization Required) >> >> Logged-in users are not authorized to see one of the users they wanted >> to get information about by user id. >> >> =item 305 (User Info Access Denied) >> >> Logged-out users cannot use the "ids" argument to this function to access >> any user information. >> >> =back >> >> =back >> >> =back >Index: Bugzilla/WebService/Constants.pm >=================================================================== >RCS file: /cvs/qa/rh_bugzilla_3/Bugzilla/WebService/Constants.pm,v >retrieving revision 1.5 >diff -r1.5 Constants.pm >88a89,90 >> auth_failure => 304, >> user_info_access_denied => 305, >Index: template/en/default/global/user-error.html.tmpl >=================================================================== >RCS file: /cvs/qa/rh_bugzilla_3/template/en/default/global/user-error.html.tmpl,v >retrieving revision 1.13 >diff -r1.13 user-error.html.tmpl >200,201c200,202 >< [% ELSIF object == "user" %] >< the user you specified >--- >> [% ELSIF object == "user" %] >> the user [% IF userid %] with ID '[% userid FILTER html %]'[% END %] >> you specified >1607a1609,1613 >> [% ELSIF error == "user_info_access_denied" %] >> [% title = "User Info Access Denied" %] >> Logged-out users cannot use the "ids" argument to this function >> to access any user information. >>
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 427893
:
291690
|
291953
|
292108
|
295913
|
296196
|
296210
| 296303