Roles

Envless.roles.get

Fetch one role by id

def get(id, timeout: nil)

Reads a single role. Unlike products and projects, there is no slug form here: the argument must be the role id taken from list, and a role name or a system key such as owner comes back as 404 role.not_found.

For a system role, permissions is the canonical catalogue list for its systemKey rather than the stored column, so it stays correct as the platform permission set grows. systemKey is nil for custom roles, and isSystem is the flag to branch on before offering an edit or delete action, since both are refused on system roles.

Example

ruby
require "envless/sdk"

role = Envless.roles.list_all(search: "deploy").fetch(0)

detail = Envless.roles.get(role[:id])

puts detail[:permissions]

Parameters

ParameterTypeRequiredDescription
idStringYesRole id from roles.list, with no name or slug form accepted.
timeout:Integer | Float | RationalNoSeconds each attempt of this call may take, redirects and the response body included, before it raises Envless::NetworkError with timeout? set. Overrides the client's timeout for this call, and 0 turns the limit off.

Returns

role_resource with permissions, isSystem, systemKey and timestamps.

Worth knowing

  • A soft deleted role is indistinguishable from one that never existed: both answer 404 role.not_found.
  • The role must belong to the workspace the API key is bound to, since ids from another workspace also read as 404.

Required scopes

roles:read

Underlying endpoint

GET /roles/{id}

Request and response schema, every error code, and a live playground.

In TypeScript

envless.roles.get()

The same method in @goenvless/sdk, with the same request, retries and errors.