Don't expose all namespace fields in API
This commit is contained in:
parent
845e2d3667
commit
d05dd81b99
2 changed files with 14 additions and 2 deletions
|
@ -88,7 +88,7 @@ module API
|
|||
expose :shared_runners_enabled
|
||||
expose :lfs_enabled?, as: :lfs_enabled
|
||||
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 :avatar_url
|
||||
expose :star_count, :forks_count
|
||||
|
@ -391,7 +391,7 @@ module API
|
|||
end
|
||||
|
||||
class Namespace < Grape::Entity
|
||||
expose :id, :path, :kind
|
||||
expose :id, :name, :path, :kind
|
||||
end
|
||||
|
||||
class MemberAccess < Grape::Entity
|
||||
|
|
|
@ -630,6 +630,18 @@ describe API::Projects, api: true do
|
|||
expect(json_response['name']).to eq(project.name)
|
||||
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
|
||||
context 'all projects' do
|
||||
before { project.team << [user, :master] }
|
||||
|
|
Loading…
Reference in a new issue