Class: DeployKeys::CollectKeysService

Inherits:
Object
  • Object
show all
Defined in:
app/services/deploy_keys/collect_keys_service.rb

Instance Method Summary collapse

Constructor Details

#initialize(project, current_user) ⇒ CollectKeysService

Returns a new instance of CollectKeysService.


5
6
7
8
# File 'app/services/deploy_keys/collect_keys_service.rb', line 5

def initialize(project, current_user)
  @project = project
  @current_user = current_user
end

Instance Method Details

#executeObject


10
11
12
13
14
15
16
17
# File 'app/services/deploy_keys/collect_keys_service.rb', line 10

def execute
  return [] unless current_user && project && user_can_read_project

  project.deploy_keys_projects
    .with_deploy_keys
    .with_write_access
    .map(&:deploy_key)
end