2022-01-26 12:08:38 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
module CommitSignatures
|
|
|
|
class X509CommitSignature < ApplicationRecord
|
|
|
|
include CommitSignature
|
2023-03-04 22:38:38 +05:30
|
|
|
include SignatureType
|
2022-01-26 12:08:38 +05:30
|
|
|
|
|
|
|
belongs_to :x509_certificate, class_name: 'X509Certificate', foreign_key: 'x509_certificate_id', optional: false
|
|
|
|
|
|
|
|
validates :x509_certificate_id, presence: true
|
|
|
|
|
2023-03-04 22:38:38 +05:30
|
|
|
def type
|
|
|
|
:x509
|
|
|
|
end
|
|
|
|
|
2022-01-26 12:08:38 +05:30
|
|
|
def x509_commit
|
|
|
|
return unless commit
|
|
|
|
|
|
|
|
Gitlab::X509::Commit.new(commit)
|
|
|
|
end
|
2023-03-04 22:38:38 +05:30
|
|
|
|
|
|
|
def signed_by_user
|
|
|
|
commit&.committer
|
|
|
|
end
|
2022-01-26 12:08:38 +05:30
|
|
|
end
|
|
|
|
end
|