‪TYPO3CMS  10.4
TcaDisplayConditions.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 
18 namespace ‪TYPO3\CMS\Core\Hooks;
19 
22 
29 {
36  public function ‪isExtensionInstalled(array $parameters): bool
37  {
38  $extension = $parameters['conditionParameters'][0] ?? '';
39  if (!empty($extension)) {
40  return ‪ExtensionManagementUtility::isLoaded($extension);
41  }
42  return false;
43  }
44 
51  public function ‪isIPLockEnabled(array $parameters): bool
52  {
53  $type = $parameters['conditionParameters'][0] ?? 'backend';
54  if ($type === 'backend') {
55  return (int)‪$GLOBALS['TYPO3_CONF_VARS']['BE']['ipLock'] > 0 || (int)‪$GLOBALS['TYPO3_CONF_VARS']['BE']['lockIPv6'] > 0;
56  }
57  if ($type === 'frontend') {
58  return (int)‪$GLOBALS['TYPO3_CONF_VARS']['FE']['ipLock'] > 0 || (int)‪$GLOBALS['TYPO3_CONF_VARS']['FE']['lockIPv6'] > 0;
59  }
60  return false;
61  }
62 
71  public function ‪isRecordCurrentUser(array $parameters): bool
72  {
73  $backendUser = $this->‪getBackendUser();
74  $isCurrentUser = (int)($parameters['record']['uid'] ?? 0) === (int)$backendUser->user[$backendUser->userid_column];
75  return strtolower($parameters['conditionParameters'][0] ?? 'true') !== 'true' ? !$isCurrentUser : $isCurrentUser;
76  }
78  {
79  return ‪$GLOBALS['BE_USER'];
80  }
81 }
‪TYPO3\CMS\Core\Utility\ExtensionManagementUtility
Definition: ExtensionManagementUtility.php:43
‪TYPO3\CMS\Core\Hooks\TcaDisplayConditions\isRecordCurrentUser
‪bool isRecordCurrentUser(array $parameters)
Definition: TcaDisplayConditions.php:71
‪TYPO3\CMS\Core\Hooks\TcaDisplayConditions\isIPLockEnabled
‪bool isIPLockEnabled(array $parameters)
Definition: TcaDisplayConditions.php:51
‪TYPO3\CMS\Core\Hooks\TcaDisplayConditions
Definition: TcaDisplayConditions.php:29
‪TYPO3\CMS\Core\Authentication\BackendUserAuthentication
Definition: BackendUserAuthentication.php:62
‪TYPO3\CMS\Core\Hooks\TcaDisplayConditions\isExtensionInstalled
‪bool isExtensionInstalled(array $parameters)
Definition: TcaDisplayConditions.php:36
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:5
‪TYPO3\CMS\Core\Hooks\TcaDisplayConditions\getBackendUser
‪getBackendUser()
Definition: TcaDisplayConditions.php:77
‪TYPO3\CMS\Core\Utility\ExtensionManagementUtility\isLoaded
‪static bool isLoaded($key)
Definition: ExtensionManagementUtility.php:114
‪TYPO3\CMS\Core\Hooks
Definition: BackendUserGroupIntegrityCheck.php:16