diff options
Diffstat (limited to 'lib/api')
-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: |