Merge pull request #1 from mschwemer/feature/slot_for_fal-securedownload

[FEATURE] Add slot for allowing ip-based authentication
This commit is contained in:
Alex Kellner 2017-07-10 15:28:55 +02:00 committed by GitHub
commit ee6b03afbc
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, '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'
);