Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to tell acl a resource is public #210

Open
dadenewyyt opened this issue Sep 29, 2016 · 2 comments
Open

how to tell acl a resource is public #210

dadenewyyt opened this issue Sep 29, 2016 · 2 comments

Comments

@dadenewyyt
Copy link

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.

@dimsolution
Copy link

dimsolution commented Feb 11, 2017

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)

@ajsnyde
Copy link

ajsnyde commented Jun 6, 2017

Could you provide the full corrected example? I'm a little confused by how you implement the solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants