AshPolicyAuthorizer.Check.BuiltInChecks (ash_policy_authorizer v0.16.5) View Source

The global authorization checks built into ash

Link to this section Summary

Functions

This check is true when the action name matches the provided action name

This check is true when the action type matches the provided type

This check is true when the value of the specified attribute equals the specified value

This check always passes

This check is true when a field on the record matches a specific filter

This check is true when attribute changes correspond to the provided options.

This check is true when the specified relationship is changing

This check is true when the specified relationships are changing

this check never passes

This check passes if the data relates to the actor via the specified relationship or path of relationships

This check is true when the specified relationship is being changed to the current actor

This check is true when the field is being selected and false when it is not

Link to this section Functions

This check is true when the action name matches the provided action name

Link to this function

action_type(action_type)

View Source

This check is true when the action type matches the provided type

Link to this function

actor_attribute_equals(attribute, value)

View Source

This check is true when the value of the specified attribute equals the specified value

This check always passes

Link to this function

attribute(attribute, filter)

View Source

This check is true when a field on the record matches a specific filter

Link to this function

changing_attributes(opts)

View Source

This check is true when attribute changes correspond to the provided options.

Provide a keyword list of options or just an atom representing the attribute.

For example:

# if you are changing both first name and last name
changing_attributes([:first_name, :last_name])

# if you are changing first name to fred
changing_attributes(first_name: [to: "fred"])

# if you are changing last name from bob
changing_attributes(last_name: [from: "bob"])

# if you are changing :first_name at all, last_name from "bob" and middle name from "tom" to "george"
changing_attributes([:first_name, last_name: [from: "bob"], middle_name: [from: "tom", to: "george]])
Link to this function

changing_relationship(relationship)

View Source

This check is true when the specified relationship is changing

Link to this function

changing_relationships(relationships)

View Source

This check is true when the specified relationships are changing

this check never passes

Link to this function

relates_to_actor_via(relationship_path)

View Source

This check passes if the data relates to the actor via the specified relationship or path of relationships

Link to this function

relating_to_actor(relationship)

View Source

This check is true when the specified relationship is being changed to the current actor

This check is true when the field is being selected and false when it is not