Lightning.Policies.Provisioning (Lightning v2.19.0-pre)
View SourceThe Bodyguard Policy module for the provisioning API.
Two kinds of caller reach this: a person with an API token, and a
%ProjectRepoConnection{} — a GitHub connection pushing a project definition
back to us. Both resolve through Lightning.Projects.Scope, so both are
refused on a project scheduled for deletion. A person is additionally held to
the project's MFA requirement; a repo connection has no MFA concept, and
Scope says so for it.
The repo-connection clauses previously compared
repo_connection.project_id == project.id, which is trivially true for the
project the connection belongs to and asks nothing about the project's state —
so a push could re-enable the triggers that shutting the project down had
disabled.
Only a superuser can provision a project that does not exist yet. Owners and admins can update an existing one.
Summary
Functions
Callback implementation for Bodyguard.Policy.authorize/3.
Types
@type actions() :: :provision_project | :describe_project
@type actor() :: Lightning.Accounts.User.t() | Lightning.VersionControl.ProjectRepoConnection.t()
Functions
@spec authorize(actions(), actor(), Lightning.Projects.Project.t()) :: boolean() | {:error, :forbidden}
Callback implementation for Bodyguard.Policy.authorize/3.