[Spacewalk-list] Query the Org ID via APIs
Jon Miller
jonebird at gmail.com
Mon Jul 22 21:45:48 UTC 2013
ggainey at redhat.com writes:
> ----- Original Message -----
>> I would like to be able to query the org of a user that is currently
>> authenticated to the server via an API call. I realize that there is the
>> "org.listOrgs" call but that is only available for a Spacewalk
>> administrator. What I'm looking for is something that a regular organization
>> admin can use.
>>
>> I currently only know how to retrieve the org number by querying my custom
>> snippets. I'm hoping there is a better method that I am just not finding?
>
> Does user.getDetails(session,login) do what you want? Org-admin can look up users in their org, and org_id is included in the returned data.
It does! Thanks.
>>
>> def get_org(session, client):
>> # Really, really silly but I do not know how to get the Org other than
>> the fragment
>> snippets = client.kickstart.snippet.listCustom(session)
>> if not snippets:
>> return -1
>> return re.search(r'/(\d+)/', snippets[0]['fragment']).group(1)
>>
>> Thanks,
>> --
>> Jon Miller
>>
>> _______________________________________________
>> Spacewalk-list mailing list
>> Spacewalk-list at redhat.com
>> https://www.redhat.com/mailman/listinfo/spacewalk-list
>>
>
> _______________________________________________
> Spacewalk-list mailing list
> Spacewalk-list at redhat.com
> https://www.redhat.com/mailman/listinfo/spacewalk-list
--
Jon Miller
More information about the Spacewalk-list
mailing list