Add database checks to issue and report controllers

Fixes #3875
This commit is contained in:
Tom Hughes 2023-01-07 15:20:22 +00:00
parent 2ee5a63ead
commit a119240216
3 changed files with 8 additions and 0 deletions

View file

@ -3,9 +3,12 @@ class IssueCommentsController < ApplicationController
before_action :authorize_web before_action :authorize_web
before_action :set_locale before_action :set_locale
before_action :check_database_readable
authorize_resource authorize_resource
before_action :check_database_writable, :only => [:create]
def create def create
@issue = Issue.find(params[:issue_id]) @issue = Issue.find(params[:issue_id])
comment = @issue.comments.build(issue_comment_params) comment = @issue.comments.build(issue_comment_params)

View file

@ -3,10 +3,12 @@ class IssuesController < ApplicationController
before_action :authorize_web before_action :authorize_web
before_action :set_locale before_action :set_locale
before_action :check_database_readable
authorize_resource authorize_resource
before_action :find_issue, :only => [:show, :resolve, :reopen, :ignore] before_action :find_issue, :only => [:show, :resolve, :reopen, :ignore]
before_action :check_database_writable, :only => [:resolve, :ignore, :reopen]
def index def index
@title = t ".title" @title = t ".title"

View file

@ -3,9 +3,12 @@ class ReportsController < ApplicationController
before_action :authorize_web before_action :authorize_web
before_action :set_locale before_action :set_locale
before_action :check_database_readable
authorize_resource authorize_resource
before_action :check_database_writable, :only => [:new, :create]
def new def new
if required_new_report_params_present? if required_new_report_params_present?
@report = Report.new @report = Report.new