Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib/api
diff options
context:
space:
mode:
authorValery Sizov <vsv2711@gmail.com>2015-10-14 14:15:34 +0300
committerValery Sizov <vsv2711@gmail.com>2015-10-14 14:15:34 +0300
commit4117d9b310cbcdc1967163273ad63495542046cb (patch)
treeba28553726f93f961044b82589cc90088f87749c /lib/api
parent82da19cecd6390d2372bad36da0a9f89b21abb38 (diff)
parent024e34e94d973842cf02d9177e9ec52bd587ceee (diff)
Merge branch 'feature/api_hide_service_password' of gitlab.com:cernvcs/gitlab-ce
Diffstat (limited to 'lib/api')
-rw-r--r--lib/api/entities.rb12
-rw-r--r--lib/api/services.rb2
2 files changed, 13 insertions, 1 deletions
diff --git a/lib/api/entities.rb b/lib/api/entities.rb
index 519072d0157..883a5e14b17 100644
--- a/lib/api/entities.rb
+++ b/lib/api/entities.rb
@@ -262,6 +262,18 @@ module API
expose :notification_level
end
+ class ProjectService < Grape::Entity
+ expose :id, :title, :created_at, :updated_at, :active
+ expose :push_events, :issues_events, :merge_requests_events, :tag_push_events, :note_events
+ # Expose serialized properties
+ expose :properties do |service, options|
+ field_names = service.fields.
+ select { |field| options[:include_passwords] || field[:type] != 'password' }.
+ map { |field| field[:name] }
+ service.properties.slice(*field_names)
+ end
+ end
+
class ProjectWithAccess < Project
expose :permissions do
expose :project_access, using: Entities::ProjectAccess do |project, options|
diff --git a/lib/api/services.rb b/lib/api/services.rb
index 6727e80ac1e..203f04a6259 100644
--- a/lib/api/services.rb
+++ b/lib/api/services.rb
@@ -57,7 +57,7 @@ module API
# GET /project/:id/services/gitlab-ci
#
get ':id/services/:service_slug' do
- present project_service
+ present project_service, with: Entities::ProjectService, include_passwords: current_user.is_admin?
end
end
end