diff --git a/app/controllers/public/content_viewer_controller.rb b/app/controllers/public/content_viewer_controller.rb index df25ff2..ee5418c 100644 --- a/app/controllers/public/content_viewer_controller.rb +++ b/app/controllers/public/content_viewer_controller.rb @@ -27,7 +27,7 @@ class ContentViewerController < ApplicationController end # only show unpublished articles to those who can edit then - if @page && !@page.published && (!user || !user.has_permission?('post_content', profile)) + if @page && !@page.published && !@page.allow_post_content?(user) @page = nil end diff --git a/test/functional/content_viewer_controller_test.rb b/test/functional/content_viewer_controller_test.rb index 52e7e79..a4505b4 100644 --- a/test/functional/content_viewer_controller_test.rb +++ b/test/functional/content_viewer_controller_test.rb @@ -850,4 +850,16 @@ class ContentViewerControllerTest < Test::Unit::TestCase assert_tag :tag => 'li', :attributes => {:class => 'image-gallery-item'}, :child => {:tag => 'span', :content => 'a long abstract bigger then 40 chars for…'} end + should 'allow publisher owner view private articles' do + c = Community.create!(:name => 'test_com') + u = create_user_with_permission('test_user', 'publish_content', c) + login_as u.identifier + a = c.articles.create!(:name => 'test-article', :last_changed_by => u, :published => false) + + get :view_page, :profile => c.identifier, :page => a.explode_path + + assert_response :success + assert_template 'view_page' + end + end -- libgit2 0.21.2