Noizu.Weaviate.Api.Authz (Noizu Weaviate v0.2.0)

Functions for interacting with the Weaviate RBAC authorization API.

Summary

Functions

Link to this function

add_permissions(role_name, permissions, options \\ nil)

@spec add_permissions(String.t(), list(), options :: any()) ::
  {:ok, any()} | {:error, any()}

Add permissions to a role.

Parameters

  • role_name (required) - The name of the role.
  • permissions (required) - A list of permissions to add.
  • options (optional) - Additional options for the API call.

Examples

{:ok, response} = Noizu.Weaviate.Api.Authz.add_permissions("editor", [%{action: "read", collection: "*"}])
Link to this function

assign_roles(user_id, roles, options \\ nil)

@spec assign_roles(String.t(), list(), options :: any()) ::
  {:ok, any()} | {:error, any()}

Assign roles to a user.

Parameters

  • user_id (required) - The ID of the user.
  • roles (required) - A list of role names to assign.
  • options (optional) - Additional options for the API call.

Examples

{:ok, response} = Noizu.Weaviate.Api.Authz.assign_roles("user123", ["editor", "viewer"])
Link to this function

create_role(role, options \\ nil)

@spec create_role(map(), options :: any()) :: {:ok, any()} | {:error, any()}

Create a new role.

Parameters

  • role (required) - A map with role name and permissions.
  • options (optional) - Additional options for the API call.

Examples

{:ok, response} = Noizu.Weaviate.Api.Authz.create_role(%{name: "editor", permissions: [...]})
Link to this function

delete_role(role_name, options \\ nil)

@spec delete_role(String.t(), options :: any()) :: {:ok, any()} | {:error, any()}

Delete a role by name.

Parameters

  • role_name (required) - The name of the role.
  • options (optional) - Additional options for the API call.

Examples

{:ok, response} = Noizu.Weaviate.Api.Authz.delete_role("editor")
Link to this function

get_role(role_name, options \\ nil)

@spec get_role(String.t(), options :: any()) :: {:ok, any()} | {:error, any()}

Get a role by name.

Parameters

  • role_name (required) - The name of the role.
  • options (optional) - Additional options for the API call.

Examples

{:ok, response} = Noizu.Weaviate.Api.Authz.get_role("editor")
Link to this function

get_role_users(role_name, options \\ nil)

@spec get_role_users(String.t(), options :: any()) :: {:ok, any()} | {:error, any()}

Get users assigned to a role.

Parameters

  • role_name (required) - The name of the role.
  • options (optional) - Additional options for the API call.

Examples

{:ok, response} = Noizu.Weaviate.Api.Authz.get_role_users("editor")
Link to this function

get_user_roles(user_id, options \\ nil)

@spec get_user_roles(String.t(), options :: any()) :: {:ok, any()} | {:error, any()}

Get roles assigned to a user.

Parameters

  • user_id (required) - The ID of the user.
  • options (optional) - Additional options for the API call.

Examples

{:ok, response} = Noizu.Weaviate.Api.Authz.get_user_roles("user123")
Link to this function

list_roles(options \\ nil)

@spec list_roles(options :: any()) :: {:ok, any()} | {:error, any()}

List all roles.

Returns

A tuple {:ok, response} on successful API call, where response is the API response. Returns {:error, term} on failure, where term contains error details.

Examples

{:ok, response} = Noizu.Weaviate.Api.Authz.list_roles()
Link to this function

remove_permissions(role_name, permissions, options \\ nil)

@spec remove_permissions(String.t(), list(), options :: any()) ::
  {:ok, any()} | {:error, any()}

Remove permissions from a role.

Parameters

  • role_name (required) - The name of the role.
  • permissions (required) - A list of permissions to remove.
  • options (optional) - Additional options for the API call.

Examples

{:ok, response} = Noizu.Weaviate.Api.Authz.remove_permissions("editor", [%{action: "read", collection: "*"}])
Link to this function

revoke_roles(user_id, roles, options \\ nil)

@spec revoke_roles(String.t(), list(), options :: any()) ::
  {:ok, any()} | {:error, any()}

Revoke roles from a user.

Parameters

  • user_id (required) - The ID of the user.
  • roles (required) - A list of role names to revoke.
  • options (optional) - Additional options for the API call.

Examples

{:ok, response} = Noizu.Weaviate.Api.Authz.revoke_roles("user123", ["editor"])