‪TYPO3CMS  ‪main
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 {
35  public function ‪getAvailableFrontendUserGroups(): array
36  {
37  $optionCount = $this->‪getUserGroupOptionCountByBackendUser($this->‪getBackendUser());
38 
39  $frontendGroups = [];
40  if ($optionCount > 0) {
41  $frontendGroups = $this->‪getUserGroupsForPagesByBackendUser($this->‪getBackendUser());
42  }
43 
44  return $frontendGroups;
45  }
46 
51  {
52  $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
53  ->getQueryBuilderForTable('fe_groups');
54 
55  $optionCount = $queryBuilder->count('fe_groups.uid')
56  ->from('fe_groups', 'fe_groups')
57  ->innerJoin(
58  'fe_groups',
59  'pages',
60  'pages',
61  $queryBuilder->expr()->eq('pages.uid', $queryBuilder->quoteIdentifier('fe_groups.pid'))
62  )
63  ->where(
65  )
66  ->executeQuery()
67  ->fetchOne();
68 
69  return (int)$optionCount;
70  }
71 
76  {
77  $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
78  ->getQueryBuilderForTable('fe_groups');
79 
80  return $queryBuilder->select('fe_groups.uid', 'fe_groups.title')
81  ->from('fe_groups')
82  ->innerJoin(
83  'fe_groups',
84  'pages',
85  'pages',
86  $queryBuilder->expr()->eq('pages.uid', $queryBuilder->quoteIdentifier('fe_groups.pid'))
87  )
88  ->where(
90  )
91  ->orderBy('fe_groups.title')
92  ->executeQuery()
93  ->fetchAllAssociative();
94  }
95 
97  {
98  return ‪$GLOBALS['BE_USER'];
99  }
100 }
‪TYPO3\CMS\Adminpanel\Repositories\FrontendGroupsRepository\getBackendUser
‪getBackendUser()
Definition: FrontendGroupsRepository.php:96
‪TYPO3\CMS\Adminpanel\Repositories\FrontendGroupsRepository\getUserGroupsForPagesByBackendUser
‪getUserGroupsForPagesByBackendUser(FrontendBackendUserAuthentication $beUser)
Definition: FrontendGroupsRepository.php:75
‪TYPO3\CMS\Core\Authentication\BackendUserAuthentication\getPagePermsClause
‪string getPagePermsClause($perms)
Definition: BackendUserAuthentication.php:400
‪TYPO3\CMS\Backend\FrontendBackendUserAuthentication
Definition: FrontendBackendUserAuthentication.php:29
‪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
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:25
‪TYPO3\CMS\Adminpanel\Repositories\FrontendGroupsRepository\getAvailableFrontendUserGroups
‪getAvailableFrontendUserGroups()
Definition: FrontendGroupsRepository.php:35
‪TYPO3\CMS\Core\Database\ConnectionPool
Definition: ConnectionPool.php:46
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:52
‪TYPO3\CMS\Adminpanel\Repositories\FrontendGroupsRepository\getUserGroupOptionCountByBackendUser
‪getUserGroupOptionCountByBackendUser(FrontendBackendUserAuthentication $beUser)
Definition: FrontendGroupsRepository.php:50