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

redirect_controller.rb « projects « controllers « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: c66a99be02bae4d761dc5bf4d5164e6f3d8cf7cb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# frozen_string_literal: true

# Projects::RedirectController is used to resolve the route projects/:id.
# It's helpful for this to be in its own controller so that the
# ProjectsController can assume that :namespace_id exists
class Projects::RedirectController < ::ApplicationController
  skip_before_action :authenticate_user!

  feature_category :groups_and_projects

  def redirect_from_id
    project = Project.find(params[:id])

    if can?(current_user, :read_project, project)
      redirect_to project
    else
      render_404
    end
  end
end