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


PHP BackendUserAuthentication::getPagePermsClause方法代码示例

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


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

示例1: dispatchModule

 /**
  * Executes the modules configured via Extbase
  *
  * @param string $moduleName
  * @return Response A PSR-7 response object
  * @throws \RuntimeException
  */
 protected function dispatchModule($moduleName)
 {
     $moduleConfiguration = $this->getModuleConfiguration($moduleName);
     // Check permissions and exit if the user has no permission for entry
     $this->backendUserAuthentication->modAccess($moduleConfiguration, true);
     $id = isset($this->request->getQueryParams()['id']) ? $this->request->getQueryParams()['id'] : $this->request->getParsedBody()['id'];
     if ($id && MathUtility::canBeInterpretedAsInteger($id)) {
         // Check page access
         $permClause = $this->backendUserAuthentication->getPagePermsClause(true);
         $access = is_array(BackendUtility::readPageAccess((int) $id, $permClause));
         if (!$access) {
             throw new \RuntimeException('You don\'t have access to this page', 1289917924);
         }
     }
     /** @var Response $response */
     $response = GeneralUtility::makeInstance(Response::class);
     // Use Core Dispatching
     if (isset($moduleConfiguration['routeTarget'])) {
         $dispatcher = GeneralUtility::makeInstance(Dispatcher::class);
         $this->request = $this->request->withAttribute('target', $moduleConfiguration['routeTarget']);
         $response = $dispatcher->dispatch($this->request, $response);
     } else {
         // extbase module
         $configuration = array('extensionName' => $moduleConfiguration['extensionName'], 'pluginName' => $moduleName);
         if (isset($moduleConfiguration['vendorName'])) {
             $configuration['vendorName'] = $moduleConfiguration['vendorName'];
         }
         // Run Extbase
         $bootstrap = GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Core\Bootstrap::class);
         $content = $bootstrap->run('', $configuration);
         $response->getBody()->write($content);
     }
     return $response;
 }
开发者ID:Gregpl,项目名称:TYPO3.CMS,代码行数:41,代码来源:BackendModuleRequestHandler.php

示例2: makeValueList


