Bugzilla will be upgraded to version 5.0 on a still to be determined date in the near future. The original upgrade date has been delayed.
Bug 612574 - [RFE] RHN Hosted - Create User functionality in RHN API
[RFE] RHN Hosted - Create User functionality in RHN API
Status: CLOSED CURRENTRELEASE
Product: Red Hat Network
Classification: Red Hat
Component: RHN/API (Show other bugs)
RHN Stable
All Linux
high Severity high
: ---
: ---
Assigned To: Grant Gainey
Red Hat Network Quality Assurance
: FutureFeature, Triaged
Depends On:
Blocks: rhn-sprint49
  Show dependency treegraph
 
Reported: 2010-07-08 10:38 EDT by Issue Tracker
Modified: 2011-06-27 12:22 EDT (History)
8 users (show)

See Also:
Fixed In Version:
Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2010-08-02 16:52:40 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Test script for user.createUser RHN API (8.05 KB, text/plain)
2010-07-14 14:22 EDT, Grant Gainey
no flags Details

  None (edit)
Comment 4 Guil Barros 2010-07-14 09:56:53 EDT
There is also currently no way to see via the API that a user is disabled, this feature would be very useful and is available in the Satellite API.
Comment 5 Grant Gainey 2010-07-14 11:20:23 EDT
Javadoc output:

=====
Method: createUser
Description:
Create a new user, in the same Org as that of the invoker.

Invoker must be an Org-Admin in their Org.

detail-keys include the following:

    * address1
    * address2
    * city
    * country
    * email
    * login
    * prefix
    * password
    * phone
    * state
    * zip

address2 is optional; all other details are REQUIRED

Users are created with NO ASSIGNED ROLES

Errors are reflected back to the caller as an xmlrpclib.Fault.faultCode of -500, .faultString containing a list of the errors encountered.

Parameters:

    * string sessionKey
    * struct (user's details)
          o string "address1"
          o string "address2" (optional)
          o string "city"
          o string "country" (two-character country code)
          o string "email"
          o string "first_names"
          o string "last_name"
          o string "login"
          o string "password"
          o string "phone"
          o string "prefix" (one of Dr. , Hr. , Miss , Mr. , Mrs. , Ms. , Sr. )
          o string "state"
          o string "zip"

Returns:

    * int
Comment 6 Grant Gainey 2010-07-14 11:22:11 EDT
gbarros@ - very good point.  I don't want to conflate the two issues, though, so please open a separate BZ for that.
Comment 8 Grant Gainey 2010-07-14 14:22:39 EDT
Created attachment 431871 [details]
Test script for user.createUser RHN API

Demonstration of API, and a series of tests to insure that failures are caught and reflected back to the user
Comment 9 Grant Gainey 2010-07-14 14:27:27 EDT
ON_DEV.  Documentation can be found here:

https://rhn.webdev.redhat.com/rhn/apidoc/user/UserHandler.jsp#createUser

See attached script for tests.

NOTE: UserService returns ValidatorErrors without enough information for us to fill in all the information needed by the localization resources.  This results in some error-messages looking like the following:

City cannot be shorter than {1} characters.

This will not be addressed at this time.
Comment 10 Grant Gainey 2010-07-16 09:10:16 EDT
Note: the attached test requires that python and libxml2-python be installed on the test-machine.
Comment 11 Issue Tracker 2010-08-16 12:37:10 EDT
Event posted on 08-16-2010 12:37pm EDT by jruemker

The API spec seems to have a typo (if not, then the logic is incorrect):

https://rhn.redhat.com/rhn/apidoc/user/UserHandler.jsp#createUser

"address2 is optional; all other details are REQUIRED"

This should not be for non-US countries.  Can anyone confirm if the state
really is required or not?  

-John



This event sent from IssueTracker by jruemker 
 issue 1111313
Comment 13 Issue Tracker 2010-08-18 11:24:54 EDT
Event posted on 08-18-2010 11:24am EDT by jruemker

Should I file a new bug to correct the documentation in the API, or can
that be addressed here?  This was pointed out by my customer who is
looking to avoid confusion within their organization about the state being
required.  

-John


This event sent from IssueTracker by jruemker 
 issue 1111313
Comment 14 Grant Gainey 2010-08-18 14:30:54 EDT
John - file a new one - that'll let us track accurately, and keep you in the loop as we get it addressed.  Also, I have to investigate to see if the code actually enforces that - which would be a flat-out bug all on its lonesome, and make me very sad :(
Comment 15 John Ruemker 2010-08-18 15:11:24 EDT
Thanks Grant.  I'll do that.  

FWIW I tried using your example code (the first entry in the example), using a UK address and no state, and it did seem to work.  

-John
Comment 16 Grant Gainey 2010-08-18 15:34:30 EDT
Ah, good - that means it's just my docs that are off, not the code :)
Comment 17 Issue Tracker 2010-08-24 09:36:53 EDT
Event posted on 08-24-2010 09:36am EDT by jruemker

Bug submitted. 

  https://bugzilla.redhat.com/show_bug.cgi?id=626809

-John


This event sent from IssueTracker by jruemker 
 issue 1111313

Note You need to log in before you can comment on or make changes to this bug.