how to tell acl a resource is public
Hey guys ,
am having a hard time when defining acl as follows and its not working = replays with User is anuthoerized. can you give a link or an example please. this will make acl popular with the basic docuematations.
i have an api
http://localhost:3333/docs
and i have defined acl as follows on app.js
acl.allow('guest', '/docs/', ['get','put', 'delete']);
app.get('/docs/', acl.middleware(), function (req, res) {
console.log(req);
});
acl.allow('public', ['/', '/docs/', '/api-docs/'], 'view');
acl.whatResources('public',function(err,resources){
console.log(resources);
})
but when i try to access localhost:3333/docs/ it throws me error ? how do i prevent that from happening.
Hello,
You have to override the userId params:
const user_id = (req) => (req.feathers.user) ? req.feathers.user.id : 'anonymous'
(Save previously the anonymous user un db)
Could you provide the full corrected example? I'm a little confused by how you implement the solution.