简体   繁体   中英

How to implement node_acl in mean stack with node.js

I'd like to implement ACL with my MEAN application. I have a few questions regarding the implementation.

  1. How do I get acl with a mongodb backend instantiated in server.js so that I can use the same instance in my router and controllers?
  2. Does it make sense to create an acl controller that an administrator can use to create and assign roles, and change permissions?
  3. I would like all resources in my router.js to be exposed as acl resources with relevant actions. Does this happen automatically when you add acl.middleware() to the route?
  4. How can I define a permission like "edit own content"?

Here are a list of controller methods I have come up with to implement methods provided by ACL allowing an administrator to manage ACL settings:

  • set_acl (roles, resources, permissions)
  • remove_role (role)
  • what_resources (role, [permissions])
  • user_roles (userId)
  • allowed_permissions (userId, [resources])
  • add_user_roles (userId, roles)
  • remove_user_roles (userId, roles)

Is there anything I am missing?

https://npmjs.org/package/acl它与mongo db作为后端一起使用

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM