Keystone now has Implied Roles. What does this mean? Lets say we define the role Admin to imply the Member role. Now, if you assigned someone Admin on a project they are automatically assigned the Member role on that project implicitly.
Let’s test it out:
Since we don’t yet have client or CLI support, we’ll have to make due with curl and jq for now.
This uses the same approach Keystone V3 Examples
#!/bin/sh 
. ~/adminrc
export TOKEN=`curl -si -d @token-request.json -H "Content-type: application/json" $OS_AUTH_URL/auth/tokens | awk '/X-Subject-Token/ {print $2}'`
export ADMIN_ID=`curl -H"X-Auth-Token:$TOKEN" -H "Content-type: application/json" $OS_AUTH_URL/roles?name=admin | jq --raw-output '.roles[] | {id}[]'`
export MEMBER_ID=`curl -H"X-Auth-Token:$TOKEN" -H "Content-type: application/json" $OS_AUTH_URL/roles?name=_member_ | jq --raw-output '.roles[] | {id}[]'`
curl -X PUT -H"X-Auth-Token:$TOKEN" -H "Content-type: application/json" $OS_AUTH_URL/roles/$ADMIN_ID/implies/$MEMBER_ID
curl  -H"X-Auth-Token:$TOKEN" -H "Content-type: application/json" $OS_AUTH_URL/role_inferences 
Now, create a new user and and assign them only the user role.
openstack user create Phred openstack user show Phred +-----------+----------------------------------+ | Field | Value | +-----------+----------------------------------+ | domain_id | default | | enabled | True | | id | 117c6f0055a446b19f869313e4cbfb5f | | name | Phred | +-----------+----------------------------------+ $ openstack user set --password-prompt Phred User Password: Repeat User Password: $ openstack project list +----------------------------------+-------+ | ID | Name | +----------------------------------+-------+ | fdd0b0dcf45e46398b3f9b22d2ec1ab7 | admin | +----------------------------------+-------+ $ openstack project list +----------------------------------+-------+ | ID | Name | +----------------------------------+-------+ | fdd0b0dcf45e46398b3f9b22d2ec1ab7 | admin | +----------------------------------+-------+ openstack role add --user 117c6f0055a446b19f869313e4cbfb5f --project fdd0b0dcf45e46398b3f9b22d2ec1ab7 e3b08f3ac45a49b4af77dcabcd640a66
Copy token-request.json and modify the values for the new user.
 curl  -d @token-request-phred.json -H "Content-type: application/json" $OS_AUTH_URL/auth/tokens | jq '.token | {roles}'
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  1643  100  1098  100   545  14742   7317 --:--:-- --:--:-- --:--:-- 14837
{
  "roles": [
    {
      "id": "9fe2ff9ee4384b1894a90878d3e92bab",
      "name": "_member_"
    },
    {
      "id": "e3b08f3ac45a49b4af77dcabcd640a66",
      "name": "admin"
    }
  ]
}
			