diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-06-03 19:49:04 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-06-03 19:49:04 +0300 |
commit | 50e8d6c0c03b11cc539cca37aea782538ee77262 (patch) | |
tree | d2eb9faf5cefff2bf3bf1a2951afd2c28fa0a104 /app | |
parent | 0447c731ba392641145ac53cb8c50fab5392cda7 (diff) | |
download | gitlab-ce-50e8d6c0c03b11cc539cca37aea782538ee77262.tar.gz |
Add api to collect owned user projects. Api deploy_key.create: Enable deploy key if it exist in other owned project
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/deploy_keys_controller.rb | 2 | ||||
-rw-r--r-- | app/models/user.rb | 4 |
2 files changed, 5 insertions, 1 deletions
diff --git a/app/controllers/deploy_keys_controller.rb b/app/controllers/deploy_keys_controller.rb index c413c2fd1d9..1c7e4c1b37a 100644 --- a/app/controllers/deploy_keys_controller.rb +++ b/app/controllers/deploy_keys_controller.rb @@ -54,6 +54,6 @@ class DeployKeysController < ProjectResourceController protected def available_keys - @available_keys ||= DeployKey.in_projects(current_user.owned_projects).uniq + @available_keys ||= current_user.owned_deploy_keys end end diff --git a/app/models/user.rb b/app/models/user.rb index c6dd0868ba7..82a49c8dcca 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -352,4 +352,8 @@ class User < ActiveRecord::Base def ldap_user? extern_uid && provider == 'ldap' end + + def owned_deploy_keys + DeployKey.in_projects(self.owned_projects).uniq + end end |