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

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

class Projects::Snippets::ApplicationController < Projects::ApplicationController
  include FindSnippet
  include SnippetAuthorizations

  private

  # This overrides the default snippet create authorization
  # because ProjectSnippets are checked against the project rather
  # than the user
  def authorize_create_snippet!
    return render_404 unless can?(current_user, :create_snippet, project)
  end

  def snippet_klass
    ProjectSnippet
  end
end