X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/64146b4f3614854e6a0f8430f27261fe0a0ca26c..4e6d729529c94486a50cf135dfbbdcf841790200:/app/controllers/issues_controller.rb diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index ad38454f0..cd3584f02 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -3,8 +3,9 @@ class IssuesController < ApplicationController before_action :authorize_web before_action :set_locale - before_action :require_user - before_action :check_permission + + authorize_resource + before_action :find_issue, :only => [:show, :resolve, :reopen, :ignore] def index @@ -79,13 +80,8 @@ class IssuesController < ApplicationController private def find_issue - @issue = Issue.find(params[:id]) - end - - def check_permission - unless current_user.administrator? || current_user.moderator? - flash[:error] = t("application.require_moderator_or_admin.not_a_moderator_or_admin") - redirect_to root_path - end + @issue = Issue.visible_to(current_user).find(params[:id]) + rescue ActiveRecord::RecordNotFound + redirect_to :controller => "errors", :action => "not_found" end end