-
Notifications
You must be signed in to change notification settings - Fork 89
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
New Hooks: variableMulti and variableWhitelist #659
Comments
Thanks for this PR! I also felt the lack of conditional multi as in #651. What do you think of this approach for import { isProvider } from 'feathers-hooks-common';
const multiHook = multi(isProvider('server')); or more generally a cb: import { isProvider } from 'feathers-hooks-common';
const multiHook = multi(context => context.params.isAuthenticated); |
Yep. That makes total sense. I suppose For example const whitelistHook = whitelist(context => {
if (context.params.isAuthenticated) {
return [...]
} else {
return [...]
}
}); |
Yes, I think that would be the most flexible approach because it also allows more complex situations with I see another problem for |
You are right, there is no native support for "all operators" in |
I thought about this recently because of sequelize' |
Database adapters offer us options to control
multi
andwhitelist
, but they do not provide us a way to change these options per some variable. For example, we may want to allowmulti
on the server but not on REST and Socket.You can see some related issues here:
feathersjs/feathers#2550
#651
My first thought was something similar to
disallow
for controlling these per provider. Something likeNote that to use these, you would need to set
multi: true
andwhitelist: [...all possible operators]
in the service options, then this hook would regulate them per provider.I don't use the
iff
hooks much, but it may be better to create more generic multi/whitelist hooks and use those instead. See: #651I am open to create a PR for these two hooks. But, which style would you all prefer? Hooks like described above or hooks that would be used in
iff
?The text was updated successfully, but these errors were encountered: