diff options
author | Rémy Coutable <remy@rymai.me> | 2016-04-13 08:23:29 +0000 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2016-04-13 08:23:29 +0000 |
commit | fc9e1be1fde9646358aab756198c1d3773e55664 (patch) | |
tree | 88424a8d0ce1487c911275132c1c089a7f6b3932 /lib/api | |
parent | 64d71b4dfc4513b70eac61cbb9bb718aee3f09e9 (diff) | |
parent | 5fb572417e0c331afb62c8bbaa561b0fe7836fc5 (diff) | |
download | gitlab-ce-fc9e1be1fde9646358aab756198c1d3773e55664.tar.gz |
Merge branch 'api-group-visibility' into 'master'
API: Ability to update a group
This makes it much easier to update a group after introducing the group visibility.
* Closes #14991
See merge request !3587
Diffstat (limited to 'lib/api')
-rw-r--r-- | lib/api/groups.rb | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/lib/api/groups.rb b/lib/api/groups.rb index c165de21a75..91e420832f3 100644 --- a/lib/api/groups.rb +++ b/lib/api/groups.rb @@ -23,8 +23,10 @@ module API # Create group. Available only for users who can create groups. # # Parameters: - # name (required) - The name of the group - # path (required) - The path of the group + # name (required) - The name of the group + # path (required) - The path of the group + # description (optional) - The description of the group + # visibility_level (optional) - The visibility level of the group # Example Request: # POST /groups post do @@ -42,6 +44,28 @@ module API end end + # Update group. Available only for users who can administrate groups. + # + # Parameters: + # id (required) - The ID of a group + # path (optional) - The path of the group + # description (optional) - The description of the group + # visibility_level (optional) - The visibility level of the group + # Example Request: + # PUT /groups/:id + put ':id' do + group = find_group(params[:id]) + authorize! :admin_group, group + + attrs = attributes_for_keys [:name, :path, :description, :visibility_level] + + if ::Groups::UpdateService.new(group, current_user, attrs).execute + present group, with: Entities::GroupDetail + else + render_validation_error!(group) + end + end + # Get a single group, with containing projects # # Parameters: |