fix the middleware first param [numPathComponents]#159
fix the middleware first param [numPathComponents]#159caosbad wants to merge 1 commit intoOptimalBits:masterfrom
Conversation
|
I don't think you're supposed to change the resource name, who's supposed to be a path. If you do it like you did, you'll come across some trouble later, like having resources with the same name in different path. And the change you're suggesting will probably break everyone's implementation of node-acl. |
|
@jonmassot Oh, I don't want to break everyone's implementation of node-acl ,maybe I haven't understood the doc or code yet ,I will run some test in my project and find a appropriate way to use node-acl,thanks for your reply. |
|
Can you provide a bit more details on what you're trying to accomplish? That way, I might be able to help you. Cause I'm not too sure on why you want to protect only 1 part of the resource. The only I can guess is that you might have |
|
Yeah, I thought I could manage the path and source together, so that fewer code to config the auth. If I write this config code acl.allow(
[
{
roles: ['student'],
allows: [
{ resources: 'cards', permissions: ['get', 'put', 'post'] },
{ resources: ['courses', 'packs'], permissions: ['get'] }
]
}
]
);When I use middleware to split the path contain |
|
IMO, wishing for less code regarding authentication is just another way to wish for trouble later on. For example, Can every students |
|
You are right,Thank you very much! |
Hello,Im very appreciate you write such a wonderful moduel.
I found some wrong when I use the middleware.
Here is my code
I need the ACL to split the resource named
coursesand I try to useacl.middleware(2)' to split the url, but when I debug the code . I could not get the right result ,the middleware function use that code to handle the url in line 630 ofacl/lib/acl.js`It return the resource is still
'/v1/courses'in the code above.I check the readme doc found this:
So , I guess the right code might be this:
Then I can get
coursesresource that I expected.Hope it help,have a good day!