WeaviateEx.API.RBAC.Scope (WeaviateEx v0.7.4)
View SourceRole scope permissions for fine-grained RBAC.
Scopes define the boundary of permissions, allowing you to restrict access to specific collections, tenants, or shards.
Examples
# All collections
scope = Scope.all_collections()
# Single collection
scope = Scope.collection("Article")
# Multiple collections
scope = Scope.collections(["Article", "Author"])
# Collection with tenant restriction
scope =
Scope.collection("Article")
|> Scope.with_tenants(["tenant-a", "tenant-b"])
# Use in permission
perm = Permission.new(:read, :data, scope: scope)
Summary
Functions
Creates a scope matching all collections.
Creates a scope for a single collection.
Creates a scope for multiple collections.
Parses a scope from API response.
Creates a new scope with the given options.
Converts a scope to API format.
Adds shard restrictions to a scope.
Adds tenant restrictions to a scope.
Types
Functions
@spec all_collections() :: t()
Creates a scope matching all collections.
Example
Scope.all_collections()
Creates a scope for a single collection.
Example
Scope.collection("Article")
Creates a scope for multiple collections.
Example
Scope.collections(["Article", "Author", "Comment"])
Parses a scope from API response.
Example
Scope.from_api(%{"collection" => "Article", "tenant" => "tenant-a"})
Creates a new scope with the given options.
Options
:collections- List of collection names or:all:tenants- List of tenant names or:all:shards- List of shard names or:all
Examples
Scope.new(collections: :all)
Scope.new(collections: ["Article"], tenants: ["tenant-a"])
Converts a scope to API format.
Examples
Scope.all_collections() |> Scope.to_api()
# => %{"collection" => "*"}
Scope.collection("Article") |> Scope.to_api()
# => %{"collection" => "Article"}
Adds shard restrictions to a scope.
Example
Scope.collection("Article")
|> Scope.with_shards(["shard-0", "shard-1"])
Adds tenant restrictions to a scope.
Examples
Scope.collection("Article")
|> Scope.with_tenants(["tenant-a"])
Scope.collection("Article")
|> Scope.with_tenants(:all)