Class: Autocomplete::DeployKeysWithWriteAccessFinder
- Inherits:
-
Object
- Object
- Autocomplete::DeployKeysWithWriteAccessFinder
- Defined in:
- app/finders/autocomplete/deploy_keys_with_write_access_finder.rb
Overview
Finder for retrieving deploy keys to use for autocomplete data sources.
Instance Attribute Summary collapse
-
#current_user ⇒ Object
readonly
Returns the value of attribute current_user.
-
#project ⇒ Object
readonly
Returns the value of attribute project.
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(current_user, project) ⇒ DeployKeysWithWriteAccessFinder
constructor
A new instance of DeployKeysWithWriteAccessFinder.
Constructor Details
#initialize(current_user, project) ⇒ DeployKeysWithWriteAccessFinder
Returns a new instance of DeployKeysWithWriteAccessFinder.
8 9 10 11 |
# File 'app/finders/autocomplete/deploy_keys_with_write_access_finder.rb', line 8 def initialize(current_user, project) @current_user = current_user @project = project end |
Instance Attribute Details
#current_user ⇒ Object (readonly)
Returns the value of attribute current_user.
6 7 8 |
# File 'app/finders/autocomplete/deploy_keys_with_write_access_finder.rb', line 6 def current_user @current_user end |
#project ⇒ Object (readonly)
Returns the value of attribute project.
6 7 8 |
# File 'app/finders/autocomplete/deploy_keys_with_write_access_finder.rb', line 6 def project @project end |
Instance Method Details
#execute ⇒ Object
13 14 15 16 17 18 19 |
# File 'app/finders/autocomplete/deploy_keys_with_write_access_finder.rb', line 13 def execute return DeployKey.none if project.nil? raise Gitlab::Access::AccessDeniedError unless current_user.can?(:admin_project, project) project.deploy_keys.merge(DeployKeysProject.with_write_access) end |