2015-02-05 18:31:36 +00:00
|
|
|
class Import::BaseController < ApplicationController
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def get_or_create_namespace
|
2015-03-03 07:06:59 +00:00
|
|
|
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
|