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
- 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
- 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 clipboardIndex: 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+
-
This bug has been demonstrated on show2.tiki.org
Please demonstrate your bug on show2.tiki.org
Show.tiki.org is not configured properlyThe public/private keys configured to connect to show2.tiki.org were not accepted. Please make sure you are using RSA keys. Thanks.
- Demonstrate Bug (older Tiki versions)
-
This bug has been demonstrated on show.tikiwiki.org
Please demonstrate your bug on show.tikiwiki.org
Show.tiki.org is not configured properlyThe public/private keys configured to connect to show.tikiwiki.org were not accepted. Please make sure you are using RSA keys. Thanks.
- Ticket ID
- 3197
- Created
- Thursday 27 May, 2010 16:35:39 UTC
by Rodrigo Primo - LastModif
- Saturday 06 July, 2024 10:21:44 UTC