sails-permissions | Comprehensive user permissions and entitlements system | Authentication library
kandi X-RAY | sails-permissions Summary
kandi X-RAY | sails-permissions Summary
Comprehensive user permissions and entitlements system for sails.js and Waterline. Supports user authentication with passport.js, role-based permissioning, object ownership, and row-level security.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Creates the response policy
- Bind the response policy
- Parses the model from the request .
sails-permissions Key Features
sails-permissions Examples and Code Snippets
Community Discussions
Trending Discussions on sails-permissions
QUESTION
I'm using Sails version 1.2.3 to build rest APIs. Our application requires row-level permissions for some entities. For example, for the same API, certain users/roles the rest API should return a subset of the data. For elevated users the rest API should return the full set of data.
Instead of build custom routes/actions for our application, I'd like to use sails blueprint routes, and apply the necessary row-level permissions to the blueprint routes.
I've tried reviewing the sails-auth and sails-permissions npm packages, but they don't work for sails 1.x.
Is there a way to do this in the current version of SailsJS?
Thanks!
...ANSWER
Answered 2019-Nov-13 at 22:19I agree with @mansim. But still, if you want to do this you must override the find and findOne controllers as per requirement.
Steps should be like as follows:
- Create a policy that will set a permission flag in the 'req' object.
- Read flag from 'req' in the findOne/find method.
- Use _.omit(or any javascript method) to remove the details which you don't want to send.
QUESTION
We are quite new to Sails JS.
Using Sails JS (V 0.12.13) inside our company locally, we are now to the point of granting access to our customers. We would like to implement few layers of access (Global admin, global user, customer admin, and customer user (possibly others but not yet)). We would also like to manage customer pages individually (customer1.app.com, customer2.app.com...).
Because we don't need social login, just local users, we've counted out Passport.
Is the best practice to go with Sails policies and access control ? We found this in Sails documentation (https://sailsjs.com/documentation/concepts/policies/access-control-and-permissions) but as it is in the V 1. doc we don't know if we can use in with sails 0.12.13.
Or would something like Sails-Permissions (https://github.com/trailsjs/sails-permissions) be more appropriate to manage users ?
Also, from the Sails.JS in Action book, they use machine-packs to encrypt passwords and manage logins. Those package looks ratter old, so we are wondering if they are still "safe" to use in a 2018 app.
...ANSWER
Answered 2018-Apr-24 at 08:18Sails policies are certainly a good practice, and you can use them in v0.12
v0.12 docs, yes I agree that machine-packs are pretty old, but you can use npm modules and wrap them in helpers, for encrypting passwords for example, you can use beforeCreate
to encrypt the password before saving to the database.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install sails-permissions
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page