Merge pull request #7836 from betagouv/fix_broken_graphql_web_interface

fix(web_graphql): corrige l'authorisation d'acces au bac à sable graphql
This commit is contained in:
LeSim 2022-10-03 20:06:52 +02:00 committed by GitHub
commit 298f223d02
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -8,8 +8,13 @@ class API::V2::BaseController < ApplicationController
private
def context
# new token give administrateur_id
if api_token.administrateur?
{ administrateur_id: api_token.administrateur_id }
# web interface (/graphql) give current_administrateur
elsif current_administrateur.present?
{ administrateur_id: current_administrateur.id }
# old token
else
{ token: api_token.token }
end