‪TYPO3CMS  11.5
FrontendGroupsRepository.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
19 
24 
31 {
37  public function ‪getAvailableFrontendUserGroups(): array
38  {
39  $optionCount = $this->‪getUserGroupOptionCountByBackendUser($this->‪getBackendUser());
40 
41  $frontendGroups = [];
42  if ($optionCount > 0) {
43  $frontendGroups = $this->‪getUserGroupsForPagesByBackendUser($this->‪getBackendUser());
44  }
45 
46  return $frontendGroups;
47  }
48 
56  {
57  $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
58  ->getQueryBuilderForTable('fe_groups');
59 
60  $optionCount = $queryBuilder->count('fe_groups.uid')
61  ->from('fe_groups', 'fe_groups')
62  ->innerJoin(
63  'fe_groups',
64  'pages',
65  'pages',
66  $queryBuilder->expr()->eq('pages.uid', $queryBuilder->quoteIdentifier('fe_groups.pid'))
67  )
68  ->where(
70  )
71  ->executeQuery()
72  ->fetchOne();
73 
74  return (int)$optionCount;
75  }
76 
84  {
85  $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
86  ->getQueryBuilderForTable('fe_groups');
87 
88  return $queryBuilder->select('fe_groups.uid', 'fe_groups.title')
89  ->from('fe_groups')
90  ->innerJoin(
91  'fe_groups',
92  'pages',
93  'pages',
94  $queryBuilder->expr()->eq('pages.uid', $queryBuilder->quoteIdentifier('fe_groups.pid'))
95  )
96  ->where(
98  )
99  ->orderBy('fe_groups.title')
100  ->executeQuery()
101  ->fetchAllAssociative();
102  }
103 
110  {
111  return ‪$GLOBALS['BE_USER'];
112  }
113 }
‪TYPO3\CMS\Adminpanel\Repositories\FrontendGroupsRepository\getUserGroupOptionCountByBackendUser
‪int getUserGroupOptionCountByBackendUser(FrontendBackendUserAuthentication $beUser)
Definition: FrontendGroupsRepository.php:55
‪TYPO3\CMS\Core\Authentication\BackendUserAuthentication\getPagePermsClause
‪string getPagePermsClause($perms)
Definition: BackendUserAuthentication.php:460
‪TYPO3\CMS\Backend\FrontendBackendUserAuthentication
Definition: FrontendBackendUserAuthentication.php:31
‪TYPO3\CMS\Adminpanel\Repositories\FrontendGroupsRepository\getAvailableFrontendUserGroups
‪array getAvailableFrontendUserGroups()
Definition: FrontendGroupsRepository.php:37
‪TYPO3\CMS\Adminpanel\Repositories\FrontendGroupsRepository
Definition: FrontendGroupsRepository.php:31
‪TYPO3\CMS\Adminpanel\Repositories
Definition: FrontendGroupsRepository.php:18
‪TYPO3\CMS\Core\Type\Bitmask\Permission
Definition: Permission.php:26
‪TYPO3\CMS\Core\Type\Bitmask\Permission\PAGE_SHOW
‪const PAGE_SHOW
Definition: Permission.php:35
‪TYPO3\CMS\Adminpanel\Repositories\FrontendGroupsRepository\getBackendUser
‪FrontendBackendUserAuthentication getBackendUser()
Definition: FrontendGroupsRepository.php:109
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:25
‪TYPO3\CMS\Core\Database\ConnectionPool
Definition: ConnectionPool.php:46
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:50
‪TYPO3\CMS\Adminpanel\Repositories\FrontendGroupsRepository\getUserGroupsForPagesByBackendUser
‪array getUserGroupsForPagesByBackendUser(FrontendBackendUserAuthentication $beUser)
Definition: FrontendGroupsRepository.php:83