MishkaCmsCore.Accounts.Checks.AuthGateOpen (Mishka CMS Core v0.0.1)

Copy Markdown View Source

Policy check: passes unless the way in named by :action — :register or :reset — is closed for whoever the action is for (MishkaCmsCore.Accounts.AuthGate). Put it on the action, above the AshAuthentication bypass, with the gate's refusal as the policy's error:

policy action(:register_with_password) do
  error_message &MishkaCmsCore.Accounts.AuthGate.refused(&1, &2, :register)
  forbid_unless {MishkaCmsCore.Accounts.Checks.AuthGateOpen, action: :register}
  authorize_if always()
end

Registering is asked of the address it is for, resetting of the account being reset. Signing in is asked after the password instead (AuthGate.prepare/3), where the account is known.

Summary

Functions

eager_evaluate?()

Callback implementation for Ash.Policy.Check.eager_evaluate?/0.

init(opts)

Callback implementation for Ash.Policy.Check.init/1.

prefer_expanded_description?()

Callback implementation for Ash.Policy.Check.prefer_expanded_description?/0.

requires_original_data?(_, _)

Callback implementation for Ash.Policy.Check.requires_original_data?/2.

strict_check(actor, context, opts)

Callback implementation for Ash.Policy.Check.strict_check/3.

type()

Callback implementation for Ash.Policy.Check.type/0.