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

Conditionally allow introspection #569

Merged
merged 1 commit into from
Feb 14, 2023
Merged

Conversation

pavelnikolov
Copy link
Member

@pavelnikolov pavelnikolov commented Feb 14, 2023

This PR adds a schema option which conditionally allows introspection based on a filter function. For example the below logic would be possible:

filter := func (ctx context.Context) bool {
    u, ok := user.FromContext(ctx)
    return ok && u.IsAdmin()
}
graphql.RestrictIntrospection(filter)

fixes: #556

@pavelnikolov pavelnikolov self-assigned this Feb 14, 2023
@pavelnikolov pavelnikolov added this to the v1.6.0 milestone Feb 14, 2023
@pavelnikolov pavelnikolov force-pushed the conditional-introspection branch from 4b82439 to 162273c Compare February 14, 2023 09:57
@pavelnikolov pavelnikolov force-pushed the conditional-introspection branch from 162273c to 68a0106 Compare February 14, 2023 10:12
@pavelnikolov pavelnikolov merged commit e9a5ec2 into master Feb 14, 2023
@pavelnikolov pavelnikolov deleted the conditional-introspection branch February 14, 2023 10:24
KNiepok pushed a commit to spacelift-io/graphql-go that referenced this pull request Feb 28, 2023
KNiepok pushed a commit to spacelift-io/graphql-go that referenced this pull request Feb 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Conditionally Disable Introspection
1 participant