From: <sy...@us...> - 2007-02-28 18:11:17
|
Update of /cvsroot/tikiwiki/tiki In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv32448 Modified Files: tiki-objectpermissions.php Log Message: [FIX]perms: add in objectpermissions the ability to assign/remove to all the sub-structure as it was in pagepermissions Index: tiki-objectpermissions.php =================================================================== RCS file: /cvsroot/tikiwiki/tiki/tiki-objectpermissions.php,v retrieving revision 1.19 retrieving revision 1.20 diff -u -d -r1.19 -r1.20 --- tiki-objectpermissions.php 28 Feb 2007 15:19:54 -0000 1.19 +++ tiki-objectpermissions.php 28 Feb 2007 18:11:16 -0000 1.20 @@ -43,6 +43,14 @@ $smarty->assign('objectType', $_REQUEST["objectType"]); $smarty->assign('permType', $_REQUEST["permType"]); +if ($_REQUEST['objectType'] == 'wiki' || $_REQUEST['objectType'] == 'wiki page') { + global $structlib; include_once('lib/structures/structlib.php'); + $pageInfoTree = $structlib->s_get_structure_pages($structlib->get_struct_ref_id($_REQUEST['objectId'])); + if (count($pageInfoTree) > 1) { + $smarty->assign('inStructure', 'y'); + } +} + // Process the form to assign a new permission to this page if (isset($_REQUEST['assign']) && isset($_REQUEST['group']) && isset($_REQUEST['perm'])) { check_ticket('object-perms'); @@ -53,9 +61,19 @@ die; } } - foreach($_REQUEST['perm'] as $perm) { - foreach ($_REQUEST['group'] as $group) { - $userlib->assign_object_permission($group, $_REQUEST["objectId"], $_REQUEST["objectType"], $perm); + if (!empty($_REQUEST['assignstructure']) && $_REQUEST['assignstructure'] == 'on' && !empty($pageInfoTree)) { + foreach($pageInfoTree as $subPage) { + foreach($_REQUEST['perm'] as $perm) { + foreach ($_REQUEST['group'] as $group) { + $userlib->assign_object_permission($group,$subPage["pageName"],'wiki page',$perm); + } + } + } + } else { + foreach($_REQUEST['perm'] as $perm) { + foreach ($_REQUEST['group'] as $group) { + $userlib->assign_object_permission($group, $_REQUEST["objectId"], $_REQUEST["objectType"], $perm); + } } } $smarty->assign('groupName', $_REQUEST["group"]); @@ -72,7 +90,13 @@ check_ticket('object-perms'); foreach ($_REQUEST['checked'] as $perm) { if (preg_match('/([^ ]*) (.*)/', $perm, $matches)) { - $userlib->remove_object_permission($matches[2], $_REQUEST["objectId"], $_REQUEST["objectType"], $matches[1]); + if (!empty($_REQUEST['removestructure']) && $_REQUEST['removestructure'] == 'on' && !empty($pageInfoTree)) { + foreach($pageInfoTree as $subPage) { + $userlib->remove_object_permission($matches[2], $subPage['pageName'], $_REQUEST['objectType'], $matches[1]); + } + } else { + $userlib->remove_object_permission($matches[2], $_REQUEST['objectId'], $_REQUEST['objectType'], $matches[1]); + } } } } |