applications / roles - Keyrock command

This command allows you to manage roles for Keyrock.

Common Options

Options Description
--host value, -h value specify host or alias
--token value specify oauth token
--help show help (default: false)

List roles

This command lists all roles.

ngsi applications [command options] roles --aid {id} list [options]

Options

Options Description
--aid value, -i value application id
--pretty, -P pretty format (default: false)
--help show help (default: false)

Examples

Request:

ngsi applications roles --aid 8b58ecff-fb45-4811-945c-6f42339db06b list --pretty
{
  "roles": [
    {
      "id": "purchaser",
      "name": "Purchaser"
    },
    {
      "id": "provider",
      "name": "Provider"
    }
  ]
}

Get a role.

This command gets a role.

ngsi application [command options] roles --aid {id} get [options]

Options

Options Description
--aid value, -i value application id
--rid value, -r value role id
--pretty, -P pretty format (default: false)
--help show help (default: false)

Examples

Request:

ngsi applications roles --aid 8b58ecff-fb45-4811-945c-6f42339db06b get --rid purchaser --pretty
{
  "role": {
    "id": "purchaser",
    "name": "Purchaser",
    "is_internal": true,
    "oauth_client_id": "idm_admin_app"
  }
}

Create a role

This command creates a role.

ngsi application [command options] roles --aid {id} create [options]

Options

Options Description
--aid value, -i value application id
--data value, -d value role data
--name value, -n value role name
--verbose, -v verbose (default: false)
--pretty, -P pretty format (default: false)
--help show help (default: false)

Examples

Request:

ngsi applications roles --aid 8b58ecff-fb45-4811-945c-6f42339db06b create --name role1
dd214cb3-c445-4ae1-88bf-65db88226b51

Update a role

This command updates a role.

ngsi application [command options] roles --aid {id} update [options]

Options

Options Description
--aid value, -i value application id
--rid value, -r value role id
--data value, -d value role data
--name value, -n value role name
--verbose, -v verbose (default: false)
--pretty, -P pretty format (default: false)
--help show help (default: false)

Examples

Request:

ngsi applications roles --aid 8b58ecff-fb45-4811-945c-6f42339db06b \
  update --rid dd214cb3-c445-4ae1-88bf-65db88226b51 --name "role99"
{"values_updated":{"name":"role99"}}

Delete a role

This command deletes a role.

ngsi application [command options] roles delete [options]

Options

Options Description
--aid value, -i value application id
--rid value, -r value role id
--help show help (default: false)

Examples

Request:

ngsi applications roles --aid 8b58ecff-fb45-4811-945c-6f42339db06b \
  delete --rid dd214cb3-c445-4ae1-88bf-65db88226b51

List permissions associated to a role

This command list permissions associated to a role.

ngsi application [command options] roles permissions [options]

Options

Options Description
--aid value, -i value application id
--rid value, -r value role id
--pretty, -P pretty format (default: false)
--help show help (default: false)

Examples

Request:

ngsi applications roles --aid 8b58ecff-fb45-4811-945c-6f42339db06b \
  permissions --rid 7423d744-8682-4d5d-b338-2f4efcfa824e --pretty
{
  "role_permission_assignments": [
    {
      "id": "5ed4075e-cc31-4830-8b9a-f7a04eb25a36",
      "is_internal": false,
      "name": "permission1",
      "description": "test",
      "action": "GET",
      "resource": "login",
      "xml": null
    }
  ]
}

Assign a permission to a role

This command assigns a permission to a role.

ngsi application [command options] roles assign [options]

Options

Options Description
--aid value, -i value application id
--rid value, -r value role id
--pid value, -p value permission id
--verbose, -v verbose (default: false)
--pretty, -P pretty format (default: false)
--help show help (default: false)

Examples

Request:

ngsi applications roles --aid 8b58ecff-fb45-4811-945c-6f42339db06b \
  assign --rid 7423d744-8682-4d5d-b338-2f4efcfa824e --pid 5ed4075e-cc31-4830-8b9a-f7a04eb25a36
{
  "role_permission_assignments": {
    "role_id": "7423d744-8682-4d5d-b338-2f4efcfa824e",
    "permission_id": "5ed4075e-cc31-4830-8b9a-f7a04eb25a36"
  }
}

Delete a permission from a role

This command deletes a permission from a role

ngsi application [command options] roles unassign [options]

Options

Options Description
--aid value, -i value application id
--rid value, -r value role id
--pid value, -p value permission id
--help show help (default: false)

Examples

Request:

ngsi applications roles --aid 8b58ecff-fb45-4811-945c-6f42339db06b \
  unassign --rid 7423d744-8682-4d5d-b338-2f4efcfa824e --pid 5ed4075e-cc31-4830-8b9a-f7a04eb25a36