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
Boxiang Sun
gitlab-ce
Commits
3d206700
Commit
3d206700
authored
Feb 09, 2017
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dz-nested-groups-api' into 'master'
Nested groups API See merge request !9034
parents
62870a0e
df974814
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
27 additions
and
3 deletions
+27
-3
changelogs/unreleased/dz-nested-groups-api.yml
changelogs/unreleased/dz-nested-groups-api.yml
+4
-0
doc/api/groups.md
doc/api/groups.md
+7
-3
lib/api/entities.rb
lib/api/entities.rb
+1
-0
lib/api/groups.rb
lib/api/groups.rb
+1
-0
spec/requests/api/groups_spec.rb
spec/requests/api/groups_spec.rb
+14
-0
No files found.
changelogs/unreleased/dz-nested-groups-api.yml
0 → 100644
View file @
3d206700
---
title
:
Add nested groups to the API
merge_request
:
9034
author
:
doc/api/groups.md
View file @
3d206700
...
...
@@ -32,7 +32,8 @@ GET /groups
"web_url"
:
"http://localhost:3000/groups/foo-bar"
,
"request_access_enabled"
:
false
,
"full_name"
:
"Foobar Group"
,
"full_path"
:
"foo-bar"
"full_path"
:
"foo-bar"
,
"parent_id"
:
null
}
]
```
...
...
@@ -156,8 +157,9 @@ Example response:
"avatar_url"
:
null
,
"web_url"
:
"https://gitlab.example.com/groups/twitter"
,
"request_access_enabled"
:
false
,
"full_name"
:
"Foobar Group"
,
"full_path"
:
"foo-bar"
,
"full_name"
:
"Twitter"
,
"full_path"
:
"twitter"
,
"parent_id"
:
null
,
"projects"
:
[
{
"id"
:
7
,
...
...
@@ -332,6 +334,7 @@ Parameters:
-
`visibility_level`
(optional) - The group's visibility. 0 for private, 10 for internal, 20 for public.
-
`lfs_enabled`
(optional) - Enable/disable Large File Storage (LFS) for the projects in this group
-
`request_access_enabled`
(optional) - Allow users to request member access.
-
`parent_id`
(optional) - The parent group id for creating nested group.
## Transfer project to group
...
...
@@ -383,6 +386,7 @@ Example response:
"request_access_enabled"
:
false
,
"full_name"
:
"Foobar Group"
,
"full_path"
:
"foo-bar"
,
"parent_id"
:
null
,
"projects"
:
[
{
"id"
:
9
,
...
...
lib/api/entities.rb
View file @
3d206700
...
...
@@ -138,6 +138,7 @@ module API
expose
:web_url
expose
:request_access_enabled
expose
:full_name
,
:full_path
expose
:parent_id
expose
:statistics
,
if: :statistics
do
with_options
format_with:
->
(
value
)
{
value
.
to_i
}
do
...
...
lib/api/groups.rb
View file @
3d206700
...
...
@@ -73,6 +73,7 @@ module API
params
do
requires
:name
,
type:
String
,
desc:
'The name of the group'
requires
:path
,
type:
String
,
desc:
'The path of the group'
optional
:parent_id
,
type:
Integer
,
desc:
'The parent group id for creating nested group'
use
:optional_params
end
post
do
...
...
spec/requests/api/groups_spec.rb
View file @
3d206700
...
...
@@ -179,6 +179,7 @@ describe API::Groups, api: true do
expect
(
json_response
[
'request_access_enabled'
]).
to
eq
(
group1
.
request_access_enabled
)
expect
(
json_response
[
'full_name'
]).
to
eq
(
group1
.
full_name
)
expect
(
json_response
[
'full_path'
]).
to
eq
(
group1
.
full_path
)
expect
(
json_response
[
'parent_id'
]).
to
eq
(
group1
.
parent_id
)
expect
(
json_response
[
'projects'
]).
to
be_an
Array
expect
(
json_response
[
'projects'
].
length
).
to
eq
(
2
)
expect
(
json_response
[
'shared_projects'
]).
to
be_an
Array
...
...
@@ -398,6 +399,19 @@ describe API::Groups, api: true do
expect
(
json_response
[
"request_access_enabled"
]).
to
eq
(
group
[
:request_access_enabled
])
end
it
"creates a nested group"
do
parent
=
create
(
:group
)
parent
.
add_owner
(
user3
)
group
=
attributes_for
(
:group
,
{
parent_id:
parent
.
id
})
post
api
(
"/groups"
,
user3
),
group
expect
(
response
).
to
have_http_status
(
201
)
expect
(
json_response
[
"full_path"
]).
to
eq
(
"
#{
parent
.
path
}
/
#{
group
[
:path
]
}
"
)
expect
(
json_response
[
"parent_id"
]).
to
eq
(
parent
.
id
)
end
it
"does not create group, duplicate"
do
post
api
(
"/groups"
,
user3
),
{
name:
'Duplicate Test'
,
path:
group2
.
path
}
...
...
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