Welcome to mirror list, hosted at ThFree Co, Russian Federation.

revoke_service.rb « keys « services « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 42ea9ab73bef44e99121398b2b130cc2d9713052 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# frozen_string_literal: true

module Keys
  class RevokeService < ::Keys::DestroyService
    def execute(key)
      key.transaction do
        unverify_associated_signatures(key)

        raise ActiveRecord::Rollback unless super(key)
      end
    end

    private

    def unverify_associated_signatures(key)
      return unless Feature.enabled?(:revoke_ssh_signatures)

      key.ssh_signatures.each_batch do |batch|
        batch.update_all(
          verification_status: CommitSignatures::SshSignature.verification_statuses[:revoked_key],
          updated_at: Time.zone.now
        )
      end
    end
  end
end

Keys::DestroyService.prepend_mod