acler

    1.0.0 • Public • Published

    ACLer

    Minimalistic ACL implementation for privileges management in JS

    Installation

    $ npm i acler --save

    or

    $ yarn add acler

    Usage

    // using ES modules
    import { check } from 'acler'
    // using CommonJS modules
    const { check } = require('acler')
     
    const user = {
      get roles () {
        return ['moderator']
      }
    }
     
    const can = check('administrator || moderator', role => {
      return user.roles.includes(role)
    })
     
    if (!can) {
      throw new Error('You not allowed to this resource.')
    }

    Syntax

    and (&&) - administrator && moderator

    or (||) - administrator || moderator

    not (!) - administrator && !moderator

    Credits

    Support

    Having trouble? Open an issue!

    License

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

    Keywords

    none

    Install

    npm i acler

    DownloadsWeekly Downloads

    708

    Version

    1.0.0

    License

    MIT

    Unpacked Size

    27.2 kB

    Total Files

    6

    Last publish

    Collaborators

    • enniel