[Spacewalk-list] Query the Org ID via APIs
Grant Gainey
ggainey at redhat.com
Mon Jul 22 21:16:19 UTC 2013
----- 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.
G
>
> 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
>
More information about the Spacewalk-list
mailing list