Remove custom deny_access handlers
Since these pages are not accessed by normal users, except for url fiddling, it's fine to respond with a generic access denied.
This commit is contained in:
parent
4deffa5e40
commit
234afb3f42
7 changed files with 9 additions and 43 deletions
|
@ -216,22 +216,6 @@ class DiaryEntriesController < ApplicationController
|
|||
|
||||
private
|
||||
|
||||
# This is required because, being a default-deny system, cancancan
|
||||
# _cannot_ tell you the reason you were denied access; and so
|
||||
# the "nice" feedback presenting next steps can't be gleaned from
|
||||
# the exception
|
||||
##
|
||||
# for the hide actions, require that the user is a administrator, or fill out
|
||||
# a helpful error message and return them to the user page.
|
||||
def deny_access(exception)
|
||||
if current_user && exception.action.in?([:hide, :hidecomment])
|
||||
flash[:error] = t("users.filter.not_an_administrator")
|
||||
redirect_to :action => "show"
|
||||
else
|
||||
super
|
||||
end
|
||||
end
|
||||
|
||||
##
|
||||
# return permitted diary entry parameters
|
||||
def entry_params
|
||||
|
|
|
@ -22,15 +22,6 @@ class IssueCommentsController < ApplicationController
|
|||
params.require(:issue_comment).permit(:body)
|
||||
end
|
||||
|
||||
def deny_access(_exception)
|
||||
if current_user
|
||||
flash[:error] = t("application.require_moderator_or_admin.not_a_moderator_or_admin")
|
||||
redirect_to root_path
|
||||
else
|
||||
super
|
||||
end
|
||||
end
|
||||
|
||||
# This sort of assumes there are only two roles
|
||||
def reassign_issue(issue)
|
||||
role = (Issue::ASSIGNED_ROLES - [issue.assigned_role]).first
|
||||
|
|
|
@ -82,13 +82,4 @@ class IssuesController < ApplicationController
|
|||
def find_issue
|
||||
@issue = Issue.find(params[:id])
|
||||
end
|
||||
|
||||
def deny_access(_exception)
|
||||
if current_user
|
||||
flash[:error] = t("application.require_moderator_or_admin.not_a_moderator_or_admin")
|
||||
redirect_to root_path
|
||||
else
|
||||
super
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue