@Abhishiv: for this task, I would follow some form of agreement to set field access.
For an object like the following:
{ name : "me", user : "me01234", salary : "100", address : "123 Nowhere drive" }
I would add permissions by doing something like this:
{ name : "me", user : "me01234", salary : "100", address : "123 Nowhere drive" p_salary : [ 'g/accounting', 'g/management', 'u/owner' ] p_address : [ 'g/accounting', 'g/hr', 'u/me' ] }
Under these conventions, you can support document-level access permissions. And it's pretty easy to figure out how to program such a thing.
Now you usually need access rights to both the object and the collection itself. This makes the whole process much drier. For such a thing, I would simply create a collection of "permissions" that contains the default permissions for each other collection in the database.
On top of my head, I donβt know of any structure that makes it out of the box. I would look at Mongoid and MongoMapper and see if this type of parts is suitable for the plugin.
Gates vp
source share