Lightning.Policies.Credentials (Lightning v2.19.0-pre)

View Source

The Bodyguard Policy module for authorizing credential actions.

Summary

Functions

Authorize credential actions based on the user's project role.

Types

actions()

@type actions() ::
  :create_keychain_credential
  | :edit_keychain_credential
  | :delete_keychain_credential
  | :view_keychain_credential

Functions

authorize(action, user, resource)

@spec authorize(
  action :: actions(),
  user :: Lightning.Accounts.User.t(),
  resource :: Lightning.Projects.Project.t()
) :: boolean()
@spec authorize(
  action :: actions(),
  user :: Lightning.Accounts.User.t(),
  resource :: Lightning.Credentials.KeychainCredential.t()
) :: boolean()

Authorize credential actions based on the user's project role.

For KeychainCredential resources, users must have owner or admin role in the associated project.