Strategy for Modeling RBAC with NoSQL Document Store Strategy for Modeling RBAC with NoSQL Document Store mongoose mongoose

Strategy for Modeling RBAC with NoSQL Document Store


I recently used mongoosejs with a user/roles/permissions need I had with Drywall.js - the actual permissions are key/value based. They can be shared by group and also overridden granularly on the administrator level.

Although it's not exactly RBAC I'm hoping that reviewing another approach helps you get closer to achieving your goal.

Project Overview:

Mongoose Schemas:

Specifically Look At:

  • /schema/User.js
  • /schema/Admin.js
  • /schema/AdminGroup.js
  • /schema/Account.js

I'm interested to see what you come up with.


Your design is almost entirely dependent on the behavior of your application. What I would recommend based on the information you've provided here is to keep the data in key/values, not in the database--CRUD operations aren't going to change, so there's no reason to put that in the db. The 'resources' are classes that you've already built into your code, so you don't need to duplicate it in the db either.