当前位置: 首页>>代码示例>>PHP>>正文


PHP BackendUserAuthentication::doesUserHaveAccess方法代码示例

本文整理汇总了PHP中TYPO3\CMS\Core\Authentication\BackendUserAuthentication::doesUserHaveAccess方法的典型用法代码示例。如果您正苦于以下问题:PHP BackendUserAuthentication::doesUserHaveAccess方法的具体用法?PHP BackendUserAuthentication::doesUserHaveAccess怎么用?PHP BackendUserAuthentication::doesUserHaveAccess使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TYPO3\CMS\Core\Authentication\BackendUserAuthentication的用法示例。


在下文中一共展示了BackendUserAuthentication::doesUserHaveAccess方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: doesBranchExist

 /**
  * Checks if a whole branch of pages exists
  *
  * Tests the branch under $pid (like doesRecordExist). It doesn't test the page with $pid as uid. Use doesRecordExist() for this purpose
  * Returns an ID-list or "" if OK. Else -1 which means that somewhere there was no permission (eg. to delete).
  * if $recurse is set, then the function will follow subpages. This MUST be set, if we need the idlist for deleting pages or else we get an incomplete list
  *
  * @param string $inList List of page uids, this is added to and outputted in the end
  * @param int $pid Page ID to select subpages from.
  * @param int $perms Perms integer to check each page record for.
  * @param bool $recurse Recursion flag: If set, it will go out through the branch.
  * @return string List of integers in branch
  */
 public function doesBranchExist($inList, $pid, $perms, $recurse)
 {
     $pid = (int) $pid;
     $perms = (int) $perms;
     if ($pid >= 0) {
         $mres = $this->databaseConnection->exec_SELECTquery('uid, perms_userid, perms_groupid, perms_user, perms_group, perms_everybody', 'pages', 'pid=' . (int) $pid . $this->deleteClause('pages'), '', 'sorting');
         while ($row = $this->databaseConnection->sql_fetch_assoc($mres)) {
             // IF admin, then it's OK
             if ($this->admin || $this->BE_USER->doesUserHaveAccess($row, $perms)) {
                 $inList .= $row['uid'] . ',';
                 if ($recurse) {
                     // Follow the subpages recursively...
                     $inList = $this->doesBranchExist($inList, $row['uid'], $perms, $recurse);
                     if ($inList == -1) {
                         return -1;
                     }
                 }
             } else {
                 // No permissions
                 return -1;
             }
         }
         $this->databaseConnection->sql_free_result($mres);
     }
     return $inList;
 }
开发者ID:rickymathew,项目名称:TYPO3.CMS,代码行数:39,代码来源:DataHandler.php

示例2: doesBranchExist

 /**
  * Checks if a whole branch of pages exists
  *
  * Tests the branch under $pid (like doesRecordExist). It doesn't test the page with $pid as uid. Use doesRecordExist() for this purpose
  * Returns an ID-list or "" if OK. Else -1 which means that somewhere there was no permission (eg. to delete).
  * if $recurse is set, then the function will follow subpages. This MUST be set, if we need the idlist for deleting pages or else we get an incomplete list
  *
  * @param string $inList List of page uids, this is added to and outputted in the end
  * @param int $pid Page ID to select subpages from.
  * @param int $perms Perms integer to check each page record for.
  * @param bool $recurse Recursion flag: If set, it will go out through the branch.
  * @return string List of integers in branch
  */
 public function doesBranchExist($inList, $pid, $perms, $recurse)
 {
     $pid = (int) $pid;
     $perms = (int) $perms;
     if ($pid >= 0) {
         $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('pages');
         $this->addDeleteRestriction($queryBuilder->getRestrictions()->removeAll());
         $result = $queryBuilder->select('uid', 'perms_userid', 'perms_groupid', 'perms_user', 'perms_group', 'perms_everybody')->from('pages')->where($queryBuilder->expr()->eq('pid', $queryBuilder->createNamedParameter($pid, \PDO::PARAM_INT)))->orderBy('sorting')->execute();
         while ($row = $result->fetch()) {
             // IF admin, then it's OK
             if ($this->admin || $this->BE_USER->doesUserHaveAccess($row, $perms)) {
                 $inList .= $row['uid'] . ',';
                 if ($recurse) {
                     // Follow the subpages recursively...
                     $inList = $this->doesBranchExist($inList, $row['uid'], $perms, $recurse);
                     if ($inList == -1) {
                         return -1;
                     }
                 }
             } else {
                 // No permissions
                 return -1;
             }
         }
     }
     return $inList;
 }
开发者ID:,项目名称:,代码行数:40,代码来源:


注:本文中的TYPO3\CMS\Core\Authentication\BackendUserAuthentication::doesUserHaveAccess方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。