debian-mirror-gitlab/app/controllers/namespaces_controller.rb

26 lines
531 B
Ruby
Raw Normal View History

2014-09-02 18:07:02 +05:30
class NamespacesController < ApplicationController
skip_before_filter :authenticate_user!
def show
namespace = Namespace.find_by(path: params[:id])
2015-04-26 12:48:37 +05:30
if namespace
if namespace.is_a?(Group)
group = namespace
else
user = namespace.owner
end
2014-09-02 18:07:02 +05:30
end
2015-04-26 12:48:37 +05:30
if user
redirect_to user_path(user)
elsif group && can?(current_user, :read_group, group)
redirect_to group_path(group)
elsif current_user.nil?
authenticate_user!
2014-09-02 18:07:02 +05:30
else
2015-04-26 12:48:37 +05:30
render_404
2014-09-02 18:07:02 +05:30
end
end
end