##// END OF EJS Templates
Check permission of wiki pages before generating a link to it (#23793)....
Jean-Philippe Lang -
r15901:19d2529faa25
parent child
Show More
@@ -726,7 +726,7 module ApplicationHelper
726 726 title ||= identifier if page.blank?
727 727 end
728 728
729 if link_project && link_project.wiki
729 if link_project && link_project.wiki && User.current.allowed_to?(:view_wiki_pages, link_project)
730 730 # extract anchor
731 731 anchor = nil
732 732 if page =~ /^(.+?)\#(.+)$/
@@ -9,3 +9,8 wikis_002:
9 9 start_page: Start page
10 10 project_id: 2
11 11 id: 2
12 wikis_005:
13 status: 1
14 start_page: Wiki
15 project_id: 5
16 id: 5
@@ -665,6 +665,7 RAW
665 665 end
666 666
667 667 def test_wiki_links
668 User.current = User.find_by_login('jsmith')
668 669 russian_eacape = CGI.escape(@russian_test)
669 670 to_test = {
670 671 '[[CookBook documentation]]' =>
@@ -746,6 +747,9 RAW
746 747 # project does not exist
747 748 '[[unknowproject:Start]]' => '[[unknowproject:Start]]',
748 749 '[[unknowproject:Start|Page title]]' => '[[unknowproject:Start|Page title]]',
750 # missing permission to view wiki in project
751 '[[private-child:]]' => '[[private-child:]]',
752 '[[private-child:Wiki]]' => '[[private-child:Wiki]]',
749 753 }
750 754 @project = Project.find(1)
751 755 to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text) }
General Comments 0
You need to be logged in to leave comments. Login now