diff options
-rw-r--r-- | app/controllers/application_controller.rb | 1 | ||||
-rw-r--r-- | app/views/common/error.html.erb | 5 | ||||
-rw-r--r-- | test/functional/projects_controller_test.rb | 16 |
3 files changed, 20 insertions, 2 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index a71103a89..94f435948 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -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 diff --git a/app/views/common/error.html.erb b/app/views/common/error.html.erb index a5ec39c3a..04b4b0377 100644 --- a/app/views/common/error.html.erb +++ b/app/views/common/error.html.erb @@ -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 %> diff --git a/test/functional/projects_controller_test.rb b/test/functional/projects_controller_test.rb index df1da4a28..e5b5eaaf4 100644 --- a/test/functional/projects_controller_test.rb +++ b/test/functional/projects_controller_test.rb @@ -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' |