I have been working on a project where i need to create and assign policies according to access rights/levels to user in sails.js
Each user can access all levels below his level, like admin has an level 9 and he can access all levels below level 9
Currently in sails all policies are stored in
api/policies
folder and are assigned to controller in
config/policies.js
module.exports.policies = {
UserController: {
"create": ['canCreate'],
"list": ['canRead'],
"show": ['canRead'],
},
AuthController: {
'*': true,
}};
My Question is how can i make dynamic policies based on access levels coming in from db
I have googled it but found nothing on how to create dynamic policies in sails.js, so posting here.
Appreciate your help on this.
Thanks