diff options
author | Rubén Dávila <ruben@gitlab.com> | 2017-09-28 03:45:19 +0300 |
---|---|---|
committer | Rubén Dávila <ruben@gitlab.com> | 2017-10-05 16:25:27 +0300 |
commit | 9b4990a4d71b057f0fec14399cd1f2a421901963 (patch) | |
tree | e6e522b10f17325d0a8fcc86a2020210f285086b /app/models/gpg_key_subkey.rb | |
parent | a41e7e0105e238161ba697ebf26d8554ae59d295 (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.rb | 15 |
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 |