2018-07-17 12:50:37 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-04-06 11:23:49 -04:00
|
|
|
module Projects
|
|
|
|
class MoveAccessService < BaseMoveRelationsService
|
|
|
|
def execute(source_project, remove_remaining_elements: true)
|
|
|
|
return unless super
|
|
|
|
|
|
|
|
@project.with_transaction_returning_status do
|
|
|
|
if @project.namespace != source_project.namespace
|
|
|
|
@project.run_after_commit do
|
|
|
|
source_project.namespace.refresh_project_authorizations
|
|
|
|
self.namespace.refresh_project_authorizations
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
::Projects::MoveProjectMembersService.new(@project, @current_user)
|
|
|
|
.execute(source_project, remove_remaining_elements: remove_remaining_elements)
|
|
|
|
::Projects::MoveProjectGroupLinksService.new(@project, @current_user)
|
|
|
|
.execute(source_project, remove_remaining_elements: remove_remaining_elements)
|
|
|
|
::Projects::MoveProjectAuthorizationsService.new(@project, @current_user)
|
|
|
|
.execute(source_project, remove_remaining_elements: remove_remaining_elements)
|
|
|
|
|
2020-01-29 13:08:47 -05:00
|
|
|
@project.save(touch: false)
|
|
|
|
|
2018-04-06 11:23:49 -04:00
|
|
|
success
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|