list.rb 480 B

123456789101112131415161718
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. module Gql::Queries
  3. class User::Current::Avatar::List < BaseQuery
  4. description 'Fetch available avatar list of the currently logged-in user.'
  5. type [Gql::Types::AvatarType], null: true
  6. def self.authorize(_obj, ctx)
  7. ctx.current_user.permissions?('user_preferences.avatar')
  8. end
  9. def resolve(...)
  10. Avatar.list('User', context.current_user.id, raw: true)
  11. end
  12. end
  13. end