diff options
author | Robert Schilling <rschilling@student.tugraz.at> | 2016-04-07 10:12:49 +0200 |
---|---|---|
committer | Robert Schilling <rschilling@student.tugraz.at> | 2016-04-12 15:47:20 +0200 |
commit | d0cdc2ee73c8421906fbd011d0f44d638616a864 (patch) | |
tree | 3635d611380410b44643ec15e2206ce65e4f381d /lib/api/groups.rb | |
parent | 734df1bb504aedec6a5668567de808b549a84749 (diff) | |
download | gitlab-ce-d0cdc2ee73c8421906fbd011d0f44d638616a864.tar.gz |
API: Ability to update a group
Diffstat (limited to 'lib/api/groups.rb')
-rw-r--r-- | lib/api/groups.rb | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/lib/api/groups.rb b/lib/api/groups.rb index c165de21a75..964f691afcc 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,30 @@ 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] + + ::Groups::UpdateService.new(group, current_user, attrs).execute + + if group.errors.any? + render_validation_error!(group) + else + present group, with: Entities::GroupDetail + end + end + # Get a single group, with containing projects # # Parameters: |