//.........这里部分代码省略.........
         $useAltSelectLabels = 0;
         $tablePrefix = '';
         $labelFieldSelect = [];
         foreach ($from_table_Arr as $from_table) {
             if ($useTablePrefix && !$dontPrefixFirstTable && $counter != 1 || $counter == 1) {
                 $tablePrefix = $from_table . '_';
             }
             $counter = 1;
             if (is_array($GLOBALS['TCA'][$from_table])) {
                 $labelField = $GLOBALS['TCA'][$from_table]['ctrl']['label'];
                 $altLabelField = $GLOBALS['TCA'][$from_table]['ctrl']['label_alt'];
                 if ($GLOBALS['TCA'][$from_table]['columns'][$labelField]['config']['items']) {
                     $items = $GLOBALS['TCA'][$from_table]['columns'][$labelField]['config']['items'];
                     foreach ($items as $labelArray) {
                         if (substr($labelArray[0], 0, 4) == 'LLL:') {
                             $labelFieldSelect[$labelArray[1]] = $this->languageService->sL($labelArray[0]);
                         } else {
                             $labelFieldSelect[$labelArray[1]] = $labelArray[0];
                         }
                     }
                     $useSelectLabels = 1;
                 }
                 if ($GLOBALS['TCA'][$from_table]['columns'][$altLabelField]['config']['items']) {
                     $items = $GLOBALS['TCA'][$from_table]['columns'][$altLabelField]['config']['items'];
                     foreach ($items as $altLabelArray) {
                         if (substr($altLabelArray[0], 0, 4) == 'LLL:') {
                             $altLabelFieldSelect[$altLabelArray[1]] = $this->languageService->sL($altLabelArray[0]);
                         } else {
                             $altLabelFieldSelect[$altLabelArray[1]] = $altLabelArray[0];
                         }
                     }
                     $useAltSelectLabels = 1;
                 }
                 if (!$this->tableArray[$from_table]) {
                     $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable($from_table);
                     $queryBuilder->getRestrictions()->removeAll()->add(GeneralUtility::makeInstance(DeletedRestriction::class));
                     $selectFields = ['uid', $labelField];
                     if ($altLabelField) {
                         $selectFields[] = $altLabelField;
                     }
                     $queryBuilder->select(...$selectFields)->from($from_table)->orderBy('uid');
                     if (!$this->backendUserAuthentication->isAdmin() && $GLOBALS['TYPO3_CONF_VARS']['BE']['lockBeUserToDBmounts']) {
                         $webMounts = $this->backendUserAuthentication->returnWebmounts();
                         $perms_clause = $this->backendUserAuthentication->getPagePermsClause(1);
                         $webMountPageTree = '';
                         $webMountPageTreePrefix = '';
                         foreach ($webMounts as $webMount) {
                             if ($webMountPageTree) {
                                 $webMountPageTreePrefix = ',';
                             }
                             $webMountPageTree .= $webMountPageTreePrefix . $this->getTreeList($webMount, 999, $begin = 0, $perms_clause);
                         }
                         if ($from_table === 'pages') {
                             $queryBuilder->where(QueryHelper::stripLogicalOperatorPrefix($perms_clause), $queryBuilder->expr()->in('uid', $queryBuilder->createNamedParameter(GeneralUtility::intExplode(',', $webMountPageTree), Connection::PARAM_INT_ARRAY)));
                         } else {
                             $queryBuilder->where($queryBuilder->expr()->in('pid', $queryBuilder->createNamedParameter(GeneralUtility::intExplode(',', $webMountPageTree), Connection::PARAM_INT_ARRAY)));
                         }
                     }
                     $statement = $queryBuilder->execute();
                     $this->tableArray[$from_table] = [];
                     while ($row = $statement->fetch()) {
                         $this->tableArray[$from_table][] = $row;
                     }
                 }
                 foreach ($this->tableArray[$from_table] as $key => $val) {
                     $GLOBALS['SOBE']->MOD_SETTINGS['labels_noprefix'] = $GLOBALS['SOBE']->MOD_SETTINGS['labels_noprefix'] == 1 ? 'on' : $GLOBALS['SOBE']->MOD_SETTINGS['labels_noprefix'];
                     $prefixString = $GLOBALS['SOBE']->MOD_SETTINGS['labels_noprefix'] == 'on' ? '' : ' [' . $tablePrefix . $val['uid'] . '] ';
                     if (GeneralUtility::inList($fieldValue, $tablePrefix . $val['uid']) || $fieldValue == $tablePrefix . $val['uid']) {
                         if ($useSelectLabels) {
                             if (!$out) {
                                 $out = htmlspecialchars($prefixString . $labelFieldSelect[$val[$labelField]]);
                             } else {
                                 $out .= $splitString . htmlspecialchars($prefixString . $labelFieldSelect[$val[$labelField]]);
                             }
                         } elseif ($val[$labelField]) {
                             if (!$out) {
                                 $out = htmlspecialchars($prefixString . $val[$labelField]);
                             } else {
                                 $out .= $splitString . htmlspecialchars($prefixString . $val[$labelField]);
                             }
                         } elseif ($useAltSelectLabels) {
                             if (!$out) {
                                 $out = htmlspecialchars($prefixString . $altLabelFieldSelect[$val[$altLabelField]]);
                             } else {
                                 $out .= $splitString . htmlspecialchars($prefixString . $altLabelFieldSelect[$val[$altLabelField]]);
                             }
                         } else {
                             if (!$out) {
                                 $out = htmlspecialchars($prefixString . $val[$altLabelField]);
                             } else {
                                 $out .= $splitString . htmlspecialchars($prefixString . $val[$altLabelField]);
                             }
                         }
                     }
                 }
             }
         }
     }
     return $out;
 }
开发者ID:,项目名称:,代码行数:101,代码来源:

