MishkaCmsCore.Runtime.PageBuilder.BuilderAccess (Mishka CMS Core v0.0.1)

Copy Markdown View Source

A policy check: the actor may open the builder the row's own section names — its runtime area or admin:dashboard:code (MishkaCmsCore.Runtime.PageBuilder.Section.permissions/1).

Snippets, review notes and builder history each carry the section they were written in, so the names they need are read off the row:

policies do
  policy action_type([:create, :read, :update, :destroy]) do
    authorize_if {MishkaCmsCore.Runtime.PageBuilder.BuilderAccess, field: :section}
  end
end

A create is decided by the section it writes; a read, update or destroy reaches the rows whose section the actor holds. The site scope of MishkaCmsCore.Accounts.Checks.AccessPermissions applies: a site user holds nothing under another site's tenant.

Options

  • :field — the attribute holding the section (:page, :layout, :component, :error_page). Required.

Summary

Functions

auto_filter(actor, authorizer, opts)

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

auto_filter_not(actor, authorizer, opts)

check(actor, data, authorizer, opts)

Callback implementation for Ash.Policy.Check.check/4.

eager_evaluate?()

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

expand_description(actor, authorizer, opts)

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

init(opts)

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

prefer_expanded_description?()

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

reject(actor, authorizer, opts)

Callback implementation for Ash.Policy.FilterCheck.reject/3.

requires_original_data?(_, _)

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

sections(actor, context)

@spec sections(map() | nil, map()) :: [atom()]

The sections whose builder actor may open, as the atoms the builder's rows store.

strict_check(actor, authorizer, opts)

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

strict_check_context(opts)

type()

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