Open stalniy opened 5 years ago
Need to check what is in this course https://codecourse.com/watch/vue-roles-and-permissions?part=using-casl-with-vue
FAQ will be represented as a cookbook in the new docs
empty conditions object behavior:
{
"subject": "Financial",
"action": "read",
"fields": [
"salary",
"taxcode"
],
conditions: {}
},
{
"subject": "Financial",
"action": "read",
"inverted": true,
"fields": [
“salary"
],
conditions: {}
}
Conditions are sometimes populated but in this case they are not. After retrieving from the array of Abilities from the database I pass them in to Ability. When empty conditions objects are there the can/cannot don’t work as expected. If I remove empty conditions objects before pushing them into Ability they work exactly as expected. This is using the latest version of CASL. Cleaning up my data solves the problem so I’m happy but I thought you might like to know in case that is unexpected behaviour.
Tasks:
all
records #259[ ] Cookbook: AWS cognito
Basics:
ability.can(['read', 'update'], 'Post')
ability.can('read', 'Post', { userId: 5 })
Advanced:
Security:
Persisted permissions (i.e., roles)
Use cases:
frontend
this.$ability
! (#210)Mongoose:
accessibleFields(ability)
, why cannot use.select(..)
to filter out disallowed fields (https://github.com/stalniy/casl-mongoose-example)Tests
138 how to test abilities?
backend
can('manage', 'Comment', { ??? <how to walk the object graph here> ???})
can('edit' , 'Post', { moderators: "contain user.id" })