本文整理汇总了PHP中eZRole::fetch方法的典型用法代码示例。如果您正苦于以下问题:PHP eZRole::fetch方法的具体用法?PHP eZRole::fetch怎么用?PHP eZRole::fetch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZRole
的用法示例。
在下文中一共展示了eZRole::fetch方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
function execute( $xml )
{
include_once( 'kernel/classes/ezrole.php' );
$assignmentList = $xml->getElementsByTagName( 'RoleAssignment' );
foreach ( $assignmentList as $roleAssignment )
{
$roleID = $this->getReferenceID( $roleAssignment->getAttribute( 'roleID' ) );
$assignTo = $this->getReferenceID( $roleAssignment->getAttribute( 'assignTo' ) );
$sectionLimitation = $this->getReferenceID( $roleAssignment->getAttribute( 'sectionLimitation' ) );
$subtreeLimitation = $this->getReferenceID( $roleAssignment->getAttribute( 'subtreeLimitation' ) );
$role = eZRole::fetch( $roleID );
if ( !$role )
{
$this->writeMessage( "\tRole $roleID does not exist.", 'warning' );
continue;
}
$referenceID = $this->getReferenceID( $assignTo );
if ( !$referenceID )
{
$this->writeMessage( "\tInvalid object $referenceID does not exist.", 'warning' );
continue;
}
if ( $sectionLimitation )
{
$section = $this->getReferenceID( $sectionLimitation );
if ( $section )
{
$role->assignToUser( $referenceID, 'section', $section );
$this->writeMessage( "\tAssigned role $roleID: $referenceID to $section", 'notice' );
}
else
{
$this->writeMessage( "\tInvalid section $sectionLimitation does not exist.", 'warning' );
continue;
}
}
elseif ( $subtreeLimitation )
{
$subtree = $this->getReferenceID( $subtreeLimitation );
if ( $subtree )
{
$role->assignToUser( $referenceID, 'subtree', $subtree );
$this->writeMessage( "\tAssigned role $roleID: $referenceID to $subtree", 'notice' );
}
else
{
$this->writeMessage( "\tInvalid section $subtreeLimitation does not exist.", 'warning' );
continue;
}
}
else
{
$role->assignToUser( $referenceID );
$this->writeMessage( "\tAssigned role $roleID: $referenceID", 'notice' );
}
}
}
示例2: foreach
return $Module->redirectTo($http->postVariable('BrowseCancelURI'));
}
}
if ($http->hasPostVariable('AssignSectionID') && $http->hasPostVariable('SectionID')) {
$Module->redirectTo('/role/assign/' . $roleID . '/' . $limitIdent . '/' . $http->postVariable('SectionID'));
} else {
if ($http->hasPostVariable('BrowseActionName') and $http->postVariable('BrowseActionName') == 'SelectObjectRelationNode') {
$selectedNodeIDArray = $http->postVariable('SelectedNodeIDArray');
if (count($selectedNodeIDArray) == 1) {
$limitValue = $selectedNodeIDArray[0];
}
$Module->redirectTo('/role/assign/' . $roleID . '/' . $limitIdent . '/' . $limitValue);
} else {
if ($http->hasPostVariable('BrowseActionName') and $http->postVariable('BrowseActionName') == 'AssignRole') {
$selectedObjectIDArray = $http->postVariable('SelectedObjectIDArray');
$role = eZRole::fetch($roleID);
$db = eZDB::instance();
$db->begin();
foreach ($selectedObjectIDArray as $objectID) {
$role->assignToUser($objectID, $limitIdent, $limitValue);
}
// Clear role caches.
eZRole::expireCache();
$db->commit();
if (count($selectedObjectIDArray) > 0) {
eZContentCacheManager::clearAllContentCache();
}
/* Clean up policy cache */
eZUser::cleanupCache();
$Module->redirectTo('/role/view/' . $roleID);
} else {
示例3: fetchRole
function fetchRole($roleID)
{
$role = eZRole::fetch($roleID);
return array('result' => $role);
}
示例4: array
$originalRoleID = $originalRole->attribute('id');
// Who changes which role(s) should be logged.
if ($http->hasSessionVariable('RoleWasChanged') and $http->sessionVariable('RoleWasChanged') === true) {
eZAudit::writeAudit('role-change', array('Role ID' => $originalRoleID, 'Role name' => $originalRoleName, 'Comment' => 'Changed the current role: kernel/role/edit.php'));
$http->removeSessionVariable('RoleWasChanged');
}
$originalRole->revertFromTemporaryVersion();
eZContentCacheManager::clearAllContentCache();
$Module->redirectTo($Module->functionURI('view') . '/' . $originalRoleID . '/');
/* Clean up policy cache */
eZUser::cleanupCache();
}
if ($http->hasPostVariable('Discard')) {
$http->removeSessionVariable('RoleWasChanged');
$role = eZRole::fetch($roleID);
$originalRole = eZRole::fetch($role->attribute('version'));
$role->removeThis();
if ($originalRole != null && $originalRole->attribute('is_new') == 1) {
$originalRole->remove();
}
$Module->redirectTo($Module->functionURI('list') . '/');
}
if ($http->hasPostVariable('ChangeRoleName')) {
$role->setAttribute('name', $http->postVariable('NewName'));
// Set flag for audit. If true audit will be processed
$http->setSessionVariable('RoleWasChanged', true);
}
if ($http->hasPostVariable('AddModule')) {
if ($http->hasPostVariable('Modules')) {
$currentModule = $http->postVariable('Modules');
} else {
示例5: fetchRolesByLimitation
static function fetchRolesByLimitation($limit_identifier, $limit_value)
{
$db = eZDB::instance();
$limit_identifier = $db->escapeString($limit_identifier);
$limit_value = $db->escapeString($limit_value);
$query = "SELECT DISTINCT\n ezuser_role.role_id as role_id,\n ezuser_role.contentobject_id as user_id\n FROM\n ezuser_role\n WHERE\n ezuser_role.limit_value = '{$limit_value}' AND\n ezuser_role.limit_identifier = '{$limit_identifier}'";
$userRoleArray = $db->arrayQuery($query);
$userRoles = array();
foreach ($userRoleArray as $userRole) {
$role = array();
$role['user'] = eZContentObject::fetch($userRole['user_id']);
$role['role'] = eZRole::fetch($userRole['role_id']);
$userRoles[] = $role;
}
return $userRoles;
}