unlock.rb 655 B

1234567891011121314151617181920212223242526
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. module Gql::Mutations
  3. class System::Setup::Unlock < BaseMutation
  4. RESOURCE = 'Zammad::System::Setup'.freeze
  5. argument :value, String, 'Critical section resource value.', required: true
  6. description 'Unlock critical section, system setup.'
  7. field :success, Boolean, 'Success.', null: true
  8. def self.authorize(...)
  9. true
  10. end
  11. def resolve(value:)
  12. return { success: false } if !Service::ExecuteLockedBlock.locked?(RESOURCE)
  13. Service::ExecuteLockedBlock.unlock({ resource: RESOURCE, value: })
  14. { success: true }
  15. end
  16. end
  17. end