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}
endThe 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 inAshGrant.PermissionValidation.check/2. With neither, every AshGrant resource in the started applications':ash_domainsis used.:reject—:errors(default) rejects only issues of severity:error;:warningsrejects warnings too.