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_key.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_key.rb')
-rw-r--r-- | app/models/deploy_key.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/app/models/deploy_key.rb b/app/models/deploy_key.rb index 570f5e91c13..1770dde320f 100644 --- a/app/models/deploy_key.rb +++ b/app/models/deploy_key.rb @@ -7,6 +7,7 @@ # created_at :datetime # updated_at :datetime # key :text +# public :boolean default(FALSE) # title :string(255) # type :string(255) # fingerprint :string(255) @@ -17,4 +18,10 @@ class DeployKey < Key has_many :projects, through: :deploy_keys_projects scope :in_projects, ->(projects) { joins(:deploy_keys_projects).where('deploy_keys_projects.project_id in (?)', projects) } + scope :are_public, -> { where(public: true) } + scope :are_private, -> { where(public: false) } + + def private? + !public? + end end |