WeaviateEx.RBAC.UserAssignment (WeaviateEx v0.7.4)

View Source

User assignment with type information.

Represents a user assigned to a role, including their user type which indicates how the user was created/authenticated.

User Types

  • :db_user - Database-backed user created via the Users.DB API
  • :db_env_user - Database user created via environment variables
  • :oidc - User authenticated via OpenID Connect

Examples

{:ok, assignments} = RBAC.get_user_assignments(client, "editor")
for assignment <- assignments do
  IO.puts("#{assignment.user_id} (type: #{assignment.user_type})")
end

Summary

Functions

Check if the user is a database-backed user.

Parse user assignment from API response.

Creates a new UserAssignment struct.

Check if the user is an OIDC user.

Parse user type string to atom.

Convert user assignment to API format.

Convert user type atom to API string.

Types

t()

@type t() :: %WeaviateEx.RBAC.UserAssignment{
  user_id: String.t(),
  user_type: user_type()
}

user_type()

@type user_type() :: :db_user | :db_env_user | :oidc

Functions

db_user?(arg1)

@spec db_user?(t()) :: boolean()

Check if the user is a database-backed user.

from_api(user_id)

@spec from_api(map()) :: t()

Parse user assignment from API response.

Examples

assignment = UserAssignment.from_api(%{"userId" => "john", "userType" => "db_user"})
# => %UserAssignment{user_id: "john", user_type: :db_user}

new(user_id, user_type)

@spec new(String.t(), user_type()) :: t()

Creates a new UserAssignment struct.

Examples

assignment = UserAssignment.new("john.doe", :db_user)

oidc_user?(arg1)

@spec oidc_user?(t()) :: boolean()

Check if the user is an OIDC user.

parse_user_type(arg1)

@spec parse_user_type(String.t()) :: user_type()

Parse user type string to atom.

to_api(assignment)

@spec to_api(t()) :: map()

Convert user assignment to API format.

user_type_to_string(atom)

@spec user_type_to_string(user_type()) :: String.t()

Convert user type atom to API string.