Adding a user to a group

This section explains how to add a user to a group and then check that it was added properly.

Users in a group inherit the roles assigned to it.

Note: It is necessary to use a global token when executing this API.
  1. Set the environment variables below as follows:
    $ TMP_USER_ID=<userIdToBeAdded>
    $ TMP_GROUP_ID=<groupId>
  2. Execute the following API:
    $ curl -i -X PUT -Ss $IDENTITY/v3/groups/$TMP_GROUP_ID/users/\
    $TMP_USER_ID -H "X-Auth-Token:$OS_AUTH_TOKEN" \
    -H "Content-Type:application/json"

    The following response is output:

    HTTP/1.1 204 No Content
    X-Fcx-Endpoint-Request:  EXECUTED_REQ<nineDigitNum>_204
    Vary:  X-Auth-Token
    Date:  Tue, 17 Nov 2015 07:00:02 GMT
  3. Set the environment variable below as follows, and list the users in the group.
    $ TMP_GROUP_ID=<groupId>
    $ curl -X GET -Ss $IDENTITY/v3/groups/$TMP_GROUP_ID/users \
    -H "X-Auth-Token:$OS_AUTH_TOKEN" -H "Content-Type:application/json" | \
    jq .

    If a list including the users you added, like the following, is returned, that means the addition of users was successful.

    {
      "users": [
        
        ...
        
        {
          "domain_id": "<domainId>",
          "name": "<userName>",
          "links": {
            "self": "http://identity.cloud.global.fujitsu.com/v3/users/<userId>"
          },
          "locale": "ja",
          "enabled": true,
          "id": "<userId>",
          "default_project_id": "<defaultProjId>",
          "description": "<userDesc>"
        },
        
        ...
        
      ],
      "links": {
        "self": "http://identity.cloud.global.fujitsu.com/v3/groups/<groupId>/users",
        "next": null,
        "previous": null
      }
    }
  4. Users can also be deleted from a group. Follow the procedure below to delete a user from a group:

    Set the environment variables below as follows:

    $ TMP_USER_ID=<userIdToBeDeleted>
    $ TMP_GROUP_ID=<groupId>
  5. Execute the following API:
    $ curl -i -X DELETE -s $IDENTITY/v3/groups/$TMP_GROUP_ID/users/\
    $TMP_USER_ID -H "X-Auth-Token:$OS_AUTH_TOKEN" \
    -H "Content-Type:application/json"

    The following response is output:

    HTTP/1.1 204 No Content
    X-Fcx-Endpoint-Request:  EXECUTED_REQ<nineDigitNum>_204
    Vary:  X-Auth-Token
    Date:  Tue, 17 Nov 2015 07:00:02 GMT

    The method for checking if users have been successfully deleted is the same as for checking the addition of users.