Commit d05dd81b authored by Markus Koller's avatar Markus Koller

Don't expose all namespace fields in API

parent 845e2d36
...@@ -88,7 +88,7 @@ module API ...@@ -88,7 +88,7 @@ module API
expose :shared_runners_enabled expose :shared_runners_enabled
expose :lfs_enabled?, as: :lfs_enabled expose :lfs_enabled?, as: :lfs_enabled
expose :creator_id expose :creator_id
expose :namespace expose :namespace, using: 'API::Entities::Namespace'
expose :forked_from_project, using: Entities::BasicProjectDetails, if: lambda{ |project, options| project.forked? } expose :forked_from_project, using: Entities::BasicProjectDetails, if: lambda{ |project, options| project.forked? }
expose :avatar_url expose :avatar_url
expose :star_count, :forks_count expose :star_count, :forks_count
...@@ -391,7 +391,7 @@ module API ...@@ -391,7 +391,7 @@ module API
end end
class Namespace < Grape::Entity class Namespace < Grape::Entity
expose :id, :path, :kind expose :id, :name, :path, :kind
end end
class MemberAccess < Grape::Entity class MemberAccess < Grape::Entity
......
...@@ -630,6 +630,18 @@ describe API::Projects, api: true do ...@@ -630,6 +630,18 @@ describe API::Projects, api: true do
expect(json_response['name']).to eq(project.name) expect(json_response['name']).to eq(project.name)
end end
it 'exposes namespace fields' do
get api("/projects/#{project.id}", user)
expect(response).to have_http_status(200)
expect(json_response['namespace']).to eq({
'id' => user.namespace.id,
'name' => user.namespace.name,
'path' => user.namespace.path,
'kind' => user.namespace.kind,
})
end
describe 'permissions' do describe 'permissions' do
context 'all projects' do context 'all projects' do
before { project.team << [user, :master] } before { project.team << [user, :master] }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment