[FEATURE] Add slot for allowing ip-based authentication
This commit is contained in:
parent
d54eefca58
commit
a022a29b47
2 changed files with 37 additions and 0 deletions
26
Classes/Slot/AddCustomGroupsSlot.php
Normal file
26
Classes/Slot/AddCustomGroupsSlot.php
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
<?php
|
||||||
|
namespace In2code\In2frontendauthentication\Slot;
|
||||||
|
|
||||||
|
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||||
|
use TYPO3\CMS\Extbase\Object\ObjectManager;
|
||||||
|
use In2code\In2frontendauthentication\Domain\Repository\FeGroupsRepository;
|
||||||
|
|
||||||
|
class AddCustomGroupsSlot
|
||||||
|
{
|
||||||
|
|
||||||
|
public function addCustomGroups($checkPermissions)
|
||||||
|
{
|
||||||
|
$feGroupsRepository = GeneralUtility::makeInstance(ObjectManager::class)
|
||||||
|
->get(FeGroupsRepository::class);
|
||||||
|
$feGroups = $feGroupsRepository->findByCurrentIpAddress();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$customGroups = [];
|
||||||
|
foreach ($feGroups as $feGroup) {
|
||||||
|
$customGroups[] = $feGroup['uid'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$checkPermissions->addCustomGroups($customGroups);
|
||||||
|
}
|
||||||
|
}
|
|
@ -17,3 +17,14 @@ defined('TYPO3_MODE') || die();
|
||||||
'className' => \In2code\In2frontendauthentication\Domain\Service\AuthenticationService::class,
|
'className' => \In2code\In2frontendauthentication\Domain\Service\AuthenticationService::class,
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/** @var \TYPO3\CMS\Extbase\SignalSlot\Dispatcher $signalSlotDispatcher */
|
||||||
|
$signalSlotDispatcher = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\SignalSlot\\Dispatcher');
|
||||||
|
$signalSlotDispatcher->connect(
|
||||||
|
\BeechIt\FalSecuredownload\Security\CheckPermissions::class,
|
||||||
|
'AddCustomGroups',
|
||||||
|
\In2code\In2frontendauthentication\Slot\AddCustomGroupsSlot::class,
|
||||||
|
'addCustomGroups'
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
Reference in a new issue