ExBifrost.Api.RBAC (ex_bifrost v0.1.0)

Copy Markdown View Source

API calls for all endpoints tagged RBAC.

Summary

Functions

Create role Creates a custom role with the specified data access control scope. If dac is omitted, defaults to all-data.

Delete role Deletes a custom role. Built-in system roles cannot be deleted and return 403.

List permissions assigned to a role

List RBAC operations Returns the set of operation names that permissions can grant.

List all RBAC permissions Returns every (resource, operation) pair that can be granted to a role.

List RBAC resources Returns the set of resource names that permissions can target.

List roles Returns all roles visible to the caller, scoped by data access control.

Update role Partial update. Omitted fields preserve the current value. Notable: omitting dac preserves the current scope (does not default to all-data).

Replace the permission set on a role Replaces the permission set assigned to the role. Send the complete list of permission IDs that should be active for the role.

Functions

create_role(connection, create_role_request, opts \\ [])

Create role Creates a custom role with the specified data access control scope. If dac is omitted, defaults to all-data.

Parameters

  • connection (ExBifrost.Connection): Connection to server
  • create_role_request (CreateRoleRequest):
  • opts (keyword): Optional parameters

Returns

  • {:ok, ExBifrost.Model.CreateRole200Response.t} on success
  • {:error, Tesla.Env.t} on failure

delete_role(connection, id, opts \\ [])

Delete role Deletes a custom role. Built-in system roles cannot be deleted and return 403.

Parameters

  • connection (ExBifrost.Connection): Connection to server
  • id (integer()):
  • opts (keyword): Optional parameters

Returns

  • {:ok, ExBifrost.Model.Logout200Response.t} on success
  • {:error, Tesla.Env.t} on failure

get_role(connection, id, opts \\ [])

@spec get_role(Tesla.Env.client(), integer(), keyword()) ::
  {:ok, nil}
  | {:ok, ExBifrost.Model.CreateRole200Response.t()}
  | {:ok, ExBifrost.Model.BifrostError.t()}
  | {:error, Tesla.Env.t()}

Get role by ID

Parameters

  • connection (ExBifrost.Connection): Connection to server
  • id (integer()):
  • opts (keyword): Optional parameters

Returns

  • {:ok, ExBifrost.Model.CreateRole200Response.t} on success
  • {:error, Tesla.Env.t} on failure

get_role_permissions(connection, id, opts \\ [])

@spec get_role_permissions(Tesla.Env.client(), integer(), keyword()) ::
  {:ok, nil}
  | {:ok, ExBifrost.Model.BifrostError.t()}
  | {:ok, ExBifrost.Model.GetRolePermissions200Response.t()}
  | {:error, Tesla.Env.t()}

List permissions assigned to a role

Parameters

  • connection (ExBifrost.Connection): Connection to server
  • id (integer()):
  • opts (keyword): Optional parameters

Returns

  • {:ok, ExBifrost.Model.GetRolePermissions200Response.t} on success
  • {:error, Tesla.Env.t} on failure

list_operations(connection, opts \\ [])

@spec list_operations(
  Tesla.Env.client(),
  keyword()
) ::
  {:ok, ExBifrost.Model.BifrostError.t()}
  | {:ok, ExBifrost.Model.ListOperations200Response.t()}
  | {:error, Tesla.Env.t()}

List RBAC operations Returns the set of operation names that permissions can grant.

Parameters

  • connection (ExBifrost.Connection): Connection to server
  • opts (keyword): Optional parameters

Returns

  • {:ok, ExBifrost.Model.ListOperations200Response.t} on success
  • {:error, Tesla.Env.t} on failure

list_permissions(connection, opts \\ [])

@spec list_permissions(
  Tesla.Env.client(),
  keyword()
) ::
  {:ok, ExBifrost.Model.BifrostError.t()}
  | {:ok, ExBifrost.Model.GetRolePermissions200Response.t()}
  | {:error, Tesla.Env.t()}

List all RBAC permissions Returns every (resource, operation) pair that can be granted to a role.

Parameters

  • connection (ExBifrost.Connection): Connection to server
  • opts (keyword): Optional parameters

Returns

  • {:ok, ExBifrost.Model.GetRolePermissions200Response.t} on success
  • {:error, Tesla.Env.t} on failure

list_resources(connection, opts \\ [])

@spec list_resources(
  Tesla.Env.client(),
  keyword()
) ::
  {:ok, ExBifrost.Model.BifrostError.t()}
  | {:ok, ExBifrost.Model.ListResources200Response.t()}
  | {:error, Tesla.Env.t()}

List RBAC resources Returns the set of resource names that permissions can target.

Parameters

  • connection (ExBifrost.Connection): Connection to server
  • opts (keyword): Optional parameters

Returns

  • {:ok, ExBifrost.Model.ListResources200Response.t} on success
  • {:error, Tesla.Env.t} on failure

list_roles(connection, opts \\ [])

@spec list_roles(
  Tesla.Env.client(),
  keyword()
) ::
  {:ok, ExBifrost.Model.BifrostError.t()}
  | {:ok, ExBifrost.Model.ListRoles200Response.t()}
  | {:error, Tesla.Env.t()}

List roles Returns all roles visible to the caller, scoped by data access control.

Parameters

  • connection (ExBifrost.Connection): Connection to server
  • opts (keyword): Optional parameters

Returns

  • {:ok, ExBifrost.Model.ListRoles200Response.t} on success
  • {:error, Tesla.Env.t} on failure

update_role(connection, id, update_role_request, opts \\ [])

Update role Partial update. Omitted fields preserve the current value. Notable: omitting dac preserves the current scope (does not default to all-data).

Parameters

  • connection (ExBifrost.Connection): Connection to server
  • id (integer()):
  • update_role_request (UpdateRoleRequest):
  • opts (keyword): Optional parameters

Returns

  • {:ok, ExBifrost.Model.CreateRole200Response.t} on success
  • {:error, Tesla.Env.t} on failure

update_role_permissions(connection, id, update_role_permissions_request, opts \\ [])

@spec update_role_permissions(
  Tesla.Env.client(),
  integer(),
  ExBifrost.Model.UpdateRolePermissionsRequest.t(),
  keyword()
) ::
  {:ok, nil}
  | {:ok, ExBifrost.Model.Logout200Response.t()}
  | {:ok, ExBifrost.Model.BifrostError.t()}
  | {:error, Tesla.Env.t()}

Replace the permission set on a role Replaces the permission set assigned to the role. Send the complete list of permission IDs that should be active for the role.

Parameters

  • connection (ExBifrost.Connection): Connection to server
  • id (integer()):
  • update_role_permissions_request (UpdateRolePermissionsRequest):
  • opts (keyword): Optional parameters

Returns

  • {:ok, ExBifrost.Model.Logout200Response.t} on success
  • {:error, Tesla.Env.t} on failure