I'm currently working on a project (SailsJS 0.11) with different databases. All my users have different read permissions on those databases. For example :
Therefore, I would like to modify my models connection based on the user which is querying them. Is that possible ? How would you do that ?
Thanks for reading and have a nice day !
In the current version of sails 0.11.x, this is not possible.
You could create a set of models around each connection and change what model your referencing based on each user. You can keep the code DRY, but importing your models definitions from a single place, but have them reference if their on the writeDatabase or the readDatabase. For instance, you could create the user model twice. userWrite.js & userRead.js, each one can import the same model definition with the exception that each references a different db connection.