Put graphql behind a feature flag

This commit is contained in:
Paul Chavard 2019-09-19 13:35:21 +02:00
parent eb7aba18e6
commit 5a7e415474
3 changed files with 3 additions and 2 deletions

View file

@ -16,7 +16,7 @@ module Types
end end
end end
if administrateur if administrateur && Flipper.enabled?(:administrateur_graphql, administrateur.user)
context[:authorized][demarche.id] = true context[:authorized][demarche.id] = true
true true
end end

View file

@ -26,6 +26,7 @@ end
# A list of features to be deployed on first push # A list of features to be deployed on first push
features = [ features = [
:administrateur_champ_integer_number, :administrateur_champ_integer_number,
:administrateur_graphql,
:administrateur_web_hook, :administrateur_web_hook,
:insee_api_v3, :insee_api_v3,
:instructeur_bypass_email_login_token, :instructeur_bypass_email_login_token,

View file

@ -219,7 +219,7 @@ Rails.application.routes.draw do
# API # API
# #
authenticated :user, lambda { |user| user.administrateur_id } do authenticated :user, lambda { |user| user.administrateur_id && Flipper.enabled?(:administrateur_graphql, user) } do
mount GraphiQL::Rails::Engine, at: "/graphql", graphql_path: "/api/v2/graphql", via: :get mount GraphiQL::Rails::Engine, at: "/graphql", graphql_path: "/api/v2/graphql", via: :get
end end