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

base_controller.rb « import « controllers « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 93a7ace3530b87b976b5e79ea58b6c20730965b1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
class Import::BaseController < ApplicationController

  private

  def get_or_create_namespace
    begin
      namespace = Group.create!(name: @target_namespace, path: @target_namespace, owner: current_user)
      namespace.add_owner(current_user)
    rescue ActiveRecord::RecordNotUnique, ActiveRecord::RecordInvalid
      namespace = Namespace.find_by_path_or_name(@target_namespace)
      unless current_user.can?(:create_projects, namespace)
        @already_been_taken = true
        return false
      end
    end

    namespace
  end
end