ABAC
Attribute-Based Access Control
Attributes Check
Puedo uses attributes check to determine if a user has access to a resource.
Accessor key
Puedo defines accessorKey within its options. This key is used to access the first level of the permission object.
If we do so, we expect the user to have a role attribute which is the main discriminator of the permissions.
More attributes
Puedo also supports mulitple attributes check. In order to do so, we can just use a function instead of a boolean within roles permissions. Given a user made like this:
We can define roles like this:
Now, if we try to check if the user has access to read, it will check if the user is an editor.