Validate key uniqueness across Key and DeployKey tables
This commit is contained in:
parent
c973fce606
commit
5b4382e12e
3 changed files with 15 additions and 0 deletions
|
@ -1,3 +1,5 @@
|
|||
require 'unique_public_key_validator'
|
||||
|
||||
class DeployKey < ActiveRecord::Base
|
||||
belongs_to :project
|
||||
|
||||
|
@ -10,6 +12,8 @@ class DeployKey < ActiveRecord::Base
|
|||
:uniqueness => true,
|
||||
:length => { :within => 0..5000 }
|
||||
|
||||
validates_with UniquePublicKeyValidator
|
||||
|
||||
before_save :set_identifier
|
||||
after_save :update_repository
|
||||
after_destroy :repository_delete_key
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
require 'unique_public_key_validator'
|
||||
|
||||
class Key < ActiveRecord::Base
|
||||
belongs_to :user
|
||||
|
||||
|
@ -10,6 +12,8 @@ class Key < ActiveRecord::Base
|
|||
:uniqueness => true,
|
||||
:length => { :within => 0..5000 }
|
||||
|
||||
validates_with UniquePublicKeyValidator
|
||||
|
||||
before_save :set_identifier
|
||||
after_save :update_repository
|
||||
after_destroy :repository_delete_key
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue