diff options
author | Lin Jen-Shin <godfat@godfat.org> | 2016-11-16 20:31:08 +0800 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2016-11-16 20:31:23 +0800 |
commit | a9765fb47fbbd1e1070434fc06cc76b25a42caa6 (patch) | |
tree | 30ffc7e93c5721c6ac7743daf6f705a4566efa98 /app/models/deploy_key.rb | |
parent | 721478123068c6718ec73c72a7b7d32c00c816df (diff) | |
download | gitlab-ce-a9765fb47fbbd1e1070434fc06cc76b25a42caa6.tar.gz |
Introduce has_access_to? so that we could reuse it
Feedback:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/7383#note_18439108
Diffstat (limited to 'app/models/deploy_key.rb')
-rw-r--r-- | app/models/deploy_key.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/app/models/deploy_key.rb b/app/models/deploy_key.rb index 503398f5cca..aaacbd28470 100644 --- a/app/models/deploy_key.rb +++ b/app/models/deploy_key.rb @@ -21,7 +21,11 @@ class DeployKey < Key self.private? end + def has_access_to?(project) + projects.include?(project) + end + def can_push_to?(project) - can_push? && projects.include?(project) + can_push? && has_access_to?(project) end end |