Lightning.Policies.Collections (Lightning v2.19.0-pre)
View SourceThe Bodyguard Policy module for Collections.
Access to collections is controlled by the project the collection belongs to.
Read access (:access_collection) is allowed for any project member, or for a
run that belongs to the project (via its workflow).
Access is gated on the caller's project role, mirroring the read/write asymmetry used elsewhere in the app:
:access_collection(read: get, stream, download) is allowed for any project member, or for a run that belongs to the project.:put_collection_item/:delete_collection_item(put, put_all and single-key delete) require at least the:editorrole.:delete_all_collection_items(wiping/matching-delete of a collection's items) requires:owneror:admin.:manage_collection(creating, renaming or deleting the collection itself) requires:owneror:admin. Creation is authorized against the%Project{}, since no collection exists yet.
The *_collection_item(s) actions target the key-value entries exposed by the
Collections API; :manage_collection targets the collection record itself.
Runs retain full access to collections within their own project, since jobs need to read and mutate collection data while executing.
Summary
Functions
Callback implementation for Bodyguard.Policy.authorize/3.
Types
Functions
@spec authorize( actions(), Lightning.Accounts.User.t() | Lightning.Run.t(), Lightning.Collections.Collection.t() | Lightning.Projects.Project.t() ) :: :ok | {:error, :unauthorized} | boolean()
Callback implementation for Bodyguard.Policy.authorize/3.