本文整理汇总了PHP中eZPolicyLimitation::fetchByPolicyID方法的典型用法代码示例。如果您正苦于以下问题:PHP eZPolicyLimitation::fetchByPolicyID方法的具体用法?PHP eZPolicyLimitation::fetchByPolicyID怎么用?PHP eZPolicyLimitation::fetchByPolicyID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZPolicyLimitation
的用法示例。
在下文中一共展示了eZPolicyLimitation::fetchByPolicyID方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: removeByValue
static function removeByValue($value, $policyID = false)
{
if ($policyID) {
$limitationIDList = array();
$limitations = eZPolicyLimitation::fetchByPolicyID($policyID, false);
foreach ($limitations as $limitationArray) {
$limitationIDList[] = $limitationArray['id'];
}
if (count($limitationIDList) > 0) {
eZPersistentObject::removeObject(eZPolicyLimitationValue::definition(), array('limitation_id' => array($limitationIDList), "value" => $value));
return;
}
}
eZPersistentObject::removeObject(eZPolicyLimitationValue::definition(), array("value" => $value));
}
示例2: array
$subtree = eZContentObjectTreeNode::fetch( $nodeID );
$pathString = $subtree->attribute( 'path_string' );
$policyLimitationValue = eZPolicyLimitationValue::createNew( $subtreeLimitation->attribute( 'id' ), $pathString );
$subtreeList[] = $subtree;
}
}
$db->commit();
}
$currentLimitationList = array();
foreach ( $currentFunctionLimitations as $currentFunctionLimitation )
{
$currentLimitationList[$currentFunctionLimitation['name']] = '-1';
}
$limitationList = eZPolicyLimitation::fetchByPolicyID( $policyID );
foreach ( $limitationList as $limitation )
{
$limitationID = $limitation->attribute( 'id' );
$limitationIdentifier = $limitation->attribute( 'identifier' );
$limitationValueList = eZPolicyLimitationValue::fetchList( $limitationID );
$valueList = array();
foreach ( $limitationValueList as $limitationValue )
{
$valueList[] = $limitationValue->attribute( 'value' );
}
$currentLimitationList[$limitationIdentifier] = $valueList;
}
$Module->setTitle( 'Edit policy' );
$tpl = eZTemplate::factory();
示例3: fetchUserRole
/**
* Fetch policy list
* Used by fetch( 'user', 'user_role', hash( 'user_id', $id ) ) template function.
*
* @param int $id User id or normal content object id in case of none user object (user group)
* @return array(string=>array)
*/
function fetchUserRole($id)
{
$user = eZUser::fetch($id);
if ($user instanceof eZUser) {
$roleList = $user->roles();
} else {
// user group or other non user classes:
$roleList = eZRole::fetchByUser(array($id), true);
}
$accessArray = array();
foreach (array_keys($roleList) as $roleKey) {
$role = $roleList[$roleKey];
$accessArray = array_merge_recursive($accessArray, $role->accessArray(true));
}
$resultArray = array();
foreach ($accessArray as $moduleKey => $module) {
$moduleName = $moduleKey;
if ($moduleName != '*') {
foreach ($module as $functionKey => $function) {
$functionName = $functionKey;
if ($functionName != '*') {
$hasLimitation = true;
foreach ($function as $limitationKey) {
if ($limitationKey == '*') {
$hasLimitation = false;
$limitationValue = '*';
$resultArray[] = array('moduleName' => $moduleName, 'functionName' => $functionName, 'limitation' => $limitationValue);
}
}
if ($hasLimitation) {
foreach ($function as $limitationKey => $limitation) {
if ($limitationKey !== '*') {
$policyID = str_replace('p_', '', $limitationKey);
$userRoleIdSeperator = strpos($policyID, '_');
if ($userRoleIdSeperator !== false) {
$policyID = substr($policyID, 0, $userRoleIdSeperator);
}
$limitationValue = eZPolicyLimitation::fetchByPolicyID($policyID);
$resultArray[] = array('moduleName' => $moduleName, 'functionName' => $functionName, 'limitation' => $limitationValue);
} else {
$limitationValue = '*';
$resultArray[] = array('moduleName' => $moduleName, 'functionName' => $functionName, 'limitation' => $limitationValue);
break;
}
}
}
} else {
$limitationValue = '*';
$resultArray[] = array('moduleName' => $moduleName, 'functionName' => $functionName, 'limitation' => $limitationValue);
break;
}
}
} else {
$functionName = '*';
$resultArray[] = array('moduleName' => '*', 'functionName' => $functionName, 'limitation' => '*');
break;
}
}
return array('result' => $resultArray);
}