Loading...
 
Skip to main content

Category permission check for wiki page menu option not working in some cases

Status
Closed
Subject
Category permission check for wiki page menu option not working in some cases
Version
5.x
Category
  • Error
  • Consistency
Feature
Wiki (page view, edit, history, rename, etc)
Category
Menu
Submitted by
Rodrigo Primo
Lastmod by
Rodrigo Primo
Rating
(0)
Description

Wiki pages links are case insensitive but the category permission check for wiki pages menu entry only works if the case of the link matches the case of the wiki page name.

Say you have a wiki page called "Foo" and the "Registered" group has view permission to this page granted by a category. If you create a menu entry linking to the "Foo" page and set the URL as "Foo" everything will work as expected. But if you set the URL as "foo" the menu option will not appear to the users of the "Registered" group. Obviously for this to happen the "Registered" group must not have global tiki_p_view.

This does not happen if object permissions, instead of category permissions, grant access to the "Foo" page.

Files
  1. CategoryFactory.php
Solution

http://tikiwiki.svn.sourceforge.net/viewvc/tikiwiki?view=rev&revision=27364

The following patch (also attached) permanently fix the issue.

The method Perms_ResolverFactory_CategoryFactory::bulkLoadCategories() loads the property Perms_ResolverFactory_CategoryFactory::knownObjects with the list of objects and the categories they belong. The problem is that it does that by comparing the object name (in the case of menu options, the URL menu option value) with the itemId field of the table 'tiki_objects' in a case sensitive way. So it ends up loading a incomplete list of known objects.

Copy to clipboard
Index: lib/core/lib/Perms/ResolverFactory/CategoryFactory.php =================================================================== --- lib/core/lib/Perms/ResolverFactory/CategoryFactory.php (revision 27307) +++ lib/core/lib/Perms/ResolverFactory/CategoryFactory.php (working copy) @@ -95,7 +95,7 @@ $key = $this->objectKey( array_merge( $baseContext, array( 'object' => $v ) ) ); if( ! isset( $this->knownObjects[$key] ) ) { - $objects[$v] = $key; + $objects[strtolower($v)] = $key; $this->knownObjects[$key] = array(); } } @@ -112,7 +112,7 @@ foreach( $result as $row ) { $category = (int) $row['categId']; - $object = $row['itemId']; + $object = strtolower($row['itemId']); $key = $objects[$object]; $this->knownObjects[$key][] = $category;
Workaround
A easy workaround is to simply create the menu options matching the case of the wiki page name.
Priority
25
Demonstrate Bug on Tiki 19+
Demonstrate Bug (older Tiki versions)
Ticket ID
3197
Created
Thursday 27 May, 2010 16:35:39 UTC
by Rodrigo Primo
LastModif
Saturday 06 July, 2024 10:21:44 UTC


Show PHP error messages