Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/api/groups.rb')
-rw-r--r--lib/api/groups.rb24
1 files changed, 23 insertions, 1 deletions
diff --git a/lib/api/groups.rb b/lib/api/groups.rb
index 680e3a6e994..d3d1f03585b 100644
--- a/lib/api/groups.rb
+++ b/lib/api/groups.rb
@@ -109,7 +109,7 @@ module API
end
def present_groups_with_pagination_strategies(params, groups)
- return present_groups(params, groups) if current_user.present? || Feature.disabled?(:keyset_pagination_for_groups_api)
+ return present_groups(params, groups) if current_user.present?
options = {
with: Entities::Group,
@@ -382,6 +382,28 @@ module API
end
end
+ desc 'Transfer a group to a new parent group or promote a subgroup to a root group'
+ params do
+ optional :group_id, type: Integer,
+ desc: 'The ID of the target group to which the group needs to be transferred to.'\
+ 'If not provided, the source group will be promoted to a root group.'
+ end
+ post ':id/transfer' do
+ group = find_group!(params[:id])
+ authorize! :admin_group, group
+
+ new_parent_group = find_group!(params[:group_id]) if params[:group_id].present?
+
+ service = ::Groups::TransferService.new(group, current_user)
+
+ if service.execute(new_parent_group)
+ group.preload_shared_group_links
+ present group, with: Entities::GroupDetail, current_user: current_user
+ else
+ render_api_error!(service.error, 400)
+ end
+ end
+
desc 'Share a group with a group' do
success Entities::GroupDetail
end