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

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRubén Dávila <ruben@gitlab.com>2017-09-28 03:45:19 +0300
committerRubén Dávila <ruben@gitlab.com>2017-10-05 16:25:27 +0300
commit9b4990a4d71b057f0fec14399cd1f2a421901963 (patch)
treee6e522b10f17325d0a8fcc86a2020210f285086b /app/models/gpg_key_subkey.rb
parenta41e7e0105e238161ba697ebf26d8554ae59d295 (diff)
Associate GgpSignature with GpgKeySubkey if comes from a subkey
Additionally we're delegating missing method calls on GpgKeySubkey to GpgKey since most of the info required when verifying a signature is found on GpgKey which is the parent of GpgKeySubkey
Diffstat (limited to 'app/models/gpg_key_subkey.rb')
-rw-r--r--app/models/gpg_key_subkey.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/app/models/gpg_key_subkey.rb b/app/models/gpg_key_subkey.rb
index 4f967f1e47c..8222e5606aa 100644
--- a/app/models/gpg_key_subkey.rb
+++ b/app/models/gpg_key_subkey.rb
@@ -1,3 +1,18 @@
class GpgKeySubkey < ActiveRecord::Base
+ include ShaAttribute
+
+ sha_attribute :keyid
+ sha_attribute :fingerprint
+
belongs_to :gpg_key
+
+ def method_missing(m, *a, &b)
+ return super unless gpg_key.respond_to?(m)
+
+ gpg_key.public_send(m, *a, &b) # rubocop:disable GitlabSecurity/PublicSend
+ end
+
+ def respond_to_missing?(method, include_private = false)
+ gpg_key.respond_to?(method, include_private) || super
+ end
end