macros.rb 518 B

12345678910111213141516171819
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. module Gql::Queries
  3. class Macros < BaseQuery
  4. description 'Returns a list of macros'
  5. argument :group_id, GraphQL::Types::ID, description: 'The group of the macros to look for.', loads: Gql::Types::GroupType
  6. type [Gql::Types::MacroType], null: false
  7. def self.authorize(_obj, ctx)
  8. ctx.current_user.permissions?('ticket.agent')
  9. end
  10. def resolve(group:)
  11. Macro.available_in_groups(group)
  12. end
  13. end
  14. end