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
f141711c
Commit
f141711c
authored
Oct 07, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
API: new feature - remove group
parent
073c8a29
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
2 deletions
+29
-2
doc/api/groups.md
doc/api/groups.md
+13
-0
lib/api/groups.rb
lib/api/groups.rb
+16
-2
No files found.
doc/api/groups.md
View file @
f141711c
...
@@ -57,6 +57,19 @@ Parameters:
...
@@ -57,6 +57,19 @@ Parameters:
+
`project_id`
(required) - The ID of a project
+
`project_id`
(required) - The ID of a project
## Remove group
Removes group with all projects inside.
```
DELETE /groups/:id
```
Parameters:
+
`id`
(required) - The ID of a user group
## Group members
## Group members
...
...
lib/api/groups.rb
View file @
f141711c
...
@@ -7,12 +7,14 @@ module API
...
@@ -7,12 +7,14 @@ module API
helpers
do
helpers
do
def
find_group
(
id
)
def
find_group
(
id
)
group
=
Group
.
find
(
id
)
group
=
Group
.
find
(
id
)
if
current_user
.
admin
or
current_user
.
groups
.
include?
group
if
can?
(
current_user
,
:read_group
,
group
)
group
group
else
else
render_api_error!
(
"403 Forbidden -
#{
current_user
.
username
}
lacks sufficient access to
#{
group
.
name
}
"
,
403
)
render_api_error!
(
"403 Forbidden -
#{
current_user
.
username
}
lacks sufficient access to
#{
group
.
name
}
"
,
403
)
end
end
end
end
def
validate_access_level?
(
level
)
def
validate_access_level?
(
level
)
Gitlab
::
Access
.
options_with_owner
.
values
.
include?
level
.
to_i
Gitlab
::
Access
.
options_with_owner
.
values
.
include?
level
.
to_i
end
end
...
@@ -64,6 +66,19 @@ module API
...
@@ -64,6 +66,19 @@ module API
present
group
,
with:
Entities
::
GroupDetail
present
group
,
with:
Entities
::
GroupDetail
end
end
# Remove group
#
# Parameters:
# id (required) - The ID of a group
# Example Request:
# DELETE /groups/:id
delete
":id"
do
group
=
find_group
(
params
[
:id
])
authorize!
:manage_group
,
group
group
.
destroy
end
# Transfer a project to the Group namespace
# Transfer a project to the Group namespace
#
#
# Parameters:
# Parameters:
...
@@ -132,7 +147,6 @@ module API
...
@@ -132,7 +147,6 @@ module API
member
.
destroy
member
.
destroy
end
end
end
end
end
end
end
end
end
end
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