2020-06-23 00:09:42 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class Projects::Snippets::ApplicationController < Projects::ApplicationController
|
|
|
|
include FindSnippet
|
|
|
|
include SnippetAuthorizations
|
|
|
|
|
2023-03-04 22:38:38 +05:30
|
|
|
feature_category :source_code_management
|
2021-01-03 14:25:43 +05:30
|
|
|
|
2020-06-23 00:09:42 +05:30
|
|
|
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
|