allcount / allcountjs

Rapid application development framework for Node.js
http://allcountjs.com
MIT License
402 stars 83 forks source link

User Access Control #99

Open CreativeWolf opened 8 years ago

CreativeWolf commented 8 years ago

Right now the User Access Control is handled by Views by filtering data based on user, although guessing a document ID is far fetched, I'm paranoid about the fact that it can be accessed if that possibility is proven right.

Point in case, if the Document ID is known, one use is able to access another user's job application.

This should be addressed programatically, where a conditional check should be possible to check if the entity belongs to the user before access to that entity is given.

These are two ways I think it can be approaced:

  1. In permissions there can be a owner definition
  2. In CRUD Hooks a beforeRead can be introduced where a condition like this if (Entity.owner.id !== User.id) { throw new Error("Forbidden"); }