# `MishkaDocument.Resources.Validations.OpenToActor`
[🔗](https://github.com/mishka-group/mishka_document/blob/v0.0.1/lib/mishka_document/resources/__validates/open_to_actor.ex#L5)

Refuses a write onto a record its actor may not open — a bookmark on a locked page of a document,
a follow of a locked document — with the message the action gives for a record that is not
there, so the refusal tells nothing a reader may not know. Who may open it is what its page asks
(`MishkaDocument.Resources.Preparations.OpenToActor.opens?/2`).

    validate {OpenToActor,
              field: :section_id,
              resource: MishkaDocument.Section,
              lock: :effective_permissions,
              message: dgettext_noop("errors", "Section not found or does not belong to your site.")}

A call made with `authorize?: false` is not checked, and a record that is not there is left to the
action's own check of it.

## Options

* `:field` - Required. The attribute naming the record.
* `:resource` - Required. The resource it names.
* `:lock` - Required. The attribute or calculation holding the permissions that record opens with.
* `:message` - Required. The refusal.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
