I need to implement access control in my application. I need to control which columns of which row can be edited by who.
Examples of a rule may be:
Instead of asking a DB to give my application all the information needed to evaluate the possibility of change in the application code, I am currently thinking about trigger based approach for inserts, updates and deletes. In this scenario a triggers, which would fail when operation is not permitted, would be hooked to controlled tables.
Assuming I am able to evaluate all the permissions inside the Postgres DB, I see a few positives:
My questions are:
there is a possibility that after scaling up your DB will be full of triggers which would be difficult to edit or change something. E.g. if you add extra column, you should edit all procedures related to table.
If I've got your question, you're trying to control web application users.
I think better way is to implement restrictions on a PHP side. For instance to create role, which contain array of possible to edit columns. And if this is 'admin', his/her list would contain all columns. Then dynamically create the form according to role configuration, in order to let user see, what he/she can edit.