示例3: int_pageTreeInfo

 /**
  * Returns array, $CPtable, of pages under the $pid going down to $counter levels.
  * Selecting ONLY pages which the user has read-access to!
  *
  * @param array $CPtable Accumulation of page uid=>pid pairs in branch of $pid
  * @param int $pid Page ID for which to find subpages
  * @param int $counter Number of levels to go down.
  * @param int $rootID ID of root point for new copied branch: The idea seems to be that a copy is not made of the already new page!
  * @return array Return array.
  */
 public function int_pageTreeInfo($CPtable, $pid, $counter, $rootID)
 {
     if ($counter) {
         if ((int) $this->BE_USER->workspace === 0) {
             $workspaceStatement = ' AND t3ver_wsid=0';
         } else {
             $workspaceStatement = ' AND t3ver_wsid IN (0,' . (int) $this->BE_USER->workspace . ')';
         }
         $addW = !$this->admin ? ' AND ' . $this->BE_USER->getPagePermsClause($this->pMap['show']) : '';
         $pages = $this->databaseConnection->exec_SELECTgetRows('uid', 'pages', 'pid=' . (int) $pid . $this->deleteClause('pages') . $workspaceStatement . $addW, '', 'sorting DESC', '', 'uid');
         // Resolve placeholders of workspace versions
         if (!empty($pages) && (int) $this->BE_USER->workspace !== 0) {
             $pages = array_reverse($this->resolveVersionedRecords('pages', 'uid', 'sorting', array_keys($pages)), true);
         }
         foreach ($pages as $page) {
             if ($page['uid'] != $rootID) {
                 $CPtable[$page['uid']] = $pid;
                 // If the uid is NOT the rootID of the copyaction and if we are supposed to walk further down
                 if ($counter - 1) {
                     $CPtable = $this->int_pageTreeInfo($CPtable, $page['uid'], $counter - 1, $rootID);
                 }
             }
         }
     }
     return $CPtable;
 }
开发者ID:rickymathew,项目名称:TYPO3.CMS,代码行数:36,代码来源:DataHandler.php

示例4: int_pageTreeInfo

 /**
  * Returns array, $CPtable, of pages under the $pid going down to $counter levels.
  * Selecting ONLY pages which the user has read-access to!
  *
  * @param array $CPtable Accumulation of page uid=>pid pairs in branch of $pid
  * @param int $pid Page ID for which to find subpages
  * @param int $counter Number of levels to go down.
  * @param int $rootID ID of root point for new copied branch: The idea seems to be that a copy is not made of the already new page!
  * @return array Return array.
  */
 public function int_pageTreeInfo($CPtable, $pid, $counter, $rootID)
 {
     if ($counter) {
         $addW = !$this->admin ? ' AND ' . $this->BE_USER->getPagePermsClause($this->pMap['show']) : '';
         $mres = $this->databaseConnection->exec_SELECTquery('uid', 'pages', 'pid=' . (int) $pid . $this->deleteClause('pages') . $addW, '', 'sorting DESC');
         while ($row = $this->databaseConnection->sql_fetch_assoc($mres)) {
             if ($row['uid'] != $rootID) {
                 $CPtable[$row['uid']] = $pid;
                 // If the uid is NOT the rootID of the copyaction and if we are supposed to walk further down
                 if ($counter - 1) {
                     $CPtable = $this->int_pageTreeInfo($CPtable, $row['uid'], $counter - 1, $rootID);
                 }
             }
         }
         $this->databaseConnection->sql_free_result($mres);
     }
     return $CPtable;
 }
开发者ID:plan2net,项目名称:TYPO3.CMS,代码行数:28,代码来源:DataHandler.php

示例5: makeValueList


