Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Tatuya Kamada
gitlab-ce
Commits
d05dd81b
Commit
d05dd81b
authored
Nov 29, 2016
by
Markus Koller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't expose all namespace fields in API
parent
845e2d36
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
2 deletions
+14
-2
lib/api/entities.rb
lib/api/entities.rb
+2
-2
spec/requests/api/projects_spec.rb
spec/requests/api/projects_spec.rb
+12
-0
No files found.
lib/api/entities.rb
View file @
d05dd81b
...
...
@@ -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
...
...
spec/requests/api/projects_spec.rb
View file @
d05dd81b
...
...
@@ -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
]
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment