当前位置: 首页>>代码示例>>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;未经允许,请勿转载。