In this page you will understand usage of ACL in our template and how you can use it.
ability.js
: This file exports ACL abilitycheckaccess.js
Route protection files and custom ACL.config.js
: ACL configuration. Currently, contains initial ability of user.index.js
: Main ACL file for injecting ACL in Vue.router.beforeEach
hook to redirect user to not authorized page if user don’t have ability for that route. All you have to do is use route meta to define user ability.
resource
refers to subject
in CASL docs.resource
and action
then only user with below ability will be able to visit the route:
manage
and all
are special keywords in CASL. manage
represents any action and all represents any subject.action
and resource
for route then no one will be able to visit that route ever.
resource
: This refers to subject in CASL docsaction
: This is action for ability.
Add these two options in your navigation item to show/hide navigation items based on user ability.resource
and action
for groupsresource
& action
on navigation item type which have children:
resource
& action
as well with other following items.