remove_linked_account.rb 807 B

1234567891011121314151617181920212223
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. module Gql::Mutations
  3. class User::Current::RemoveLinkedAccount < BaseMutation
  4. description "Remove a linked account of the current user's profile"
  5. argument :provider, Gql::Types::Enum::AuthenticationProviderType, description: 'Internal name of the provider'
  6. argument :uid, String, description: 'UID of the linked account'
  7. field :success, Boolean, null: false, description: 'Was the linked account removed?'
  8. def self.authorize(_obj, ctx)
  9. ctx.current_user.permissions?('user_preferences.linked_accounts')
  10. end
  11. def resolve(provider:, uid:)
  12. Service::User::RemoveLinkedAccount.new(provider:, uid:, current_user: context.current_user).execute
  13. { success: true }
  14. end
  15. end
  16. end