# `AshGrant.Validations.PermissionStrings`
[🔗](https://github.com/jhlee111/ash_grant/blob/v0.22.0/lib/ash_grant/validations/permission_strings.ex#L1)

An Ash validation for the attribute where an application stores grants.

Runs `AshGrant.PermissionValidation.check_all/2` over the value being written
and adds one field error per bad string, naming the string — so an admin UI
rejects a typo at the form instead of storing a grant that is inert, or that
raises on the first request to reach it.

    validations do
      validate {AshGrant.Validations.PermissionStrings, attribute: :permissions}
    end

The value may be a list of permission strings, a single string, or `nil`. It
is only checked when the action changes it: strings already stored are left
alone, so a rename in code does not block unrelated edits to the same record.
Scan stored strings with `mix ash_grant.check_permissions` instead.

## Options

  * `:attribute` — required. The attribute (or action argument) holding the
    permission strings.
  * `:otp_app` / `:resources` — which resources to check against, as in
    `AshGrant.PermissionValidation.check/2`. With neither, every AshGrant
    resource in the started applications' `:ash_domains` is used.
  * `:reject` — `:errors` (default) rejects only issues of severity `:error`;
    `:warnings` rejects warnings too.

---

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