diff options
author | Kamil Trzciński <ayufan@ayufan.eu> | 2018-09-17 18:10:41 +0300 |
---|---|---|
committer | Kamil Trzciński <ayufan@ayufan.eu> | 2018-09-17 18:10:41 +0300 |
commit | 0a4b459d9c010998c7fdaf058bee4323a6f79973 (patch) | |
tree | 95b09dbcd34d458d70cf90f5aeeca29f6c2107b8 /app/serializers/runner_entity.rb | |
parent | 50cb63533ff4d90ae317b20157c3fd824783fd61 (diff) | |
parent | 5328f7d15d1d1d7baecb30d7dfa0f9ee160bc64a (diff) |
Merge branch '51093-add-runner-json-schema-and-factory' into 'master'
Resolve "Add runner JSON schema"
Closes #51093
See merge request gitlab-org/gitlab-ce!21525
Diffstat (limited to 'app/serializers/runner_entity.rb')
-rw-r--r-- | app/serializers/runner_entity.rb | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/app/serializers/runner_entity.rb b/app/serializers/runner_entity.rb index 04ec80e0efa..97e5b336a35 100644 --- a/app/serializers/runner_entity.rb +++ b/app/serializers/runner_entity.rb @@ -5,8 +5,7 @@ class RunnerEntity < Grape::Entity expose :id, :description - expose :edit_path, - if: -> (*) { can?(request.current_user, :admin_build, project) && runner.project_type? } do |runner| + expose :edit_path, if: -> (*) { can_edit_runner? } do |runner| edit_project_runner_path(project, runner) end @@ -17,4 +16,8 @@ class RunnerEntity < Grape::Entity def project request.project end + + def can_edit_runner? + can?(request.current_user, :update_runner, runner) && runner.project_type? + end end |