CASL and Aurelia integration
Read CASL in Aurelia app for details.
This blog application shows how to integrate CASL in Aurelia based application. Application uses standard aurelia cli setup with minor changes:
- all custom elements and attributes are in
- value converters are in
- bootstrap component is in
First of all, you need to install Aurelia CLI
npm install -g aurelia-cli
then clone this repository and run:
npm install au run --watch
Now you can open http://localhost:9000 to see application.
js-datamappers configuration can be found at
Sessionis fetched for each page reload at
To see application without CASL integration, checkout to
All abilities are defined in
src/config/abilities and updated each time a new
Session is created, found or destroyed (i.e., when user log in or log out).
can value convertor with
<li if.bind="'Post' | can: 'create'"> <a route-href="route: newPost">Add Post</a> </li>
In this case if user has ability to
create posts, he will see the button, otherwise button will be removed.
For more information about value convertors please refer to Aurealia documentation