BigW Consortium Gitlab

namespaces_controller.rb 489 Bytes
Newer Older
1
class NamespacesController < ApplicationController
2
  skip_before_action :authenticate_user!
3 4 5 6

  def show
    namespace = Namespace.find_by(path: params[:id])

7 8 9 10 11 12
    if namespace
      if namespace.is_a?(Group)
        group = namespace
      else
        user = namespace.owner
      end
13 14
    end

15 16
    if user
      redirect_to user_path(user)
17
    elsif group
18 19 20
      redirect_to group_path(group)
    elsif current_user.nil?
      authenticate_user!
21
    else
22
      render_404
23 24 25
    end
  end
end