diff options
author | Valery Sizov <vsv2711@gmail.com> | 2015-10-14 14:15:34 +0300 |
---|---|---|
committer | Valery Sizov <vsv2711@gmail.com> | 2015-10-14 14:15:34 +0300 |
commit | 4117d9b310cbcdc1967163273ad63495542046cb (patch) | |
tree | ba28553726f93f961044b82589cc90088f87749c /lib | |
parent | 82da19cecd6390d2372bad36da0a9f89b21abb38 (diff) | |
parent | 024e34e94d973842cf02d9177e9ec52bd587ceee (diff) | |
download | gitlab-ce-4117d9b310cbcdc1967163273ad63495542046cb.tar.gz |
Merge branch 'feature/api_hide_service_password' of gitlab.com:cernvcs/gitlab-cecernvcs_hide_passwrd
Diffstat (limited to 'lib')
-rw-r--r-- | lib/api/entities.rb | 12 | ||||
-rw-r--r-- | lib/api/services.rb | 2 |
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 |