This article is outdated and it will be updated after identity and guard are
implemented.
Guards are role based access control. Instead of defining roles, we
describe it in places we need it. This is more flexible, readable and
descriptive.
Permissions include:
canMutate whether this person can create, update or delete
canRead whether this person can read
Model guard
A model guard protects API on the model level.
In this example, only rider can delete or update him/herself. Only order owner
can update or delete his/her orders.
Field guard
A field guard protects API on the field level.
A field has permissions, too. Field value is removed from the output if a user
has model read permission but doesn't have field read permission. delete
action is not triggered on fields.
In this example, only order's owner can change the amount.