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:
1 parent
1e4776fa64
commit
eea456ed84
48 files changed
+72
-3
No files matched your search
@@ -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 }
|
||||
|
||||
@@ -220,6 +220,10 @@ class Project < ActiveRecord::Base
|
||||
self.status == STATUS_ACTIVE
|
||||
end
|
||||
|
||||
def archived?
|
||||
self.status == STATUS_ARCHIVED
|
||||
end
|
||||
|
||||
# Archives the project and its descendants
|
||||
def archive
|
||||
# Check that there is no issue of a non descendant project that is assigned
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<h2>403</h2>
|
||||
|
||||
<p><%= l(:notice_not_authorized) %></p>
|
||||
<p><%=h @message %></p>
|
||||
<p><a href="javascript:history.back()">Back</a></p>
|
||||
|
||||
<% html_title '403' %>
|
||||
Reference in new issue
Block a user