I worked on a project where I need to create and assign policies according to access rights / levels for a user in sails.js
Each user can access all levels below his level, for example, the administrator has level 9, and he can access all levels below level 9
Currently, all sails are stored in sails.
API / Policy
and assigned to the controller in
config / policy.js
module.exports.policies = {
UserController: {
"create": ['canCreate'],
"list": ['canRead'],
"show": ['canRead'],
},
AuthController: {
'*': true,
}};
My question is: how can I create dynamic policies based on access levels coming from db
I have googled but nothing was found about how to create dynamic policies in sails.js, so post here.
Appreciate your help on this.
thank