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

populateUser: allow option to populate without db call. #92

Closed
marshallswain opened this Issue Mar 2, 2016 · 5 comments

Comments

Projects
None yet
2 participants
@marshallswain
Copy link
Member

marshallswain commented Mar 2, 2016

If only the id is needed, we can offer the option to only use it on the hook.params.user and skip the call to the db. Not sure what the API should look like.

@ekryski

This comment has been minimized.

Copy link
Member

ekryski commented Mar 2, 2016

Well, you already have the id returned alongside the token when you authenticate so were you thinking that you would not want the user populated in the successful auth response?

@marshallswain

This comment has been minimized.

Copy link
Member Author

marshallswain commented Mar 2, 2016

In one of my apps, all I want in hook.params.user is {_id: <id>}, so I want the populateUser hook to only populate that much into hook.params.user.

@marshallswain

This comment has been minimized.

Copy link
Member Author

marshallswain commented Mar 2, 2016

That's for the majority of the services. For a couple of them I still need the full user.

@ekryski ekryski added the Feature label Mar 26, 2016

@ekryski

This comment has been minimized.

Copy link
Member

ekryski commented Apr 3, 2016

Thinking about this a bit more and after revising the hooks I would say that if you just want the id then just write a quick custom hook? It's not really populateUser anymore then is it?

I guess the other option would be to pass on option like {idOnly: true} or something which just grabs the id from the token payload. Personally, I feel like that is maybe a bit more custom to your app so it should probably just be a custom hook. Open to being proven wrong though...

@marshallswain

This comment has been minimized.

Copy link
Member Author

marshallswain commented Apr 3, 2016

This is sort of a micro-optimization, anyway. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.