Loading...
 
Skip to main content

assign_all in tiki-categpermissions.php does not assign to more than one level of children

Status
Closed
Subject
assign_all in tiki-categpermissions.php does not assign to more than one level of children
Version
2.x
Category
  • Error
  • Usability
Feature
Category
Permission
Resolution status
Invalid
Submitted by
runesk
Lastmod by
Ushindi Gedeon
Rating
(0)
Description

While updating from 1.9.11 to 2.1, we ran into a bug in tiki-categpermissions.php.

We have a category structure with multiple levels of categories, and assigning to children seemed not to work as intended.

I had a look at the code, and it seems like it only assigns to one level of children, and never checks for more levels of children. I rewrote the code quickly to solve our problem, and attaches the patch I used.

I don't know if this breaks all code guidelines in tw, but it works 😉

Solution
Copy to clipboard
--- /tmp/tikiwiki-2.1/tiki-categpermissions.php 2008-07-04 20:33:34.000000000 +0200 +++ tiki-categpermissions.php 2008-10-14 15:35:09.534418860 +0200 @@ -48,11 +48,15 @@ // Process the form to assign a new permission to this category and all children if (isset($_REQUEST['assign_all'])) { + function assign_all_children($userlib, $categlib, $categId) { $userlib->assign_object_permission($_REQUEST['group'], $categId, 'category', $_REQUEST['perm']); $children = $categlib->get_child_categories($categId); foreach ($children as $child) { - $userlib->assign_object_permission($_REQUEST['group'], $child['categId'], 'category', $_REQUEST['perm']); + assign_all_children($userlib, $categlib, $child['categId']); + #$userlib->assign_object_permission($_REQUEST['group'], $child['categId'], 'category', $_REQUEST['perm']); } + } + assign_all_children($userlib, $categlib, $categId); } // Process the form to remove a permission from the category
Workaround
Priority
25
Demonstrate Bug on Tiki 19+
Demonstrate Bug (older Tiki versions)
Ticket ID
2073
Created
Tuesday 14 October, 2008 13:54:12 UTC
by Unknown
LastModif
Friday 01 May, 2026 14:49:27 UTC


Show PHP error messages