Improved error message when trying to access an archived project (#2995).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4285 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2010-10-23 09:48:01 +00:00
parent 1e4776fa64
commit eea456ed84
48 changed files with 72 additions and 3 deletions
+12 -2
View File
@@ -154,7 +154,15 @@ class ApplicationController < ActionController::Base
# Authorize the user for the requested action
def authorize(ctrl = params[:controller], action = params[:action], global = false)
allowed = User.current.allowed_to?({:controller => ctrl, :action => action}, @project || @projects, :global => global)
allowed ? true : deny_access
if allowed
true
else
if @project && @project.archived?
render_403 :message => :notice_not_authorized_archived_project
else
deny_access
end
end
end
# Authorize the user for the requested action outside a project
@@ -265,8 +273,10 @@ class ApplicationController < ActionController::Base
redirect_to default
end
def render_403
def render_403(options={})
@project = nil
@message = options[:message] || :notice_not_authorized
@message = l(@message) if @message.is_a?(Symbol)
respond_to do |format|
format.html { render :template => "common/403", :layout => use_layout, :status => 403 }
format.atom { head 403 }