set_system_information.rb 923 B

12345678910111213141516171819202122232425262728
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. module Gql::Mutations
  3. class GuidedSetup::SetSystemInformation < BaseMutation
  4. description 'Sets basic system information'
  5. argument :input, Gql::Types::Input::SystemInformationType, 'Basic system information'
  6. field :success, Boolean, description: 'System setup information updated successfully?'
  7. def self.authorize(_obj, ctx)
  8. ctx.current_user.permissions?('admin.wizard')
  9. end
  10. def resolve(input:)
  11. begin
  12. # TODO: what are we doing with required string parameter which only holding whitespaces?
  13. set_system_information = Service::System::SetSystemInformation.new(data: input.to_h)
  14. set_system_information.execute
  15. rescue Exceptions::InvalidAttribute => e
  16. return error_response({ message: e.message, field: e.attribute })
  17. end
  18. { success: true }
  19. end
  20. end
  21. end