diff options
author | Steve Azzopardi <steveazz@outlook.com> | 2018-09-05 13:49:39 +0200 |
---|---|---|
committer | Steve Azzopardi <steveazz@outlook.com> | 2018-09-17 11:04:33 +0200 |
commit | 5328f7d15d1d1d7baecb30d7dfa0f9ee160bc64a (patch) | |
tree | 7b1df82b05e6ddb4fd1a729f72dd48e5160414dc /app/serializers | |
parent | cdc4cd09e74bebf52250581dcbd99cfd8848aaeb (diff) | |
download | gitlab-ce-5328f7d15d1d1d7baecb30d7dfa0f9ee160bc64a.tar.gz |
Add runner JSON schema
closes https://gitlab.com/gitlab-org/gitlab-ce/issues/51093
Diffstat (limited to 'app/serializers')
-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 |