Require sudo mode for actions to delete contents (#33071).

Patch by Go MAEDA.


git-svn-id: http://svn.redmine.org/redmine/trunk@19569 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Go MAEDA
2020-03-10 03:26:23 +00:00
parent 852290edb0
commit 463e8163fc
14 changed files with 47 additions and 2 deletions

View File

@@ -25,6 +25,8 @@ class AttachmentsController < ApplicationController
before_action :delete_authorize, :only => :destroy
before_action :authorize_global, :only => :upload
require_sudo_mode :destroy
# Disable check for same origin requests for JS files, i.e. attachments with
# MIME type text/javascript.
skip_after_action :verify_same_origin_request, :only => :download

View File

@@ -22,6 +22,8 @@ class BoardsController < ApplicationController
before_action :find_project_by_project_id, :find_board_if_available, :authorize
accept_rss_auth :index, :show
require_sudo_mode :destroy
helper :sort
include SortHelper
helper :watchers

View File

@@ -24,6 +24,8 @@ class CommentsController < ApplicationController
before_action :find_project_from_association
before_action :authorize
require_sudo_mode :destroy
def create
raise Unauthorized unless @news.commentable?

View File

@@ -25,6 +25,8 @@ class DocumentsController < ApplicationController
before_action :find_project_from_association, :except => [:index, :new, :create]
before_action :authorize
require_sudo_mode :destroy
helper :attachments
helper :custom_fields

View File

@@ -28,6 +28,8 @@ class IssuesController < ApplicationController
accept_rss_auth :index, :show
accept_api_auth :index, :show, :create, :update, :destroy
require_sudo_mode :destroy
rescue_from Query::StatementInvalid, :with => :query_statement_invalid
helper :journals

View File

@@ -25,6 +25,8 @@ class MessagesController < ApplicationController
before_action :find_message, :except => [:new, :preview]
before_action :authorize, :except => [:preview, :edit, :destroy]
require_sudo_mode :destroy
helper :boards
helper :watchers
helper :attachments

View File

@@ -28,6 +28,8 @@ class NewsController < ApplicationController
accept_rss_auth :index
accept_api_auth :index, :show, :create, :update, :destroy
require_sudo_mode :destroy
helper :watchers
helper :attachments

View File

@@ -36,6 +36,8 @@ class RepositoriesController < ApplicationController
before_action :authorize
accept_rss_auth :revisions
require_sudo_mode :destroy
rescue_from Redmine::Scm::Adapters::CommandFailed, :with => :show_error_command_failed
def new

View File

@@ -33,6 +33,8 @@ class TimelogController < ApplicationController
accept_rss_auth :index
accept_api_auth :index, :show, :create, :update, :destroy
require_sudo_mode :destroy
rescue_from Query::StatementInvalid, :with => :query_statement_invalid
helper :issues

View File

@@ -27,6 +27,8 @@ class VersionsController < ApplicationController
accept_api_auth :index, :show, :create, :update, :destroy
require_sudo_mode :destroy
helper :custom_fields
helper :projects

View File

@@ -39,6 +39,8 @@ class WikiController < ApplicationController
before_action :find_attachments, :only => [:preview]
accept_api_auth :index, :show, :update, :destroy
require_sudo_mode :destroy, :destroy_version
helper :attachments
include AttachmentsHelper
helper :watchers

View File

@@ -21,6 +21,8 @@ class WikisController < ApplicationController
menu_item :settings
before_action :find_project, :authorize
require_sudo_mode :destroy, only: :post
# Delete a project's wiki
def destroy
if request.post? && params[:confirm] && @project.wiki