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

please add functional directives #894

Open
bionicles opened this issue Mar 6, 2021 · 1 comment
Open

please add functional directives #894

bionicles opened this issue Mar 6, 2021 · 1 comment
Labels
enhancement Improvement of existing features or bugfix

Comments

@bionicles
Copy link

Is your feature request related to a problem? Please describe.
I would like to use Juniper but unfortunately, it's critical for my use case to be able to assign functions to custom directives for fine-grained attribute-based access control

Describe the solution you'd like
some way to define a directive and assign that to a function. basically, the same thing as graphql-tools.js directiveResolvers, where you pass a directive-name: function pair, and it just makes a directive for each function. Multiple directives can stack, like middleware, using some next() function

Describe alternatives you've considered
I guess I could use Node.js and graphql-tools but I really want to play with rust because I admire the language. Just can't sacrifice security of these directives

Additional context
an auth directive could perform some function on the user, database tuple, and return a boolean authorized/unauthorized; users could use this to quickly and cleanly secure their api

@bionicles bionicles added the enhancement Improvement of existing features or bugfix label Mar 6, 2021
@mathroc
Copy link

mathroc commented Aug 31, 2021

not the same, but you can do that inside your resolvers : https://graphql-rust.github.io/types/objects/using_contexts.html

and return an Option<T> or FieldResult<T>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improvement of existing features or bugfix
Projects
None yet
Development

No branches or pull requests

2 participants