Tuesday, 25 April 2017

Sequelize - Is there any way to do Data Abstraction/Filtering?

First at all, I'm sorry if I'm re-posting, but I couldn't find anything related.

I'm working on a application that handle very sensitive data. I want to filter this data by user's role.

I've did this (in another job) using Doctrine Filters, but I can't found any information in how to do this using Sequelize (over PostgreSQL).

Eg:

sensitive_information:

| user_id | sensible_value |
+---------+----------------+
| 1       | something      |
| 2       | something_else |

I need this:

SELECT *
  FROM sensitive_information
  WHERE user_id = 1; /** I need this to be added automatically in all
                         queries to sensitive_information */

So, user 1 never will see information of another user. That's the goal.

Is any possible? I'm open to suggestions.

Thanks in advance.



via Abel Osorio

No comments:

Post a Comment