//.........这里部分代码省略.........
         $labelFieldSelect = [];
         foreach ($from_table_Arr as $from_table) {
             if ($useTablePrefix && !$dontPrefixFirstTable && $counter != 1 || $counter == 1) {
                 $tablePrefix = $from_table . '_';
             }
             $counter = 1;
             if (is_array($GLOBALS['TCA'][$from_table])) {
                 $labelField = $GLOBALS['TCA'][$from_table]['ctrl']['label'];
                 $altLabelField = $GLOBALS['TCA'][$from_table]['ctrl']['label_alt'];
                 if ($GLOBALS['TCA'][$from_table]['columns'][$labelField]['config']['items']) {
                     $items = $GLOBALS['TCA'][$from_table]['columns'][$labelField]['config']['items'];
                     foreach ($items as $labelArray) {
                         if (substr($labelArray[0], 0, 4) == 'LLL:') {
                             $labelFieldSelect[$labelArray[1]] = $this->languageService->sL($labelArray[0]);
                         } else {
                             $labelFieldSelect[$labelArray[1]] = $labelArray[0];
                         }
                     }
                     $useSelectLabels = 1;
                 }
                 if ($GLOBALS['TCA'][$from_table]['columns'][$altLabelField]['config']['items']) {
                     $items = $GLOBALS['TCA'][$from_table]['columns'][$altLabelField]['config']['items'];
                     foreach ($items as $altLabelArray) {
                         if (substr($altLabelArray[0], 0, 4) == 'LLL:') {
                             $altLabelFieldSelect[$altLabelArray[1]] = $this->languageService->sL($altLabelArray[0]);
                         } else {
                             $altLabelFieldSelect[$altLabelArray[1]] = $altLabelArray[0];
                         }
                     }
                     $useAltSelectLabels = 1;
                 }
                 $altLabelFieldSelect = $altLabelField ? ',' . $altLabelField : '';
                 $select_fields = 'uid,' . $labelField . $altLabelFieldSelect;
                 if (!$this->backendUserAuthentication->isAdmin() && $GLOBALS['TYPO3_CONF_VARS']['BE']['lockBeUserToDBmounts']) {
                     $webMounts = $this->backendUserAuthentication->returnWebmounts();
                     $perms_clause = $this->backendUserAuthentication->getPagePermsClause(1);
                     $webMountPageTree = '';
                     $webMountPageTreePrefix = '';
                     foreach ($webMounts as $key => $val) {
                         if ($webMountPageTree) {
                             $webMountPageTreePrefix = ',';
                         }
                         $webMountPageTree .= $webMountPageTreePrefix . $this->getTreeList($val, 999, $begin = 0, $perms_clause);
                     }
                     if ($from_table == 'pages') {
                         $where_clause = 'uid IN (' . $webMountPageTree . ') ' . BackendUtility::deleteClause($from_table) . ' AND ' . $perms_clause;
                     } else {
                         $where_clause = 'pid IN (' . $webMountPageTree . ') ' . BackendUtility::deleteClause($from_table);
                     }
                 } else {
                     $where_clause = 'uid' . BackendUtility::deleteClause($from_table);
                 }
                 $orderBy = 'uid';
                 $res = null;
                 if (!$this->tableArray[$from_table]) {
                     $res = $this->databaseConnection->exec_SELECTquery($select_fields, $from_table, $where_clause, $groupBy = '', $orderBy);
                     $this->tableArray[$from_table] = array();
                 }
                 if ($res) {
                     while ($row = $this->databaseConnection->sql_fetch_assoc($res)) {
                         $this->tableArray[$from_table][] = $row;
                     }
                     $this->databaseConnection->sql_free_result($res);
                 }
                 foreach ($this->tableArray[$from_table] as $key => $val) {
                     $GLOBALS['SOBE']->MOD_SETTINGS['labels_noprefix'] = $GLOBALS['SOBE']->MOD_SETTINGS['labels_noprefix'] == 1 ? 'on' : $GLOBALS['SOBE']->MOD_SETTINGS['labels_noprefix'];
                     $prefixString = $GLOBALS['SOBE']->MOD_SETTINGS['labels_noprefix'] == 'on' ? '' : ' [' . $tablePrefix . $val['uid'] . '] ';
                     if (GeneralUtility::inList($fieldValue, $tablePrefix . $val['uid']) || $fieldValue == $tablePrefix . $val['uid']) {
                         if ($useSelectLabels) {
                             if (!$out) {
                                 $out = htmlspecialchars($prefixString . $labelFieldSelect[$val[$labelField]]);
                             } else {
                                 $out .= $splitString . htmlspecialchars($prefixString . $labelFieldSelect[$val[$labelField]]);
                             }
                         } elseif ($val[$labelField]) {
                             if (!$out) {
                                 $out = htmlspecialchars($prefixString . $val[$labelField]);
                             } else {
                                 $out .= $splitString . htmlspecialchars($prefixString . $val[$labelField]);
                             }
                         } elseif ($useAltSelectLabels) {
                             if (!$out) {
                                 $out = htmlspecialchars($prefixString . $altLabelFieldSelect[$val[$altLabelField]]);
                             } else {
                                 $out .= $splitString . htmlspecialchars($prefixString . $altLabelFieldSelect[$val[$altLabelField]]);
                             }
                         } else {
                             if (!$out) {
                                 $out = htmlspecialchars($prefixString . $val[$altLabelField]);
                             } else {
                                 $out .= $splitString . htmlspecialchars($prefixString . $val[$altLabelField]);
                             }
                         }
                     }
                 }
             }
         }
     }
     return $out;
 }
