[FEATURE] Add slot for allowing ip-based authentication

This commit is contained in:
Marcus Schwemer 2017-07-10 14:46:21 +02:00
parent d54eefca58
commit a022a29b47
2 changed files with 37 additions and 0 deletions

View 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);
}
}

View file

@ -17,3 +17,14 @@ defined('TYPO3_MODE') || die();
'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'
);