[Users] Create domain user with api

Karli Sjöberg Karli.Sjoberg at slu.se
Mon Aug 20 08:03:21 UTC 2012


20 aug 2012 kl. 09.38 skrev Omer Frenkel:

adding Ori, comment inside

________________________________
From: "Karli Sjöberg" <Karli.Sjoberg at slu.se<mailto:Karli.Sjoberg at slu.se>>
To: "Karli Sjöberg" <Karli.Sjoberg at slu.se<mailto:Karli.Sjoberg at slu.se>>
Cc: "users" <users at ovirt.org<mailto:users at ovirt.org>>
Sent: Monday, August 20, 2012 9:25:19 AM
Subject: Re: [Users] Create domain user with api

Hey all, I kind of figured this out on my own. Still have some kinks to iron out, from the web perspective, but I´ll get back to you on that. In the mean time I noticed a rather strange redirection sent back when adding a user. Check this out:

# curl -v -X POST -H "Accept: application/xml" -H "Accept: application/xml" -H "Content-type: application/xml" -u admin at internal:letmein! -T upload.xmlhttp://engine.slu.se:80/api/users

upload.xml:
<user>
  <user_name>somename at slu.se</user_name>
  <domain id="61642e73-6c75-2e73-6561-642e736c752e" />

maybe i missed something, but why you have domain id under user?
user entity has 'domain' which is the directory server.

Well, mostly because our domain is quite oddly set up, called "ad.slu.se<http://slu.se>"(long story), while users are called only "user at slu.se<mailto:user at slu.se>", and I thought that maybe you´d have to be specific about that. I can try add another user without <domain id> specified, but does that have an impact to the redirection(/api/api/) you get back?
    <role>
      <name>SomeRole</name>
    </role>
  </roles>
</user>

* About to connect() to engine.slu.se<http://engine.slu.se> port 80 (#0)
*   Trying XXX.XXX.XXX.XXX... connected
* Connected to engine.slu.se<http://engine.slu.se> (XXX.XXX.XXX.XXX) port 80 (#0)
* Server auth using Basic with user 'admin at internal'
POST /api/users HTTP/1.1
Authorization: Basic YWRtaW5AaW50ZXJuYGH4UiXVhaDJkYWk=
User-Agent: curl/7.19.7 (universal-apple-darwin10.0) libcurl/7.19.7 OpenSSL/0.9.8r zlib/1.2.3
Host: engine.slu.se<http://engine.slu.se>
Accept: application/xml
Accept: application/xml
Content-type: application/xml
Content-Length: 184
Expect: 100-continue

< HTTP/1.1 100 Continue
< HTTP/1.1 201 Created
< Date: Fri, 17 Aug 2012 13:47:00 GMT
< Set-Cookie: JSESSIONID=LXBbH1Wcmv-jepsSl06FtMaA.undefined; Path=/api
< Location: http://engine.slu.se/api/api/domains/61642e73-6c75-2e73-6561-642e736c752e/users/94155e69-4691-4cbb-a6b5-d30a6bd5b667
< Content-Type: application/xml
< Connection: close
< Transfer-Encoding: chunked
<

That Location is invalid. Proper location would be:
< Location: http://engine.slu.se/api/domains/61642e73-6c75-2e73-6561-642e736c752e/users/94155e69-4691-4cbb-a6b5-d30a6bd5b667

Bug?

/Karli

17 aug 2012 kl. 10.45 skrev Karli Sjöberg:

Hey all,

using "ovirt-shell" I can do:
$ create user --user_name somename at foo.bar<mailto:somename at foo.bar> --domain-name something.foo.bar

How do express that as a POST with the api? Could you provide a xml example?



Med Vänliga Hälsningar
-------------------------------------------------------------------------------
Karli Sjöberg
Swedish University of Agricultural Sciences
Box 7079 (Visiting Address Kronåsvägen 8)
S-750 07 Uppsala, Sweden
Phone:  +46-(0)18-67 15 66
karli.sjoberg at slu.se<mailto:karli.sjoberg at adm.slu.se>

_______________________________________________
Users mailing list
Users at ovirt.org<mailto:Users at ovirt.org>
http://lists.ovirt.org/mailman/listinfo/users



Med Vänliga Hälsningar
-------------------------------------------------------------------------------
Karli Sjöberg
Swedish University of Agricultural Sciences
Box 7079 (Visiting Address Kronåsvägen 8)
S-750 07 Uppsala, Sweden
Phone:  +46-(0)18-67 15 66
karli.sjoberg at slu.se<mailto:karli.sjoberg at adm.slu.se>


_______________________________________________
Users mailing list
Users at ovirt.org<mailto:Users at ovirt.org>
http://lists.ovirt.org/mailman/listinfo/users





Med Vänliga Hälsningar
-------------------------------------------------------------------------------
Karli Sjöberg
Swedish University of Agricultural Sciences
Box 7079 (Visiting Address Kronåsvägen 8)
S-750 07 Uppsala, Sweden
Phone:  +46-(0)18-67 15 66
karli.sjoberg at slu.se<mailto:karli.sjoberg at adm.slu.se>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ovirt.org/pipermail/users/attachments/20120820/3848b759/attachment-0001.html>


More information about the Users mailing list