开发者ID:dachcom-digital,项目名称:TYPO3.CMS,代码行数:101,代码来源:QueryView.php

示例6: int_pageTreeInfo

 /**
  * Returns array, $CPtable, of pages under the $pid going down to $counter levels.
  * Selecting ONLY pages which the user has read-access to!
  *
  * @param array $CPtable Accumulation of page uid=>pid pairs in branch of $pid
  * @param int $pid Page ID for which to find subpages
  * @param int $counter Number of levels to go down.
  * @param int $rootID ID of root point for new copied branch: The idea seems to be that a copy is not made of the already new page!
  * @return array Return array.
  */
 public function int_pageTreeInfo($CPtable, $pid, $counter, $rootID)
 {
     if ($counter) {
         $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('pages');
         $restrictions = $queryBuilder->getRestrictions()->removeAll();
         $this->addDeleteRestriction($restrictions);
         $queryBuilder->select('uid')->from('pages')->where($queryBuilder->expr()->eq('pid', $queryBuilder->createNamedParameter($pid, \PDO::PARAM_INT)))->orderBy('sorting', 'DESC');
         if (!$this->admin) {
             $queryBuilder->andWhere($this->BE_USER->getPagePermsClause($this->pMap['show']));
         }
         if ((int) $this->BE_USER->workspace === 0) {
             $queryBuilder->andWhere($queryBuilder->expr()->eq('t3ver_wsid', $queryBuilder->createNamedParameter(0, \PDO::PARAM_INT)));
         } else {
             $queryBuilder->andWhere($queryBuilder->expr()->in('t3ver_wsid', $queryBuilder->createNamedParameter([0, $this->BE_USER->workspace], Connection::PARAM_INT_ARRAY)));
         }
         $result = $queryBuilder->execute();
         $pages = [];
         while ($row = $result->fetch()) {
             $pages[$row['uid']] = $row;
         }
         // Resolve placeholders of workspace versions
         if (!empty($pages) && (int) $this->BE_USER->workspace !== 0) {
             $pages = array_reverse($this->resolveVersionedRecords('pages', 'uid', 'sorting', array_keys($pages)), true);
         }
         foreach ($pages as $page) {
             if ($page['uid'] != $rootID) {
                 $CPtable[$page['uid']] = $pid;
                 // If the uid is NOT the rootID of the copyaction and if we are supposed to walk further down
                 if ($counter - 1) {
                     $CPtable = $this->int_pageTreeInfo($CPtable, $page['uid'], $counter - 1, $rootID);
                 }
             }
         }
     }
     return $CPtable;
 }
开发者ID:,项目名称:,代码行数:46,代码来源:


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