gitlab-org--gitlab-foss/app/models/gpg_signature.rb

38 lines
702 B
Ruby
Raw Normal View History

class GpgSignature < ActiveRecord::Base
2017-07-20 09:44:15 -04:00
include ShaAttribute
2017-08-31 14:45:29 -04:00
include IgnorableColumn
ignore_column :valid_signature
2017-07-20 09:44:15 -04:00
sha_attribute :commit_sha
sha_attribute :gpg_key_primary_keyid
enum verification_status: {
unverified: 0,
verified: 1,
same_user_different_email: 2,
other_user: 3,
unverified_key: 4,
unknown_key: 5
}
belongs_to :project
belongs_to :gpg_key
validates :commit_sha, presence: true
validates :project_id, presence: true
validates :gpg_key_primary_keyid, presence: true
2017-07-06 04:17:09 -04:00
def gpg_key_primary_keyid
super&.upcase
end
2017-07-06 04:17:09 -04:00
def commit
project.commit(commit_sha)
end
def gpg_commit
Gitlab::Gpg::Commit.new(commit)
end
end