Commit 3091aa5b authored by jplang's avatar jplang

Let admins unarchive the project when trying to access an archived project (#29993).

git-svn-id: https://svn.redmine.org/redmine/trunk@17682 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent c4f849a0
......@@ -259,6 +259,7 @@ class ApplicationController < ActionController::Base
true
else
if @project && @project.archived?
@archived_project = @project
render_403 :message => :notice_not_authorized_archived_project
elsif @project && !@project.allows_to?(:controller => ctrl, :action => action)
# Project module is disabled
......
......@@ -3,6 +3,11 @@
<% if @message.present? %>
<p id="errorExplanation"><%= @message %></p>
<% end %>
<% if @archived_project && User.current.admin? %>
<p><%= link_to l(:button_unarchive), unarchive_project_path(@archived_project), :method => :post, :class => 'icon icon-unlock' %></p>
<% end %>
<p><a href="javascript:history.back()"><%= l(:button_back) %></a></p>
<% html_title @status %>
......@@ -524,9 +524,9 @@ class ProjectsControllerTest < Redmine::ControllerTest
assert_response :success
end
def show_archived_project_should_be_denied
def test_show_archived_project_should_be_denied
project = Project.find_by_identifier('ecookbook')
project.archive!
project.archive
get :show, :params => {
:id => 'ecookbook'
......@@ -536,6 +536,18 @@ class ProjectsControllerTest < Redmine::ControllerTest
assert_not_include project.name, response.body
end
def test_show_archived_project_should_show_unarchive_link_to_admins
@request.session[:user_id] = 1
project = Project.find_by_identifier('ecookbook')
project.archive
get :show, :params => {
:id => 'ecookbook'
}
assert_response 403
assert_select 'a', :text => "Unarchive"
end
def test_show_should_not_show_private_subprojects_that_are_not_visible
get :show, :params => {
:id => 'ecookbook'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment