當前位置: 首頁>>代碼示例>>PHP>>正文


PHP eZRole::fetch方法代碼示例

本文整理匯總了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' );
            }
        }
      }
開發者ID:sushilbshinde,項目名稱:ezpublish-study,代碼行數:60,代碼來源:ezassignroles.php

示例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 {
開發者ID:brookinsconsulting,項目名稱:ezecosystem,代碼行數:31,代碼來源:assign.php

示例3: fetchRole

 function fetchRole($roleID)
 {
     $role = eZRole::fetch($roleID);
     return array('result' => $role);
 }
開發者ID:legende91,項目名稱:ez,代碼行數:5,代碼來源:ezrolefunctioncollection.php

示例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 {
開發者ID:mugoweb,項目名稱:ezpublish-legacy,代碼行數:31,代碼來源:edit.php

示例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;
 }
開發者ID:,項目名稱:,代碼行數:16,代碼來源:


注:本文中的eZRole::fetch方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。