gitlab-org--gitlab-foss/app/controllers/import/base_controller.rb

22 lines
548 B
Ruby
Raw Normal View History

2015-02-05 18:31:36 +00:00
class Import::BaseController < ApplicationController
private
def get_or_create_namespace
existing_namespace = Namespace.find_by_path_or_name(@target_namespace)
2015-02-05 18:31:36 +00:00
if existing_namespace
if existing_namespace.owner == current_user
namespace = existing_namespace
else
@already_been_taken = true
return false
end
else
namespace = Group.create(name: @target_namespace, path: @target_namespace, owner: current_user)
namespace.add_owner(current_user)
namespace
end
end
end