Please help build that feature with ideas 💭 here ... or code and tests here: https://github.com/wejs/sails-acl
- User model - TODO add example link
- Role model - TODO add example link
- Permission model - TODO add example link ( for database permissions )
- Will be plugged in sails.js polices
- After passport or other authentication middleware / police ( we need to get current logged in user)
- And receive:
- Current: fn(
request,response,sails) ( if dont pass the arg sails it will tries to get from the global scope )
- isAuthenticated
- iSCreator
In 'get /user/' ( controller: user , action: index) it will check if "get_user_index" permission exists in config:
if "get_user_index" exists it will check if one of the user roles can access it.
else if "get_user_index" dont exist it will check if default get permission exists and use it
else if return res.forbiden(); with one default configurable message or template
First will have one default config for every method ( get, post, put and delete ).
- It should get current controller, action and Method
- Get current user Roles
- Check if one of the logged in user roles has the permission
- With sails.js configurations ... TODO
If I get around to wrapping up and completing this project it might be of interest?
https://github.com/kristianmandrup/permit-authorize
Main task is to extract the different pieces and make it more opt-in and configurable as a set of pieces you can assemble as you like to suit your needs...