JSPM

  • Created
  • Published
  • Downloads 14
  • Score
    100M100P100Q62457F
  • License MIT

Comprehensive sails.js user permission/privilege framework that allows granting and restricting access to models and attributes based on object ownership and relationships with other users and roles

Package Exports

  • sails-permissions
  • sails-permissions/api/controllers/AuthController
  • sails-permissions/api/controllers/ModelController
  • sails-permissions/api/controllers/PermissionController
  • sails-permissions/api/controllers/RoleController
  • sails-permissions/api/controllers/UserController
  • sails-permissions/api/hooks/permissions-api/index
  • sails-permissions/api/models/Model
  • sails-permissions/api/models/Passport
  • sails-permissions/api/models/Permission
  • sails-permissions/api/models/Role
  • sails-permissions/api/models/User
  • sails-permissions/api/policies/ModelPolicy
  • sails-permissions/api/policies/OwnerPolicy
  • sails-permissions/api/policies/PermissionPolicy
  • sails-permissions/api/policies/RolePolicy
  • sails-permissions/api/policies/basicAuth
  • sails-permissions/api/policies/passport
  • sails-permissions/api/services/ModelService
  • sails-permissions/api/services/PermissionService
  • sails-permissions/api/services/passport
  • sails-permissions/api/services/protocols/local
  • sails-permissions/api/services/protocols/oauth
  • sails-permissions/api/services/protocols/oauth2
  • sails-permissions/api/services/protocols/openid
  • sails-permissions/config/passport
  • sails-permissions/config/permissions
  • sails-permissions/config/routes/sails-auth

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (sails-permissions) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

-permissions

NPM version Build status Dependency Status

Install

$ npm install lodash sails-auth sails-permissions --save

Usage

1. configure sailsrc

{
  "generators": {
    "modules": {
      "permissions-api": "sails-permissions",
      "auth-api": "sails-auth"
    }
  }
}

2. run generator

$ sails generate permissions-api

3. Set environment variables

variable description default
ADMIN_USERNAME admin username admin
ADMIN_EMAIL admin user email address admin@example.com
ADMIN_PASSWORD admin user password admin1234

4. update configs

config/policies.js

  '*': [
    'basicAuth',
    'passport',
    'sessionAuth',
    'ModelPolicy',
    'OwnerPolicy',
    'PermissionPolicy',
    'RolePolicy'
  ],

  AuthController: {
    '*': true
  }

License

MIT