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

Ignore prefix in middleware #64

Open
FreakTheMighty opened this issue Sep 2, 2014 · 6 comments
Open

Ignore prefix in middleware #64

FreakTheMighty opened this issue Sep 2, 2014 · 6 comments

Comments

@FreakTheMighty
Copy link
Contributor

I would like to add an option to the expressjs middleware to ignore a url prefix. This is useful if you are protecting resources that are beneath a namespace such as 'api/v1/posts/1'. In this case it makes sense to store the resource as 'posts/1' in the access control list rather than the full url.

For my own project I've made this change.

FreakTheMighty@6a6602e

I've also noted in my commit that I don't think the options should be passed as positional arguments as there are cases where you would want to specify some and not others. It looks like the contract module would need to be updated to support keyword arguments, is that correct?

@manast
Copy link
Member

manast commented Sep 2, 2014

It is a nice addition, but it must be done so that it keeps backwards compatibility, otherwise I will get a lot of emails from angry users :)

@FreakTheMighty
Copy link
Contributor Author

I can think of a few options. We can add a new middleware method that wraps the old one, but exposes the new interface. We can add the new option to the end of the current function interface. How would you like to do it?

@manast
Copy link
Member

manast commented Sep 3, 2014

I am happy with any of those approaches, take your pick :)

This was referenced Sep 30, 2014
@futurechan
Copy link

@FreakTheMighty i think would work for you: https://github.com/futurechan/node_acl-mem-regexp

It doesn't ignore prefixes, but I am able to block access to root resources and yet allow access to the subresource with regexes.

*it uses the memory backend exclusively though

@FreakTheMighty
Copy link
Contributor Author

@futurechan thanks for the reference.

@futurechan
Copy link

@FreakTheMighty if you don't mind, could you take a look at this and let me know what you think? https://github.com/futurechan/Connect-AccessControl

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

3 participants