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

Copy Markdown View Source

This check is true if the access is coming from a relationship load.

This check allows resources to be accessed through relationship loads from other resources, without creating hard dependencies. It simply checks if Ash's accessing_from context is present, which indicates the access is happening through a relationship load.

Usage in policies

policies do
  bypass ExtensionInteraction do
    authorize_if always()
  end
end

This pattern allows any resource to load related data through relationships while maintaining proper authorization boundaries. The check doesn't distinguish between "core" and "extension" resources - it simply allows relationship-based access.

How it works

When Ash loads a relationship (e.g., Blogger.user), it automatically sets accessing_from: %{name: :user, source: MishkaBlog.Blogger} in the query context. This check detects that context and grants access.

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.