Commit f141711c authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

API: new feature - remove group

parent 073c8a29
......@@ -57,6 +57,19 @@ Parameters:
+ `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
......
......@@ -7,12 +7,14 @@ module API
helpers do
def find_group(id)
group = Group.find(id)
if current_user.admin or current_user.groups.include? group
if can?(current_user, :read_group, group)
group
else
render_api_error!("403 Forbidden - #{current_user.username} lacks sufficient access to #{group.name}", 403)
end
end
def validate_access_level?(level)
Gitlab::Access.options_with_owner.values.include? level.to_i
end
......@@ -64,6 +66,19 @@ module API
present group, with: Entities::GroupDetail
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
#
# Parameters:
......@@ -132,7 +147,6 @@ module API
member.destroy
end
end
end
end
end
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