Programmatically create users (application server)
I am trying to programmatically create new application server users in RTC. Currently, a user can log into the url https://localhost:9443/jazz and Click User Management and add users by hand. I need to create hundreds of users which is cumbersome. I am playing with the RTC server to see if I can programmatically create new users.
As a start, any http server accepts either GET or POST messages. It is possible to use java.net technique, to open a connection (URLConnection) with the http server and manipulate the server to serve the request. I have had success with many commercial websites.
In context of RTC E,g. When I create a user by hand a url like this is autogenerated in the JavaScript and POST message is sent, so the server can process the request.
https://9.34.120.71:9443/jazz/service/com.ibm.team.repository.service.internal.IAdminRestService/contributor?emailAddress=st3&itemId=new&jsonLicenses=%7B%22add%22%3A%20%5B%22com.ibm.team.rtc.developer%22%5D%2C%20%22remove%22%3A%20%5B%5D%7D&jsonRoles=%5B%22JazzAdmins%22%2C%20%22JazzUsers%22%5D&name=st3&userId=st3
I wrote a plain java client to handle this via SSL (IBM JSSE Provider com.ibm.jsse) since now https:// is being provided with RTC. I created a client keystore file from the server keystore file and imported server keys/certificates. I am not getting any errors, but neither am I seeing any results. Nothing particular in the tomcat logs. I can post the code on request. I was looking if this is the way to go. Any alternative ideas..? Thanks for your time.
As a start, any http server accepts either GET or POST messages. It is possible to use java.net technique, to open a connection (URLConnection) with the http server and manipulate the server to serve the request. I have had success with many commercial websites.
In context of RTC E,g. When I create a user by hand a url like this is autogenerated in the JavaScript and POST message is sent, so the server can process the request.
https://9.34.120.71:9443/jazz/service/com.ibm.team.repository.service.internal.IAdminRestService/contributor?emailAddress=st3&itemId=new&jsonLicenses=%7B%22add%22%3A%20%5B%22com.ibm.team.rtc.developer%22%5D%2C%20%22remove%22%3A%20%5B%5D%7D&jsonRoles=%5B%22JazzAdmins%22%2C%20%22JazzUsers%22%5D&name=st3&userId=st3
I wrote a plain java client to handle this via SSL (IBM JSSE Provider com.ibm.jsse) since now https:// is being provided with RTC. I created a client keystore file from the server keystore file and imported server keys/certificates. I am not getting any errors, but neither am I seeing any results. Nothing particular in the tomcat logs. I can post the code on request. I was looking if this is the way to go. Any alternative ideas..? Thanks for your time.
23 answers
From the browser when I tried https://localhost:9443/jazz/service/com.ibm.team.repository.service.internal.ILicenseAdminRestService/assignLicense?userId=test12&licenseId=com.ibm.team.rtc.developer
HTTP Status 400 - CRJAZ1175I Unable to get method info from service call.
--------------------------------------------------------------------------------
type Status report
message CRJAZ1175I Unable to get method info from service call.
description The request sent by the client was syntactically incorrect (CRJAZ1175I Unable to get method info from service call.).
HTTP Status 400 - CRJAZ1175I Unable to get method info from service call.
--------------------------------------------------------------------------------
type Status report
message CRJAZ1175I Unable to get method info from service call.
description The request sent by the client was syntactically incorrect (CRJAZ1175I Unable to get method info from service call.).
Right, it doesn't and that's why I suggested taking the approach that
the web UI takes and make the HTTP POST call directly to the URL in
format I posted.
-
Matt Lavin
Jazz Server Team
On Tue, 2008-11-04 at 21:07 +0000, warade wrote:
the web UI takes and make the HTTP POST call directly to the URL in
format I posted.
-
Matt Lavin
Jazz Server Team
On Tue, 2008-11-04 at 21:07 +0000, warade wrote:
I dont think the TeamPlatform exposes the
com.ibm.team.repository.service.internal.ILicenseAdminRestService as
a service,yet?
My intention was for you to look at the HTTP traffic between the web UI
and the server to see what the arguments of the POST call were to assign
a license. I did that just now and it looks like the web UI uses a
method that allows multiple license assignments in one call, but a
simple approach that should work for you is to do an HTTP POST like:
https://<your>:9443/jazz/service/com.ibm.team.repository.service.internal.ILicenseAdminRestService/assignLicense?userId=<userid>&licenseId=com.ibm.team.rtc.developer
-
Matt Lavin
Jazz Server Team
On Tue, 2008-11-04 at 20:27 +0000, warade wrote:
and the server to see what the arguments of the POST call were to assign
a license. I did that just now and it looks like the web UI uses a
method that allows multiple license assignments in one call, but a
simple approach that should work for you is to do an HTTP POST like:
https://<your>:9443/jazz/service/com.ibm.team.repository.service.internal.ILicenseAdminRestService/assignLicense?userId=<userid>&licenseId=com.ibm.team.rtc.developer
-
Matt Lavin
Jazz Server Team
On Tue, 2008-11-04 at 20:27 +0000, warade wrote:
thanks for responding to my post in the forum
I can't locate the web ui code, in either the server or client API
bundle. The server side code is password protected so I can't do wide
grep on the code?
There is not a supported Java API for assigning assigning licenses. The
best way to assign a license to a contributor is to take the same
approach as the web UI and use the ILicenseAdminRestService to request
the assignment. I would look at the HTTP calls that the web UI makes
and learn how to do the same thing.
-
Matt Lavin
Jazz Server Team
On Tue, 2008-11-04 at 15:27 +0000, warade wrote:
best way to assign a license to a contributor is to take the same
approach as the web UI and use the ILicenseAdminRestService to request
the assignment. I would look at the HTTP calls that the web UI makes
and learn how to do the same thing.
-
Matt Lavin
Jazz Server Team
On Tue, 2008-11-04 at 15:27 +0000, warade wrote:
How is the license assignments particularly newly created users
handled? I am playing with LicenseAssignment from RepositoryFactory
where I see a setLicense method but I don't think its enough. I tried
printing a getLicense and obviously it is 0 because it is created new.
How do I stuff com.ibm.team.rtc.developer or
com.ibm.team.rtc.contributor client access so I exhaust all the
licenses. Thanks.
How is the license assignments particularly newly created users handled? I am playing with LicenseAssignment from RepositoryFactory where I see a setLicense method but I don't think its enough. I tried printing a getLicense and obviously it is 0 because it is created new. How do I stuff com.ibm.team.rtc.developer or com.ibm.team.rtc.contributor client access so I exhaust all the licenses. Thanks.
Creating a user with the the IContributorManager only creates the users
data in the Jazz DB. To log in wit the user, the username / password
has to be configured in the External User Registry (which could be LDAP,
Tomcat, or unknown/unsupported).
If your user registry is Tomcat then you can add your new user to the
registry with IExternalUserRegistryManager. You can check to see if the
user registry if writeable with isExternalRegistryWriteable(). If it is
writable then you should be able to create a new users entry for your
new user. If your server is configured with LDAP then you would need to
modify the LDAP registry to allow logging in with the new users.
Matt Lavin
Jazz Server Team
warade wrote:
data in the Jazz DB. To log in wit the user, the username / password
has to be configured in the External User Registry (which could be LDAP,
Tomcat, or unknown/unsupported).
If your user registry is Tomcat then you can add your new user to the
registry with IExternalUserRegistryManager. You can check to see if the
user registry if writeable with isExternalRegistryWriteable(). If it is
writable then you should be able to create a new users entry for your
new user. If your server is configured with LDAP then you would need to
modify the LDAP registry to allow logging in with the new users.
Matt Lavin
Jazz Server Team
warade wrote:
After getworkingcopy() a user is created but it cannot log in.
When I log in as ADMIN, and navigate to User Management page and click
the newly created user to see details, I get this message.
This user is not in the directory service. The
user will not be able to login unless they an account in the
directory service.
What is this directory service? How to access it from the client API?
Thanks again.
After getworkingcopy() a user is created but it cannot log in.
When I log in as ADMIN, and navigate to User Management page and click the newly created user to see details, I get this message.
This user is not in the directory service. The user will not be able to login unless they an account in the directory service.
What is this directory service? How to access it from the client API?
Thanks again.
When I log in as ADMIN, and navigate to User Management page and click the newly created user to see details, I get this message.
This user is not in the directory service. The user will not be able to login unless they an account in the directory service.
What is this directory service? How to access it from the client API?
Thanks again.
page 2of 1 pagesof 2 pagesof 3 pages