0.1.7 • Published 10 years ago

loopback-component-role-super v0.1.7

Weekly downloads
8
License
MIT
Repository
github
Last release
10 years ago

Loopback Component superuser dynamic role

This loopback component add a new dynamic role: admin to become a super user.

You can use the loopback-component-role-user instead of it for more features.

Installation

  1. Install in you loopback project:

    npm install --save loopback-component-role-super

  2. Create a component-config.json file in your server folder (if you don't already have one)

  3. Configure options inside component-config.json:

    {
      "loopback-component-role-super": {
        "enabled": true,
        "role": "admin",
        "models": []
      }
    }
  • enabled Boolean: whether enable this component. defaults: true
  • role String : the role name. defaults: $admin
  • models Boolean|Array of string. defaults: true
    • enable the admin role to the models. true means all models in the app.models.
  • isAdminUser Function(aUserId, aRoleName, callback): the callback function to check whether the aUserId is an admin user.
    • the callback function(err, result) the result should be a boolean.
    • defaults: the Role should has aRoleName and the RoleMapping should has a user with aUserId.

Usage

Just enable it on component-config.json.

set DEBUG=loopback:security:role:super env vaiable to show debug info.

History

0.1.7

10 years ago

0.1.6

10 years ago

0.1.5

10 years ago

0.1.4

10 years ago

0.1.3

10 years ago

0.1.2

10 years ago

0.1.1

10 years ago

0.1.0

10 years ago