Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

decodedObjectName and searchPath does not allow to map custom role property #99

Closed
aman2talk opened this issue May 1, 2018 · 4 comments

Comments

@aman2talk
Copy link

Hi
I am using the role propery in my session as req.session.user.role. But As the doc says by default it search the role either req.decoded or req.session. To mach the custom location we can use decodedObjectName searchPath.

I have tried different combinations but still no luck. If explicitly I make the role accessible via req.session.role. It works. But I want to change it to req.session.user.role.

How to achieve this?

Thanks.

@aman2talk
Copy link
Author

Hi,

I just reviewed the module code and realised that Readme.md file is not up to date. The correct property name is roleSearchPath instead of searchPath. If anyone needs to change the path to check for user's role in request object then you can use the it as follows:

acl.config({
    roleSearchPath : 'session.user.role' // whatever value you will pass here will be prefixed with req.
});

@nyambati
Copy link
Owner

nyambati commented May 5, 2018

@aman2talk Thanks for raising this I will update the documentation to avoid further confusion.

@nyambati
Copy link
Owner

nyambati commented May 5, 2018

@aman2talk I have just made the update on PR #100. Thank you for your input.

@aman2talk
Copy link
Author

@nyambati Thanks for the update. Closing the issue.

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

No branches or pull requests

2 participants