-
-
Notifications
You must be signed in to change notification settings - Fork 751
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
protect()-hook does not hide the protected field in realtime events when patching multiple records #1809
Comments
Same problem. Is this an expected behavior ? Thanks. |
@GautierT it's not expected behavior. @Tr3ffel thanks for the reproduction. When you get a moment if you inspect/debug the response as it comes through this block of code, that will probably help determine the cause of the problem. The dispatch resolvers in Feathers dove are the official solution to some of the issues with using the In the meantime, it seems like |
Also, you can see an example dispatch resolver in use, here: https://dove.feathersjs.com/guides/basics/schemas.html#adding-a-user-avatar. Don't be intimidated by resolvers. They might look complicated because they're different, but they save a lot of code compared to hooks in the right scenarios. Basically, resolvers are great any time you need to modify or populate based on object properties. Generally, they don't cause side effects other than maybe making a request to pull in some data to use for the property value. Hooks still work the same as they always have, but I've found the majority of my service hooks have been replaced by resolvers. Hooks are great for executing side effects like logging, or dynamically creating a connection to a database. |
This has been fixed via #3073 and published in v4.5.16 |
I'm currently building a feathersjs application where I need to patch multiple user inside some service method. Because
protect('password')
is set in the user hooks I would expect that the password would be hidden in the realtime events, which is not the case. (I'm using the mongoose feathers adapter)Steps to reproduce
users.hooks.js
users.service.js
some-service.class.js
channel.js
When calling
app.service('some-service').create(data, params)
the handler on the client side:returns the following user objects:
Event
Event
Expected behavior
I'm not sure if I missed something but i would expect that the password field would also be hidden inside the 2. Event.
I've created a repo where the issue can be reproduced:
https://github.com/Tr3ffel/feathers-update-many-bug
The text was updated successfully, but these errors were encountered: