diff --git a/app/graphql/types/base_field.rb b/app/graphql/types/base_field.rb index fcb2d1097..a1a6c1365 100644 --- a/app/graphql/types/base_field.rb +++ b/app/graphql/types/base_field.rb @@ -1,12 +1,12 @@ module Types class BaseField < GraphQL::Schema::Field - def initialize(*args, require_admin: false, **kwargs, &block) - @require_admin = require_admin + def initialize(*args, internal: false, **kwargs, &block) + @internal = internal super(*args, **kwargs, &block) end def visible?(ctx) - super && (@require_admin ? ctx[:admin] : true) + super && (@internal ? ctx[:internal_use] : true) end end end diff --git a/app/graphql/types/demarche_descriptor_type.rb b/app/graphql/types/demarche_descriptor_type.rb index b351ea4b4..0a8a28d0a 100644 --- a/app/graphql/types/demarche_descriptor_type.rb +++ b/app/graphql/types/demarche_descriptor_type.rb @@ -24,7 +24,7 @@ Cela évite l’accès récursif aux dossiers." field :cadre_juridique, String, null: true field :deliberation, String, null: true - field :dossiers_count, Int, null: false, require_admin: true + field :dossiers_count, Int, null: false, internal: true def service Loaders::Record.for(Service).load(procedure.service_id) diff --git a/app/graphql/types/query_type.rb b/app/graphql/types/query_type.rb index e6f871e46..6e8c3ce14 100644 --- a/app/graphql/types/query_type.rb +++ b/app/graphql/types/query_type.rb @@ -14,7 +14,7 @@ module Types argument :number, Int, "Numéro du groupe instructeur.", required: true end - field :demarches_publiques, DemarcheDescriptorType.connection_type, null: false, require_admin: true, max_page_size: 30 + field :demarches_publiques, DemarcheDescriptorType.connection_type, null: false, internal: true, max_page_size: 30 def demarches_publiques Procedure.opendata diff --git a/app/services/demarches_publiques_export_service.rb b/app/services/demarches_publiques_export_service.rb index 7dbdafc58..1afcb01af 100644 --- a/app/services/demarches_publiques_export_service.rb +++ b/app/services/demarches_publiques_export_service.rb @@ -23,7 +23,7 @@ class DemarchesPubliquesExportService private def execute_query(cursor: nil) - result = API::V2::Schema.execute(query, variables: { cursor: cursor }, context: { internal_use: true, admin: true }) + result = API::V2::Schema.execute(query, variables: { cursor: cursor }, context: { internal_use: true }) raise DemarchesPubliquesExportService::Error.new(result["errors"]) if result["errors"] @graphql_data = result["data"] end