當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。