$nodeLimitation = eZPolicyLimitation::fetchByIdentifier( $policyID, 'Node' ); if ( $nodeLimitation != null ) { $nodeLimitationID = $nodeLimitation->attribute( 'id' ); $nodeLimitationValues = eZPolicyLimitationValue::fetchList( $nodeLimitationID ); foreach ( $nodeLimitationValues as $nodeLimitationValue ) { $nodeID = $nodeLimitationValue->attribute( 'value' ); $nodeIDList[] = $nodeID; $node = eZContentObjectTreeNode::fetch( $nodeID ); $nodeList[] = $node; } } // Fetch subtree limitations $subtreeLimitation = eZPolicyLimitation::fetchByIdentifier( $policyID, 'Subtree' ); if ( $subtreeLimitation != null ) { $subtreeLimitationID = $subtreeLimitation->attribute('id'); $subtreeLimitationValues = eZPolicyLimitationValue::fetchList( $subtreeLimitationID ); foreach ( $subtreeLimitationValues as $subtreeLimitationValue ) { $subtreePath = $subtreeLimitationValue->attribute( 'value' ); $subtreeObject = eZContentObjectTreeNode::fetchByPath( $subtreePath ); if ( $subtreeObject ) { $subtreeID = $subtreeObject->attribute( 'node_id' ); if ( !isset( $subtreeIDList ) ) $subtreeIDList = array(); $subtreeIDList[] = $subtreeID; $subtree = eZContentObjectTreeNode::fetch( $subtreeID );
if (!in_array($nodeID, $nodeIDList)) { $nodeLimitationValue = eZPolicyLimitationValue::createNew($nodeLimitation->attribute('id'), $nodeID); $node = eZContentObjectTreeNode::fetch($nodeID); $nodeList[] = $node; } } } if ($http->hasPostVariable('SelectedNodeIDArray') and $http->postVariable('BrowseActionName') == 'FindLimitationSubtree' and !$http->hasPostVariable('BrowseCancelButton')) { $selectedSubtreeIDList = $http->postVariable('SelectedNodeIDArray'); if ($http->hasSessionVariable('BrowsePolicyID')) { $policy = eZPolicy::fetch($http->sessionVariable('BrowsePolicyID')); } else { $policy = eZPolicy::createNew($roleID, array('ModuleName' => $currentModule, 'FunctionName' => $currentFunction, 'Limitation' => '')); $http->setSessionVariable('BrowsePolicyID', $policy->attribute('id')); } $subtreeLimitation = eZPolicyLimitation::fetchByIdentifier($policy->attribute('id'), 'Subtree'); if ($subtreeLimitation == null) { $subtreeLimitation = eZPolicyLimitation::createNew($policy->attribute('id'), 'Subtree'); } foreach ($selectedSubtreeIDList as $nodeID) { if (!in_array($nodeID, $subtreeIDList)) { $subtree = eZContentObjectTreeNode::fetch($nodeID); $pathString = $subtree->attribute('path_string'); $policyLimitationValue = eZPolicyLimitationValue::createNew($subtreeLimitation->attribute('id'), $pathString); $subtreeList[] = $subtree; } } } if ($http->hasPostVariable('Limitation') && count($currentFunctionLimitations) == 0) { $currentModule = $http->postVariable('CurrentModule'); $currentFunction = $http->postVariable('ModuleFunction');