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 295589 Details for
Bug 427912
XMLRPC function disableAccount will be replaced with User.update()
[?]
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]
v1 for function Bugzilla::WebService::User::update
patch.diff (text/plain), 3.80 KB, created by
Noura El hawary
on 2008-02-22 05:51:00 UTC
(
hide
)
Description:
v1 for function Bugzilla::WebService::User::update
Filename:
MIME Type:
Creator:
Noura El hawary
Created:
2008-02-22 05:51:00 UTC
Size:
3.80 KB
patch
obsolete
>Index: Bugzilla/WebService/User.pm >=================================================================== >RCS file: /cvsroot/mozilla/webtools/bugzilla/Bugzilla/WebService/User.pm,v >retrieving revision 1.5 >diff -3 -p -u -r1.5 User.pm >--- Bugzilla/WebService/User.pm 18 Sep 2007 23:28:30 -0000 1.5 >+++ Bugzilla/WebService/User.pm 22 Feb 2008 05:43:34 -0000 >@@ -113,6 +113,73 @@ sub create { > return { id => type('int')->value($user->id) }; > } > >+############### >+# User Update # >+############### >+ >+# function to update user information by passing either user ids or >+# login name or both together. >+# $call = $rpc->call('User.update', { ids => [1,2,3], >+# logins => ['testusera@redhat.com', 'testuserb@redhat.com'], >+# update => {disabledtext => 'user is disabled', disable_mail => 1} }); >+sub update { >+ my ($self, $params) = @_; >+ >+ my $user = Bugzilla->login(LOGIN_REQUIRED); >+ my $editusers = $user->in_group('editusers'); >+ >+ # Reject access if there is no sense in continuing. >+ $editusers >+ || $user->can_bless() >+ || ThrowUserError("auth_failure", {group => "editusers", >+ reason => "cant_bless", >+ action => "edit", >+ object => "users"}); >+ >+ >+ my @user_objects; >+ @user_objects = map { Bugzilla::User->check($_) } @{ $params->{logins} } >+ if $params->{logins}; >+ >+ my $obj_by_ids; >+ $obj_by_ids = Bugzilla::User->new_from_list($params->{ids}) if $params->{ids}; >+ >+ my %unique_users; >+ map { $unique_users{$_->id} = $_ } @user_objects; >+ >+ # 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){ >+ push (@user_objects, $obj) if !$unique_users{$obj->id}; >+ } >+ >+ my %changes; >+ >+ # throw an error is user tries to update password or login for several users >+ if (scalar @user_objects > 1 && ( (grep {$_ =~ /login/ } keys %{$params->{update}}) || (grep {$_ =~ /password/ } keys %{$params->{update}}) )) >+ { >+ ThrowUserError("multiple_users_update_not_allowed"); >+ } >+ else{ >+ foreach my $otheruser (@user_objects){ >+ $editusers || $user->can_see_user($otheruser) >+ || ThrowUserError('auth_failure', {reason => "not_visible", >+ action => "modify", >+ object => "user"}); >+ >+ if ($editusers) { >+ foreach my $field (keys %{$params->{update}}) { >+ my $method = "set_" . $field; >+ $otheruser->$method($params->{update}{$field}); >+ } >+ $changes{$otheruser->id} = $otheruser->update(); >+ } >+ } >+ } >+ >+ return { users_updates => \%changes }; >+} >+ > 1; > > __END__ >Index: template/en/default/global/user-error.html.tmpl >=================================================================== >RCS file: /cvsroot/mozilla/webtools/bugzilla/template/en/default/global/user-error.html.tmpl,v >retrieving revision 1.244 >diff -3 -p -u -r1.244 user-error.html.tmpl >--- template/en/default/global/user-error.html.tmpl 6 Feb 2008 16:15:41 -0000 1.244 >+++ template/en/default/global/user-error.html.tmpl 22 Feb 2008 05:44:11 -0000 >@@ -1595,6 +1595,12 @@ > [% title = "Illegal User ID" %] > User ID '[% userid FILTER html %]' is not valid integer. > >+ [% ELSIF error == "multiple_users_update_not_allowed" %] >+ [% title = "Multiple Users Not Allowed" %] >+ You can not change users password or login info when changing >+ several users at once, as these values need to be unique for >+ each user. >+ > [% ELSE %] > > [%# Try to find hooked error messages %]
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 427912
:
295589
|
295909
|
296211
|
296309