Ask Your Question
0

What is the curl equivalent to keystone user-role-add

asked 2013-09-14 10:45:33 -0600

anonymous user

Anonymous

I am trying to find out how to add a role to a user in openstack/keystone. I have been to the curl examples in openstack site but there doesn't seem to be enough information there to get the command right.

I have used the following command adding "role" as another parameter to adding a user. This seems to add an attribute "role" but I'm not sure it's considering it a real "role" :

curl -H 'X-Auth-Token: <token> ' -d '{"name":"test123","password":"secret.0","email":"test@test.com","role":"admin","enabled":true}' https://localhost:35357/v2.0/user</token>

Thanks in advance.

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
1

answered 2013-09-15 18:59:26 -0600

jamielennox gravatar image

For future if you are looking for this sort of information the keystone CLI app has a --debug flag which will show you the HTTP traffic in both directions, and handily prints out the equivalent curl commands for your request.

edit flag offensive delete link more
1

answered 2013-09-14 14:42:03 -0600

achampion gravatar image

updated 2013-09-14 14:42:31 -0600

In v2.0 you can only add a role for a user within a tenant. Adding a role is a PUT on /v2.0/tenants/{tenantId}/users/{userId}/roles/OS-KSADM/{roleId} You will need to find the id values for user, tenant and the admin role.

curl -X PUT -H 'X-Auth-Token:<token>' https://localhost:35357/v2.0/tenants/<tenantid>/users/<userid>/roles/OS-KSADM/<role-id>
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools

Stats

Asked: 2013-09-14 10:45:33 -0600

Seen: 657 times

Last updated: Sep 15 '13