Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@shagital/adonisjs-acl

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@shagital/adonisjs-acl

Role & Permission support for Adonisjs

  • 1.0.1
  • unpublished
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

AdonisJS ACL

npm npm (scoped) NPM

Version [for Adonis v5]

This package allows you easily add role/permission based access to your AdonisJS applications routes:

Available Features

  • Role based route authentication
  • Permission based route authentication

Requirements

  • Adonisjs v5
  • Node >=8
  • Mysql >=5
  • PostgreSQL >=10

Dependencies

Installation

You can install the package via NPM:

npm install @shagital/adonisjs-acl

Or with yarn

yarn add @shagital/adonisjs-acl

Setup

  • Configure package with node ace configure @shagital/adonisjs-acl
  • In start/kernel.ts, add the following to Server.middleware.registerNamed:
is: () => import('App/Middleware/Is'),
can: () => import('App/Middleware/Can'),
  • Update config/rolePermission.ts to customize table names
  • Run migration to create role and permission tables: node ace migration:run

Usage

Role Based Access

Route.get('/something-important', 'ImportantController.show').middleware('is:administrator')
Multiple Roles
Route.get('/something-important', 'ImportantController.show').middleware('is:administrator,superadmin')

Permission Based Access

Route.get('/important', 'SomeController.show').middleware('can:view-important')
Multiple Roles
Route.get('/important', 'SomeController.show').middleware('can:view-important,read-important')

NB: User is granted access if they have one or more role/permission specified

Todo

  • Add properties to models e.g User.hasRole, User.hasPermission, role.hasPermission, etc

Contributing

If you have a feature you'd like to add, kindly send a Pull Request (PR)

Security

If you discover any security related issues, please email zacchaeus@shagital.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

Keywords

FAQs

Package last updated on 24 Apr 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc