loopback-acl-extension
Creating User
, Role
, Permission
models and repositories and crud controllers in any application is a repetitive and futile task.
Using this extension you can bind them to your application using a simple and optional configurations.
Installation
npm i --save loopback-history-extensionnpm i --save loopback-authorization-extensionnpm i --save loopback-acl-extension
Usage
Follow these steps to add acl
extension to your loopback4 application
- Define your Relational and Cache
dataSources
- Add
ACLMixin
to your application - Bind
ACLRestServer
Now, let's try:
Step 1 (Define DataSource)
Bind your dataSources you want to use for acl tables using bindRelationalDataSource
and bindCacheDataSource
We need two dataSource, one for relational models, and one for cache models
- Relational Models:
CRUD
User
Role
Permission
UserRole
RolePermission
- Cache Models:
Key-Value
Session
Code
See this example of binding relational dataSource:
;
See this example of binding cache dataSource:
;
Step 2,3 (Application Mixin)
Edit your application.ts
file:
;;
Contributions
License
This project is licensed under the MIT license.
Copyright (c) KoLiBer (koliberr136a1@gmail.com)