diff options
author | Douwe Maan <douwe@gitlab.com> | 2015-03-27 14:43:48 +0100 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2015-04-03 12:23:20 +0200 |
commit | edc4a56d26792b5b5bac21f45948412675ad7ebb (patch) | |
tree | 5691320e58507e134a2f026f8f4e8054821edf50 /app/models/deploy_keys_project.rb | |
parent | 9157985cfce1391973673ea278dc7506a90f8f53 (diff) | |
download | gitlab-ce-edc4a56d26792b5b5bac21f45948412675ad7ebb.tar.gz |
Allow admin to create public deploy keys that are accessible to any project.
Diffstat (limited to 'app/models/deploy_keys_project.rb')
-rw-r--r-- | app/models/deploy_keys_project.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/app/models/deploy_keys_project.rb b/app/models/deploy_keys_project.rb index 7e88903b9af..5f679f4b3ef 100644 --- a/app/models/deploy_keys_project.rb +++ b/app/models/deploy_keys_project.rb @@ -22,6 +22,10 @@ class DeployKeysProject < ActiveRecord::Base private def destroy_orphaned_deploy_key - self.deploy_key.destroy if self.deploy_key.deploy_keys_projects.length == 0 + # Public deploy keys are never automatically deleted + return if self.deploy_key.public? + return if self.deploy_key.deploy_keys_projects.length > 0 + + self.deploy_key.destroy end end |