From 55ccbb58bfad22dff977983aa7593d962eafbe23 Mon Sep 17 00:00:00 2001 From: Stephan Gonder Date: Fri, 25 Mar 2022 15:35:44 +0100 Subject: [PATCH] changelist: - add kitodo basket behaviour with user notification - adjust fe_user registration process - change user access for kitodo documents --- .gitignore | 1 + .../DeleteDeactivatedAccountsCommand.php | 2 +- .../Command/DeleteInactiveAccountsCommand.php | 2 +- Classes/Command/DigasBaseCommand.php | 117 +++++- .../KitodoAccessExpirationNotification.php | 175 ++++++++ .../KitodoAccessGrantedNotification.php | 154 +++++++ .../Command/RemindUnusedAccountsCommand.php | 16 +- Classes/Controller/AccessController.php | 391 +++++++++++++++++ .../Controller/AdministrationController.php | 12 +- Classes/Controller/BasketController.php | 329 +++++++++++++++ Classes/Controller/ExtendController.php | 120 +++++- Classes/Controller/NewController.php | 5 + Classes/Domain/Model/Access.php | 394 ++++++++++++++++++ Classes/Domain/Model/User.php | 285 ++++++++++--- .../Domain/Repository/AccessRepository.php | 177 ++++++++ .../Repository/KitodoDocumentRepository.php | 76 ++++ Classes/Domain/Repository/UserRepository.php | 24 +- Classes/Slots/AfterPasswordChange.php | 155 +++++++ .../ViewHelpers/KitodoAccessViewHelper.php | 38 +- .../ViewHelpers/KitodoSessionViewHelper.php | 83 ++++ Classes/ViewHelpers/RedirectViewHelper.php | 28 ++ Configuration/Commands.php | 6 + Configuration/FlexForms/FlexFormBasket.xml | 40 ++ .../PageTSconfig/Setup/femanager.typoscript | 6 +- Configuration/PageTSconfig/setup.typoscript | 0 Configuration/TCA/Overrides/fe_users.php | 150 ++++--- Configuration/TCA/Overrides/tt_content.php | 29 ++ ..._digasfemanagement_domain_model_access.php | 148 +++++++ .../Setup/Extensions/config/setup.typoscript | 25 ++ .../Extensions/fe_login/setup.typoscript | 24 +- .../Extensions/femanager/00-config.typoscript | 24 +- .../femanager/10-setup-create.typoscript | 28 +- .../femanager/20-setup-edit.typoscript | 19 +- .../30-setup-administration.typoscript | 3 +- ...etup-administration-invatiation.typoscript | 20 +- .../femanager/50-setup-temp-user.typoscript | 138 ++++++ .../60-setup-request-kitodo-access.typoscript | 35 ++ Configuration/TypoScript/constants.typoscript | 34 +- Configuration/TypoScript/setup.typoscript | 2 +- .../Partials/ChangeEmail/Fields/Email.html | 17 + .../Fields/AdministrationCompanyType.html | 13 +- .../Partials/Fields/CompanyType.html | 39 +- .../femanager/Partials/Fields/Country.html | 2 +- .../femanager/Partials/Fields/Disable.html | 8 +- .../femanager/Partials/Fields/District.html | 16 + .../femanager/Partials/Fields/FirstName.html | 35 +- .../femanager/Partials/Fields/Gender.html | 49 +-- .../Partials/Fields/KitodoFeuserAccess.html | 15 - .../Partials/Fields/TempUserAreaLocation.html | 16 + .../Fields/TempUserOrderingParty.html | 16 + .../Partials/Fields/TempUserPurpose.html | 16 + .../femanager/Partials/Fields/Usergroup.html | 2 +- .../Email/CreateUserConfirmation.html | 22 +- .../Templates/Email/CreateUserNotify.html | 17 + .../Email/CreateUserNotifyAfterPwChange.html | 17 + .../Templates/Email/RequestKitodoAccess.html | 11 + .../Email/RequestKitodoAccessUser.html | 11 + .../femanager/Templates/Extend/Dialog.html | 67 +++ .../femanager/Templates/Extend/Disable.html | 4 +- .../femanager/Templates/TempUser/New/New.html | 42 ++ .../slub_web_digas/Layouts/KitodoPage.html | 31 +- Resources/Private/Language/de.locallang.xlf | 370 ++++++++++++++-- .../Private/Language/de.locallang_db.xlf | 117 ++++-- Resources/Private/Language/locallang.xlf | 268 +++++++++++- Resources/Private/Language/locallang_db.xlf | 92 +++- .../Private/Partials/Access/AccessItem.html | 80 ++++ .../Private/Partials/Access/DateFields.html | 39 ++ .../Partials/Administration/ListItems.html | 18 +- Resources/Private/Partials/Basket/Table.html | 37 ++ .../Partials/Basket/TableOldRequests.html | 40 ++ Resources/Private/Templates/Access/List.html | 86 ++++ Resources/Private/Templates/Access/New.html | 37 ++ .../Templates/Access/RejectReason.html | 39 ++ .../Templates/Administration/EditUser.html | 18 +- .../Templates/Administration/Show.html | 16 +- Resources/Private/Templates/Basket/Index.html | 45 ++ .../Private/Templates/Basket/Overview.html | 48 +++ .../KitodoAccessExpirationNotification.html | 10 + .../Html/KitodoAccessGrantedNotification.html | 30 ++ .../KitodoAccessExpirationNotification.html | 11 + .../Text/KitodoAccessGrantedNotification.html | 16 + Resources/Public/Css/dialog.css | 15 + Resources/Public/Css/digasBasket.css | 113 +++++ ..._digasfemanagement_domain_model_access.gif | Bin 0 -> 533 bytes Resources/Public/Js/Classes/DigasBasket.js | 157 +++++++ ext_icon.png | Bin ext_localconf.php | 41 +- ext_tables.sql | 20 +- 88 files changed, 5099 insertions(+), 445 deletions(-) create mode 100644 Classes/Command/KitodoAccessExpirationNotification.php create mode 100644 Classes/Command/KitodoAccessGrantedNotification.php create mode 100644 Classes/Controller/AccessController.php create mode 100644 Classes/Controller/BasketController.php create mode 100644 Classes/Domain/Model/Access.php create mode 100644 Classes/Domain/Repository/AccessRepository.php create mode 100644 Classes/Domain/Repository/KitodoDocumentRepository.php create mode 100644 Classes/Slots/AfterPasswordChange.php create mode 100644 Classes/ViewHelpers/KitodoSessionViewHelper.php create mode 100644 Configuration/FlexForms/FlexFormBasket.xml mode change 100755 => 100644 Configuration/PageTSconfig/setup.typoscript create mode 100644 Configuration/TCA/tx_digasfemanagement_domain_model_access.php create mode 100644 Configuration/TypoScript/Setup/Extensions/femanager/50-setup-temp-user.typoscript create mode 100644 Configuration/TypoScript/Setup/Extensions/femanager/60-setup-request-kitodo-access.typoscript create mode 100644 Resources/Private/Extensions/femanager/Partials/ChangeEmail/Fields/Email.html create mode 100644 Resources/Private/Extensions/femanager/Partials/Fields/District.html delete mode 100644 Resources/Private/Extensions/femanager/Partials/Fields/KitodoFeuserAccess.html create mode 100644 Resources/Private/Extensions/femanager/Partials/Fields/TempUserAreaLocation.html create mode 100644 Resources/Private/Extensions/femanager/Partials/Fields/TempUserOrderingParty.html create mode 100644 Resources/Private/Extensions/femanager/Partials/Fields/TempUserPurpose.html create mode 100644 Resources/Private/Extensions/femanager/Templates/Email/CreateUserNotify.html create mode 100644 Resources/Private/Extensions/femanager/Templates/Email/CreateUserNotifyAfterPwChange.html create mode 100644 Resources/Private/Extensions/femanager/Templates/Email/RequestKitodoAccess.html create mode 100644 Resources/Private/Extensions/femanager/Templates/Email/RequestKitodoAccessUser.html create mode 100644 Resources/Private/Extensions/femanager/Templates/Extend/Dialog.html create mode 100644 Resources/Private/Extensions/femanager/Templates/TempUser/New/New.html mode change 100755 => 100644 Resources/Private/Extensions/slub_web_digas/Layouts/KitodoPage.html create mode 100644 Resources/Private/Partials/Access/AccessItem.html create mode 100644 Resources/Private/Partials/Access/DateFields.html create mode 100644 Resources/Private/Partials/Basket/Table.html create mode 100644 Resources/Private/Partials/Basket/TableOldRequests.html create mode 100644 Resources/Private/Templates/Access/List.html create mode 100644 Resources/Private/Templates/Access/New.html create mode 100644 Resources/Private/Templates/Access/RejectReason.html create mode 100644 Resources/Private/Templates/Basket/Index.html create mode 100644 Resources/Private/Templates/Basket/Overview.html create mode 100644 Resources/Private/Templates/Email/Html/KitodoAccessExpirationNotification.html create mode 100644 Resources/Private/Templates/Email/Html/KitodoAccessGrantedNotification.html create mode 100644 Resources/Private/Templates/Email/Text/KitodoAccessExpirationNotification.html create mode 100644 Resources/Private/Templates/Email/Text/KitodoAccessGrantedNotification.html create mode 100644 Resources/Public/Css/dialog.css create mode 100644 Resources/Public/Css/digasBasket.css create mode 100644 Resources/Public/Icons/tx_digasfemanagement_domain_model_access.gif create mode 100644 Resources/Public/Js/Classes/DigasBasket.js mode change 100755 => 100644 ext_icon.png diff --git a/.gitignore b/.gitignore index 722d5e7..aafda3a 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ .vscode +.idea diff --git a/Classes/Command/DeleteDeactivatedAccountsCommand.php b/Classes/Command/DeleteDeactivatedAccountsCommand.php index 0794696..7f9d17f 100644 --- a/Classes/Command/DeleteDeactivatedAccountsCommand.php +++ b/Classes/Command/DeleteDeactivatedAccountsCommand.php @@ -84,7 +84,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $time = new \DateTime(); $deleteTimestamp = $time->getTimestamp() - ((60 * 60 * 24) * $timespan); - $feUsers = $this->UserRepository->findDeactivatedAccounts($deleteTimestamp, $this->settings['feUserGroup']); + $feUsers = $this->UserRepository->findDeactivatedAccounts($deleteTimestamp, $this->feUserGroups); if (!empty($feUsers)) { $deleteCounter = $this->deleteFeUsers($feUsers); diff --git a/Classes/Command/DeleteInactiveAccountsCommand.php b/Classes/Command/DeleteInactiveAccountsCommand.php index 77e4045..54c874e 100644 --- a/Classes/Command/DeleteInactiveAccountsCommand.php +++ b/Classes/Command/DeleteInactiveAccountsCommand.php @@ -82,7 +82,7 @@ protected function execute(InputInterface $input, OutputInterface $output) } $deleteTimespan = time() - (60 * 60 * (int)$timespan); - $feUsers = $this->UserRepository->findInactiveAccounts($deleteTimespan, $this->settings['feUserGroup']); + $feUsers = $this->UserRepository->findInactiveAccounts($deleteTimespan, $this->feUserGroups); if (!empty($feUsers)) { $deleteCounter = $this->deleteFeUsers($feUsers); diff --git a/Classes/Command/DigasBaseCommand.php b/Classes/Command/DigasBaseCommand.php index 21d42dc..ed141b6 100644 --- a/Classes/Command/DigasBaseCommand.php +++ b/Classes/Command/DigasBaseCommand.php @@ -25,6 +25,9 @@ * This copyright notice MUST APPEAR in all copies of the script! ***************************************************************/ +use Slub\DigasFeManagement\Domain\Model\Access; +use Slub\DigasFeManagement\Domain\Model\User; +use Slub\DigasFeManagement\Domain\Repository\AccessRepository; use Slub\DigasFeManagement\Domain\Repository\UserRepository; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; @@ -34,6 +37,7 @@ use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Extbase\Object\ObjectManager; use TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager; +use TYPO3\CMS\Fluid\View\StandaloneView; /** * Class DigasBaseCommand @@ -51,6 +55,11 @@ class DigasBaseCommand extends Command */ protected $UserRepository; + /** + * @var AccessRepository + */ + protected $AccessRepository; + /** * @var PersistenceManager */ @@ -66,6 +75,11 @@ class DigasBaseCommand extends Command */ protected $settings; + /** + * @var array + */ + protected $feUserGroups; + /** * @param InputInterface $input * @param OutputInterface $output @@ -76,6 +90,7 @@ public function initialize(InputInterface $input, OutputInterface $output) $this->objectManager = GeneralUtility::makeInstance(ObjectManager::class); $this->UserRepository = $this->objectManager->get(UserRepository::class); + $this->AccessRepository = $this->objectManager->get(AccessRepository::class); $this->persistenceManager = $this->objectManager->get(PersistenceManager::class); $configurationManager = $this->objectManager->get('TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface'); @@ -83,6 +98,8 @@ public function initialize(InputInterface $input, OutputInterface $output) if (!empty($extSettings = $typoscriptConfiguration['plugin.']['tx_femanager.']['settings.'])) { $this->settings = $extSettings; $this->UserRepository->setStoragePid($this->settings['pids.']['feUsers']); + $this->AccessRepository->setStoragePid($this->settings['pids.']['feUsers']); + $this->feUserGroups = explode(',', $this->settings['feUserGroups']); } } @@ -108,8 +125,8 @@ protected function execute(InputInterface $input, OutputInterface $output) return; } - if (empty($this->settings['feUserGroup'])) { - $this->io->error('[DiGAS FE Management] Typoscript variable {plugin.tx_femanager.settings.feUserGroup} is not set. Abort.'); + if (empty($this->settings['feUserGroups'])) { + $this->io->error('[DiGAS FE Management] Typoscript variable {plugin.tx_femanager.settings.feUserGroups} is not set. Abort.'); return; } @@ -145,4 +162,100 @@ protected function deleteFeUsers($feUsers) } return $deleteCounter; } + + /** + * Init user locale to send emails in users selected language + * + * @param \Slub\DigasFeManagement\Domain\Model\User $feUser + * @return void + */ + protected function initUserLocal(\Slub\DigasFeManagement\Domain\Model\User $feUser) + { + // hack to send english texts to user only if user registered on english page (sys_language_uid==1) + switch ($feUser->getLocale()) { + case '1': + setlocale(LC_ALL, 'en_US.utf8'); + $GLOBALS['LANG']->init('en'); + break; + case '0': + default: + setlocale(LC_ALL, 'de_DE.utf8'); + $GLOBALS['LANG']->init('de'); + break; + } + } + + /** + * Prepare notification email for kitodo access + * + * @param User $feUser + * @param Access[] $userDocumentEntries + * @throws \TYPO3\CMS\Extbase\Persistence\Exception\IllegalObjectTypeException + * @throws \TYPO3\CMS\Extbase\Persistence\Exception\UnknownObjectException + */ + protected function notifyUser(User $feUser, array $userDocumentEntries) + { + // get fe_user data + if (!empty($feUser) && !empty($userDocumentEntries)) { + $documentsList = []; + foreach ($userDocumentEntries as $accessEntry) { + $documentsList[] = [ + 'recordId' => $accessEntry->getDlfDocument()->getRecordId(), + 'documentTitle' => $accessEntry->getDlfDocument()->getTitle(), + 'rejected' => $accessEntry->getRejected(), + 'rejectedReason' => $accessEntry->getRejectedReason() + ]; + + $notificationTimestamp = strtotime('now'); + $this->updateAccessEntry($accessEntry, $notificationTimestamp); + } + + $this->sendNotificationEmail($feUser, $documentsList); + } + } + + /** + * Generate notification mail content + * + * @param array $documentsList List of kitodo documents + * @param string $emailTemplate Path to email template + * @param string $emailType Email type (html or text) + * @return string + */ + protected function generateNotificationEmail(array $documentsList, string $emailTemplate, string $emailType = 'text') + { + // generate email template by given emailType + $template = GeneralUtility::getFileAbsFileName($emailTemplate); + $htmlView = GeneralUtility::makeInstance(StandaloneView::class); + $htmlView->setFormat($emailType); + $htmlView->setTemplatePathAndFilename($template); + $htmlView->assignMultiple([ + 'loginPid' => $this->settings['pids.']['loginPage'], + 'documentsList' => $documentsList + ]); + + return $htmlView->render(); + } + + /** + * Update access entry with access_granted_notification or expire_notification timestamp + * + * @param Access $accessEntry + * @param int $notificationTimestamp + */ + protected function updateAccessEntry(Access $accessEntry, int $notificationTimestamp) + { + // must be overridden in child class + } + + /** + * Send email to fe_users for kitodo documents access + * + * @param User $feUser + * @param array $documentsList + */ + protected function sendNotificationEmail(User $feUser, array $documentsList) + { + // must be overridden in child class + } } diff --git a/Classes/Command/KitodoAccessExpirationNotification.php b/Classes/Command/KitodoAccessExpirationNotification.php new file mode 100644 index 0000000..b7ec83e --- /dev/null +++ b/Classes/Command/KitodoAccessExpirationNotification.php @@ -0,0 +1,175 @@ + + * All rights reserved + * + * This script is part of the TYPO3 project. The TYPO3 project is + * free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * The GNU General Public License can be found at + * http://www.gnu.org/copyleft/gpl.html. + * + * This script is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This copyright notice MUST APPEAR in all copies of the script! + ***************************************************************/ + +use Slub\DigasFeManagement\Domain\Model\Access; +use Slub\DigasFeManagement\Domain\Model\User; +use Symfony\Component\Console\Input\InputArgument; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Output\OutputInterface; +use TYPO3\CMS\Core\Mail\MailMessage; +use TYPO3\CMS\Core\Utility\GeneralUtility; +use TYPO3\CMS\Core\Utility\MathUtility; +use TYPO3\CMS\Extbase\Utility\LocalizationUtility as ExtbaseLocalizationUtility; + +/** + * Class KitodoAccessExpirationNotification + */ +class KitodoAccessExpirationNotification extends DigasBaseCommand +{ + /** + * @var int Expiration timespan in days. + */ + protected $expirationTimestamp; + + /** + * @param InputInterface $input + * @param OutputInterface $output + */ + public function initialize(InputInterface $input, OutputInterface $output) + { + parent::initialize($input, $output); + } + + /** + * Configure the command by defining the name, options and arguments + */ + protected function configure() + { + $this->setDescription('[DiGAS FE Management] Notify fe_users about expiring kitodo documents.') + ->addArgument( + 'expirationTimestamp', + InputArgument::REQUIRED, + 'Add a timespan in days (i.e. "365"). fe_users with expiring document access will get an information email.' + )->setHelp( + 'This command informs fe_users with expiring kitodo document access.' + ); + } + + /** + * Executes the command + * + * @param InputInterface $input + * @param OutputInterface $output + * @throws \TYPO3\CMS\Extbase\Persistence\Exception\InvalidQueryException + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + // Initialize IO + parent::execute($input, $output); + + if (MathUtility::canBeInterpretedAsInteger($input->getArgument('expirationTimestamp'))) { + $this->expirationTimestamp = MathUtility::forceIntegerInRange((int)$input->getArgument('expirationTimestamp'), 0); + } + + if ($this->expirationTimestamp <= 0) { + $this->io->error('"expirationTimestamp" has to a positive integer value. Abort.'); + return; + } + + $time = new \DateTime(); + $expirationTimestamp = $time->getTimestamp() + ((60 * 60 * 24) * $this->expirationTimestamp); + + $this->io->text('Get fe_users with nearly expiration documents.'); + // get fe users with requests for access loop + $expireAccessUsers = $this->AccessRepository->findExpirationUsers($expirationTimestamp); + $this->io->text(count($expireAccessUsers) . ' fe_users with expiring documents were found.'); + + if (!empty($expireAccessUsers)) { + foreach ($expireAccessUsers as $expireUser) { + /** @var User $feUser */ + $feUser = $this->UserRepository->findByUid($expireUser->getFeUser()); + $expiringAccessEntries = $this->AccessRepository->findExpiringEntriesByUser($expireUser->getFeUser(), $expirationTimestamp); + + if (!empty($expiringAccessEntries)) { + $this->io->text(sprintf('Notify fe_user (UID: %s) with %s expiring documents.', $expireUser->getFeUser(), count($expiringAccessEntries))); + + $this->notifyUser($feUser, $expiringAccessEntries); + $this->persistenceManager->persistAll(); + } + } + } + + $this->io->success('Task finished successfully.'); + + } + + /** + * Update access model object and set accessGrantedNotification + * + * @param Access $accessEntry + * @param string $notificationTimestamp + * @throws \TYPO3\CMS\Extbase\Persistence\Exception\IllegalObjectTypeException + * @throws \TYPO3\CMS\Extbase\Persistence\Exception\UnknownObjectException + */ + protected function updateAccessEntry(Access $accessEntry, int $notificationTimestamp) + { + // update access entry with notification time + $accessEntry->setExpireNotification($notificationTimestamp); + $this->AccessRepository->update($accessEntry); + } + + /** + * Send email to fe_users with expiring kitodo documents + * + * @param User $feUser + * @param array $documentsList + */ + protected function sendNotificationEmail(User $feUser, array $documentsList) + { + $this->initUserLocal($feUser); + $userEmail = $feUser->getEmail(); + $userFullName = $feUser->getFullName(); + if (!GeneralUtility::validEmail($userEmail)) { + $this->io->warning(sprintf('[DiGAS FE Management] Expiration notification warning to user (UID: %s) could not be sent. No valid email address.', $feUser->getUid())); + return; + } + $email = GeneralUtility::makeInstance(MailMessage::class); + + $textEmail = $this->generateNotificationEmail( + $documentsList, + 'EXT:digas_fe_management/Resources/Private/Templates/Email/Text/KitodoAccessExpirationNotification.html' + ); + $htmlEmail = $this->generateNotificationEmail( + $documentsList, + 'EXT:digas_fe_management/Resources/Private/Templates/Email/Html/KitodoAccessExpirationNotification.html', + 'html' + ); + $emailSubject = ExtbaseLocalizationUtility::translate('kitodoAccessExpirationNotification.email.subject', 'DigasFeManagement'); + + // Prepare and send the message + $email->setSubject($emailSubject) + ->setFrom([ + $this->settings['adminEmail'] => $this->settings['adminName'] + ]) + ->setTo([ + $userEmail => $userFullName + ]) + ->setBody($textEmail) + ->addPart($htmlEmail, 'text/html') + ->send(); + } +} diff --git a/Classes/Command/KitodoAccessGrantedNotification.php b/Classes/Command/KitodoAccessGrantedNotification.php new file mode 100644 index 0000000..1f4bf4a --- /dev/null +++ b/Classes/Command/KitodoAccessGrantedNotification.php @@ -0,0 +1,154 @@ + + * All rights reserved + * + * This script is part of the TYPO3 project. The TYPO3 project is + * free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * The GNU General Public License can be found at + * http://www.gnu.org/copyleft/gpl.html. + * + * This script is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This copyright notice MUST APPEAR in all copies of the script! + ***************************************************************/ + +use Slub\DigasFeManagement\Domain\Model\Access; +use Slub\DigasFeManagement\Domain\Model\User; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Output\OutputInterface; +use TYPO3\CMS\Core\Mail\MailMessage; +use TYPO3\CMS\Core\Utility\GeneralUtility; +use TYPO3\CMS\Extbase\Utility\LocalizationUtility as ExtbaseLocalizationUtility; + +/** + * Class KitodoAccessGrantedNotification + */ +class KitodoAccessGrantedNotification extends DigasBaseCommand +{ + /** + * @param InputInterface $input + * @param OutputInterface $output + */ + public function initialize(InputInterface $input, OutputInterface $output) + { + parent::initialize($input, $output); + } + + /** + * Configure the command by defining the name, options and arguments + */ + protected function configure() + { + $this->setDescription('[DiGAS FE Management] Notify fe_users about access granted for kitodo documents.') + ->setHelp( + 'This command informs fe_users with granted kitodo document access.' + ); + } + + /** + * Executes the command + * + * @param InputInterface $input + * @param OutputInterface $output + * @throws \TYPO3\CMS\Extbase\Persistence\Exception\InvalidQueryException + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + // Initialize IO + parent::execute($input, $output); + + $this->io->text('Get fe_users with document requests.'); + // get fe users with requests for access loop + $grantedAccessUsers = $this->AccessRepository->findAccessGrantedUsers(); + $this->io->text(count($grantedAccessUsers) . ' fe_users with requests documents were found.'); + + if (!empty($grantedAccessUsers)) { + foreach ($grantedAccessUsers as $accessUser) { + /** @var User $feUser */ + $feUser = $this->UserRepository->findByUid($accessUser->getFeUser()); + $grantedAccessEntries = $this->AccessRepository->findAccessGrantedEntriesByUser($accessUser->getFeUser()); + + if (!empty($grantedAccessEntries)) { + $this->io->text(sprintf('Notify fe_user (UID: %s) with %s document requests.', $accessUser->getFeUser(), count($grantedAccessEntries))); + + $this->notifyUser($feUser, $grantedAccessEntries); + $this->persistenceManager->persistAll(); + } + } + } + + $this->io->success('Task finished successfully.'); + + } + + /** + * Update access model object and set accessGrantedNotification + * + * @param Access $accessEntry + * @param string $notificationTimestamp + * @throws \TYPO3\CMS\Extbase\Persistence\Exception\IllegalObjectTypeException + * @throws \TYPO3\CMS\Extbase\Persistence\Exception\UnknownObjectException + */ + protected function updateAccessEntry(Access $accessEntry, $notificationTimestamp) + { + // update access entry with notification time + $accessEntry->setAccessGrantedNotification($notificationTimestamp); + $accessEntry->setInformUser(0); + $this->AccessRepository->update($accessEntry); + } + + /** + * Send email to fe_users with granted access documents + * + * @param User $feUser + * @param array $documentsList + */ + protected function sendNotificationEmail(User $feUser, array $documentsList) + { + $this->initUserLocal($feUser); + $userEmail = $feUser->getEmail(); + $userFullName = $feUser->getFullName(); + if (!GeneralUtility::validEmail($userEmail)) { + $this->io->warning(sprintf('[DiGAS FE Management] Granted access notification warning to user (UID: %s) could not be sent. No valid email address.', $feUser->getUid())); + return; + } + $email = GeneralUtility::makeInstance(MailMessage::class); + + $textEmail = $this->generateNotificationEmail( + $documentsList, + 'EXT:digas_fe_management/Resources/Private/Templates/Email/Text/KitodoAccessGrantedNotification.html' + ); + $htmlEmail = $this->generateNotificationEmail( + $documentsList, + 'EXT:digas_fe_management/Resources/Private/Templates/Email/Html/KitodoAccessGrantedNotification.html', + 'html' + ); + + $emailSubject = ExtbaseLocalizationUtility::translate('kitodoAccessGrantedNotification.email.subject', 'DigasFeManagement'); + + // Prepare and send the message + $email->setSubject($emailSubject) + ->setFrom([ + $this->settings['adminEmail'] => $this->settings['adminName'] + ]) + ->setTo([ + $userEmail => $userFullName + ]) + ->setBody($textEmail) + ->addPart($htmlEmail, 'text/html') + ->send(); + } +} diff --git a/Classes/Command/RemindUnusedAccountsCommand.php b/Classes/Command/RemindUnusedAccountsCommand.php index fa885d0..93987c2 100644 --- a/Classes/Command/RemindUnusedAccountsCommand.php +++ b/Classes/Command/RemindUnusedAccountsCommand.php @@ -118,17 +118,7 @@ protected function execute(InputInterface $input, OutputInterface $output) */ protected function sendEmail($feUser) { - // hack to send english texts to user only if user registered on english page (sys_language_uid==1) - switch ($feUser->getLocale()) { - case '1': setlocale(LC_ALL, 'en_US.utf8'); - $GLOBALS['LANG']->init('en'); - break; - case '0': - default: setlocale(LC_ALL, 'de_DE.utf8'); - $GLOBALS['LANG']->init('de'); - break; - } - + $this->initUserLocal($feUser); $userEmail = $feUser->getEmail(); $userFullName = $feUser->getFullName(); if (!GeneralUtility::validEmail($userEmail)) { @@ -165,7 +155,7 @@ protected function remindUnusedAccounts() $time = new \DateTime(); $unusedTimestamp = $time->getTimestamp() - ((60 * 60 * 24) * $this->unusedTimespan); - $feUsers = $this->UserRepository->findUnusedAccounts($unusedTimestamp, $this->settings['feUserGroup']); + $feUsers = $this->UserRepository->findUnusedAccounts($unusedTimestamp, $this->feUserGroups); if (!empty($feUsers)) { foreach ($feUsers as $feUser) { @@ -197,7 +187,7 @@ protected function deleteUnusedAccounts() $time = new \DateTime(); $deleteTimestamp = $time->getTimestamp() - ((60 * 60 * 24) * $this->deleteTimespan); - $feUsers = $this->UserRepository->findAccountsToDelete($deleteTimestamp, $this->settings['feUserGroup']); + $feUsers = $this->UserRepository->findAccountsToDelete($deleteTimestamp, $this->feUserGroups); if (!empty($feUsers)) { foreach ($feUsers as $feUser) { diff --git a/Classes/Controller/AccessController.php b/Classes/Controller/AccessController.php new file mode 100644 index 0000000..275e415 --- /dev/null +++ b/Classes/Controller/AccessController.php @@ -0,0 +1,391 @@ + + * All rights reserved + * + * This script is part of the TYPO3 project. The TYPO3 project is + * free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * The GNU General Public License can be found at + * http://www.gnu.org/copyleft/gpl.html. + * + * This script is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This copyright notice MUST APPEAR in all copies of the script! + ***************************************************************/ + +use In2code\Femanager\Controller\AbstractController; +use Slub\DigasFeManagement\Domain\Model\Access; +use Slub\DigasFeManagement\Domain\Model\User; +use Slub\DigasFeManagement\Domain\Repository\AccessRepository; +use Slub\DigasFeManagement\Domain\Repository\KitodoDocumentRepository; +use TYPO3\CMS\Core\Messaging\AbstractMessage; +use TYPO3\CMS\Extbase\Mvc\Exception\StopActionException; +use TYPO3\CMS\Extbase\Mvc\Exception\UnsupportedRequestTypeException; +use TYPO3\CMS\Extbase\Persistence\Exception\IllegalObjectTypeException; +use TYPO3\CMS\Extbase\Persistence\Exception\UnknownObjectException; +use TYPO3\CMS\Extbase\Utility\LocalizationUtility; + +/** + * Class AccessController + */ +class AccessController extends AbstractController +{ + /** + * accessRepository + * + * @var AccessRepository + */ + protected $accessRepository = null; + + /** + * @param AccessRepository $accessRepository + */ + public function injectAccessRepository(AccessRepository $accessRepository) + { + $this->accessRepository = $accessRepository; + } + + /** + * kitodoDocumentRepository + * + * @var KitodoDocumentRepository + */ + protected $kitodoDocumentRepository = null; + + /** + * @param KitodoDocumentRepository $kitodoDocumentRepository + */ + public function injectKitodoDocumentRepository(KitodoDocumentRepository $kitodoDocumentRepository) + { + $this->kitodoDocumentRepository = $kitodoDocumentRepository; + } + + /** + * + */ + public function initializeAction() + { + parent::initializeAction(); + + // remove "disabled", "starttime" & "endtime" column to show hidden access + unset($GLOBALS['TCA']['tx_digasfemanagement_domain_model_access']['ctrl']['enablecolumns']['disabled']); + unset($GLOBALS['TCA']['tx_digasfemanagement_domain_model_access']['ctrl']['enablecolumns']['starttime']); + unset($GLOBALS['TCA']['tx_digasfemanagement_domain_model_access']['ctrl']['enablecolumns']['endtime']); + } + + /** + * List granted and pending access for documents for single fe_user + * + * @param User|null $user + * @return void + */ + public function listAction(User $user = null) + { + $accessGranted = []; + $accessPending = []; + $accessExpired = []; + $accessRejected = []; + $informUser = 0; + + $documents = $this->accessRepository->findRequestsForUser($user->getUid()); + + //sort records by access granted / pending + /** @var Access $document */ + foreach ($documents as $document) { + //access rejected documents: hidden and rejected are true + if ($document->getHidden() === true && $document->getRejected() === true) { + $accessRejected[] = $document; + //documents about whose rejections the user has not yet been informed + if(!$document->getInformUser() && !$document->getAccessGrantedNotification()) { + $informUser++; + } + }//access pending documents: hidden is true + elseif ($document->getHidden() === true) { + $accessPending[] = $document; + } //access expired documents: endTime is lower than today's date + elseif ($document->getEndtime() < time()) { + $accessExpired[] = $document; + } //access granted documents + else { + $accessGranted[] = $document; + //documents about whose access the user has not yet been informed + if(!$document->getInformUser() && !$document->getAccessGrantedNotification()) { + $informUser++; + } + } + } + + //get request arguments for error handling + $arguments = $this->request->getArguments(); + + $this->view->assignMultiple([ + 'accessGranted' => $accessGranted, + 'accessPending' => $accessPending, + 'accessExpired' => $accessExpired, + 'accessRejected' => $accessRejected, + 'user' => $user, + 'errorItem' => $arguments['error'], + 'informUser' => $informUser + ]); + + if($informUser) { + $this->addFlashMessage( + LocalizationUtility::translate($this->settings['languageFile'] . ':access.user.inform'), '' ,1 + ); + } + } + + /** + * @param User $user + * @throws IllegalObjectTypeException + * @throws StopActionException + * @throws UnknownObjectException + * @throws UnsupportedRequestTypeException + */ + public function informUserAction(User $user) + { + /** @var Access $documentAccess */ + foreach ($user->getKitodoDocumentAccess() as $documentAccess) { + if(!$documentAccess->getInformUser()) { + $documentAccess->setInformUser(1); + $this->accessRepository->update($documentAccess); + } + } + + $this->addFlashMessage( + LocalizationUtility::translate($this->settings['languageFile'] . ':access.user.inform.queued') + ); + + //redirect to list view + $this->redirect('list', null, null, ['user' => $user]); + } + + /** + * @param User $user + * @param Access|null $access + * @return void + */ + public function newAction(User $user, Access $access = null) + { + $this->view->assignMultiple([ + 'user' => $user, + 'access' => $access + ]); + } + + /** + * @param User $user + * @param Access $access + * @throws IllegalObjectTypeException + * @throws StopActionException + * @throws UnsupportedRequestTypeException + */ + public function createAction(User $user, Access $access) + { + //process and validate form data + $access = $this->processFormData($user, $access, 'new'); + + //add to database + $this->accessRepository->add($access); + + //add success message + $message = LocalizationUtility::translate($this->settings['languageFile'] . ':access.success.granted'); + $this->addFlashMessage(sprintf($message, $access->getRecordId())); + + //redirect to list view + $this->redirect('list', null, null, ['user' => $user]); + } + + /** + * approve action + * + * @param User $user + * @param Access $access + * @return void + * @throws UnsupportedRequestTypeException + * @throws IllegalObjectTypeException + * @throws UnknownObjectException + * @throws StopActionException + */ + public function approveAction(User $user, Access $access) + { + //process and validate form data + $access = $this->processFormData($user, $access); + + //update access to document + $this->accessRepository->update($access); + + //add success message + $arguments = $this->request->getArguments(); + $message = LocalizationUtility::translate($this->settings['languageFile'] . ':access.success.' . ($arguments['edit'] ? 'updated' : 'granted')); + $this->addFlashMessage(sprintf($message, $access->getRecordId())); + + //redirect to list view + $this->redirect('list', null, null, ['user' => $user]); + } + + + /** + * @param User $user + * @param Access $access + * @param string $action + * @return Access + * @throws StopActionException + */ + protected function processFormData(User $user, Access $access, string $action = 'list'): Access + { + $access->setEndtime($access->getEndtimeString()); + + //set dlfDocument for new entries + if (!$access->getDlfDocument() && $access->getRecordId() && $action === 'new') { + $dlfDocument = $this->kitodoDocumentRepository->findDocumentsByRecordId([$access->getRecordId()]); + if (!empty($dlfDocument) && isset($dlfDocument[0])) { + $access->setDlfDocument($dlfDocument[0]); + } + } + //set feUser for new entries + if (!$access->getFeUser() && $action === 'new') { + $access->setFeUser($user->getUid()); + } + + //check if validation failed + if ($this->validateApproval($access, $user, $action) === false) { + $this->forward($action, null, null, ['user' => $user, 'access' => $access, 'error' => $access->getUid()]); + } + + //set record unhidden - set starttime & endtime + $access->setStarttime(strtotime('today')); + $access->setHidden(false); + $access->setRejected(false); + + return $access; + } + + /** + * validation of access properties + * + * @param Access $access + * @param User $user + * @param string $action + * @return bool + */ + public function validateApproval(Access $access, User $user, string $action) : bool + { + $validate = true; + + //starttime < endtime + if ($access->getEndtimeString() && $access->getEndtimeString() < strtotime("today + 1day")) { + + $validate = false; + $this->addFlashMessage( + LocalizationUtility::translate($this->settings['languageFile'] . ':access.error.endtime'), + '', AbstractMessage::ERROR + ); + } + + //recordId empty + if (!$access->getRecordId() && $action === 'new') { + $validate = false; + $this->addFlashMessage( + LocalizationUtility::translate($this->settings['languageFile'] . ':access.error.recordId.missing'), + '', AbstractMessage::ERROR + ); + } + + //dlfDocument not found + if ($access->getRecordId() && !$access->getDlfDocument() && $action === 'new') { + $validate = false; + $this->addFlashMessage( + LocalizationUtility::translate($this->settings['languageFile'] . ':access.error.recordId.notFound'), + '', AbstractMessage::ERROR + ); + } + + //dlfDocument already exists in access list + if ($access->getDlfDocument() && $action === 'new') { + $checkAvailableDocuments = []; + + if($user->getKitodoDocumentAccess()) { + foreach ($user->getKitodoDocumentAccess() as $document) { + $checkAvailableDocuments[$document->getRecordId()] = $document; + } + + if(array_key_exists($access->getRecordId(), $checkAvailableDocuments)) { + $validate = false; + $this->addFlashMessage( + LocalizationUtility::translate($this->settings['languageFile'] . ':access.error.dlfDocument.exists'), + '', AbstractMessage::ERROR + ); + } + } + + } + + return $validate; + } + + + /** + * @param Access $access + * @param User $user + * @return void + */ + public function rejectReasonAction(Access $access, User $user) + { + $this->view->assignMultiple([ + 'access' => $access, + 'user' => $user + ]); + } + + /** + * refuse access: + * - remove access-record from fe_user + * - delete access-record in db (deleted=1) + * + * @param Access $access + * @param User $user + * @return void + * @throws StopActionException + * @throws UnsupportedRequestTypeException + * @throws IllegalObjectTypeException + * @throws UnknownObjectException + */ + public function rejectAction(Access $access, User $user) + { + $access->setHidden(1); + $access->setRejected(1); + $access->setStarttime(0); + $access->setEndtime(0); + $access->setExpireNotification(0); + $access->setAccessGrantedNotification(0); + $access->setInformUser(0); + + if($access->getRejectedReason()) { + $rejectedReason = strip_tags($access->getRejectedReason()); + $access->setRejectedReason($rejectedReason); + } + + //update access to document + $this->accessRepository->update($access); + + //add success message + $message = LocalizationUtility::translate($this->settings['languageFile'] . ':access.success.deleted'); + $this->addFlashMessage(sprintf($message, $access->getDlfDocument()->getTitle())); + + //redirect to list view + $this->redirect('list', null, null, ['user' => $user]); + } +} diff --git a/Classes/Controller/AdministrationController.php b/Classes/Controller/AdministrationController.php index aa49563..d88520a 100644 --- a/Classes/Controller/AdministrationController.php +++ b/Classes/Controller/AdministrationController.php @@ -26,6 +26,7 @@ ***************************************************************/ use In2code\Femanager\Controller\AbstractController; +use In2code\Femanager\Domain\Model\UserGroup; use In2code\Femanager\Utility\LocalizationUtility; use In2code\Femanager\Utility\LogUtility; use In2code\Femanager\Utility\ObjectUtility; @@ -93,13 +94,18 @@ public function showAction(User $user) public function editUserAction(User $user) { if (!empty($user) && !empty($user->getUid())) { - $token = ''; - if ($user) { - $token = GeneralUtility::hmac($user->getUid(), (string)$user->getCrdate()->getTimestamp()); + $token = GeneralUtility::hmac($user->getUid(), (string)$user->getCrdate()->getTimestamp()); + + /** @var UserGroup[] $feUserGroup */ + $feUserGroup = $user->getUsergroup()->getArray(); + if (!empty($feUserGroup[0])) { + $feUserGroup = $feUserGroup[0]->getUid(); } + $this->view->assignMultiple([ 'user' => $user, 'token' => $token, + 'currentFeUserGroup' => $feUserGroup ?: null, 'allUserGroups' => $this->userGroupRepository->findAllForFrontendSelection('') ]); $this->assignForAll(); diff --git a/Classes/Controller/BasketController.php b/Classes/Controller/BasketController.php new file mode 100644 index 0000000..2e83644 --- /dev/null +++ b/Classes/Controller/BasketController.php @@ -0,0 +1,329 @@ + + * All rights reserved + * + * This script is part of the TYPO3 project. The TYPO3 project is + * free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * The GNU General Public License can be found at + * http://www.gnu.org/copyleft/gpl.html. + * + * This script is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This copyright notice MUST APPEAR in all copies of the script! + ***************************************************************/ + +use In2code\Femanager\Controller\AbstractController; +use In2code\Femanager\Utility\StringUtility; +use Slub\DigasFeManagement\Domain\Model\Access; +use Slub\SlubWebDigas\Domain\Model\KitodoDocument; +use TYPO3\CMS\Extbase\Mvc\Exception\StopActionException; +use TYPO3\CMS\Extbase\Mvc\Exception\UnsupportedRequestTypeException; +use TYPO3\CMS\Extbase\Persistence\Exception\IllegalObjectTypeException; +use TYPO3\CMS\Extbase\Persistence\Exception\UnknownObjectException; +use TYPO3\CMS\Extbase\Persistence\Generic\QueryResult; +use TYPO3\CMS\Extbase\Utility\LocalizationUtility; + +/** + * Class BasketController + */ +class BasketController extends AbstractController +{ + /** + * @var \Slub\DigasFeManagement\Domain\Repository\KitodoDocumentRepository + */ + protected $kitodoDocumentRepository; + + /** + * @param \Slub\DigasFeManagement\Domain\Repository\KitodoDocumentRepository $kitodoDocumentRepository + */ + public function injectKitodoDocumentRepository(\Slub\DigasFeManagement\Domain\Repository\KitodoDocumentRepository $kitodoDocumentRepository) + { + $this->kitodoDocumentRepository = $kitodoDocumentRepository; + } + + /** + * @var \Slub\DigasFeManagement\Domain\Repository\AccessRepository + */ + protected $accessRepository; + + /** + * @param \Slub\DigasFeManagement\Domain\Repository\AccessRepository $accessRepository + */ + public function injectAccessRepository(\Slub\DigasFeManagement\Domain\Repository\AccessRepository $accessRepository) + { + $this->accessRepository = $accessRepository; + } + + /** + * @var QueryResult + */ + protected $documents; + + + /** + * @var array + */ + protected $requestParams = []; + + + /** + * @throws StopActionException + * @throws UnsupportedRequestTypeException + */ + public function initializeAction() + { + parent::initializeAction(); + + $this->checkUserLoggedIn(); + + $kitodoRequestIds = $this->getRequestIdsFromCookie(); + + if (!empty($kitodoRequestIds) && is_array($kitodoRequestIds)) { + $documents = $this->kitodoDocumentRepository->findDocumentsByRecordId($kitodoRequestIds); + + // update kitodo cookie if count differs + if (count($kitodoRequestIds) !== count($documents)) { + $kitodoDocuments = []; + foreach ($documents as $document) { + $kitodoDocuments[] = $document->getRecordId(); + } + setcookie('dlf-requests', json_encode($kitodoDocuments), '', '/'); + } + } + + //new requests + $newDocumentRequests = []; + //already requested documents + $oldDocumentRequests = []; + //rejected documents + $rejectedDocumentRequests = []; + + //check if documents were already requested + if (!empty($documents)) { + // get former requested kitodo access + $requestedAccess = $this->accessRepository->findRequestsForUser($this->user->getUid()); + $requestedDocuments = []; + if (!empty($requestedAccess)) { + /** @var Access $access */ + foreach ($requestedAccess as $access) { + $requestedDocuments[$access->getDlfDocument()->getUid()] = $access; + } + } + + foreach ($documents as $key => $document) { + // get rejected documents + if (array_key_exists($document->getUid(), $requestedDocuments) && $requestedDocuments[$document->getUid()]->getRejected()) { + $rejectedDocumentRequests[$document->getUid()] = $requestedDocuments[$document->getUid()]; + } // get documents that are already accessible or waiting for access + elseif (array_key_exists($document->getUid(), $requestedDocuments)) { + // remove document from array for email handling + $oldDocumentRequests[$document->getUid()] = $requestedDocuments[$document->getUid()]; + } // new documents + else { + $newDocumentRequests[$document->getUid()] = $document; + } + } + } + + $this->documents = [ + 'newDocumentRequests' => $newDocumentRequests, + 'oldDocumentRequests' => $oldDocumentRequests, + 'rejectedDocumentRequests' => $rejectedDocumentRequests + ]; + + // get request parameters + $this->requestParams = !empty($this->request->getArguments()['request']) ? filter_var_array($this->request->getArguments()['request'], FILTER_SANITIZE_STRING) : []; + } + + /** + * action request + * + * @return void + * @throws StopActionException + * @throws UnsupportedRequestTypeException + */ + public function indexAction() + { + $this->view->assignMultiple([ + 'documents' => [ + 'oldDocumentRequests' => $this->documents['oldDocumentRequests'], + //join new requests for access with rejected documents that can be requested again + 'newDocumentRequests' => array_merge($this->documents['newDocumentRequests'], $this->documents['rejectedDocumentRequests']) + ], + 'request' => $this->requestParams + ]); + + //add basket empty message + if (!$this->documents['newDocumentRequests'] && !$this->documents['oldDocumentRequests'] && !$this->requestParams['sent']) { + $this->addFlashMessage( + LocalizationUtility::translate('basket.empty', 'DigasFeManagement'), '', -2 + ); + } + } + + public function overviewAction() + { + $documents = array_merge($this->documents['newDocumentRequests'], $this->documents['rejectedDocumentRequests']); + + if (empty($documents)) { + $this->redirect('index', 'Basket', 'DigasFeManagement'); + } + + $this->view->assignMultiple([ + //join new requests for access with rejected documents that can be requested again + 'documents' => $documents, + 'request' => $this->requestParams + ]); + } + + /** + * action request + * + * @return void + * @throws StopActionException + * @throws UnsupportedRequestTypeException + * @throws IllegalObjectTypeException + * @throws UnknownObjectException + */ + public function requestAction() + { + $documents = array_merge($this->documents['newDocumentRequests'], $this->documents['rejectedDocumentRequests']); + + if (!empty($documents)) { + //request new documents + if(!empty($this->documents['newDocumentRequests'])) { + foreach ($documents as $key => $document) { + $requestAccess = new Access(); + $requestAccess->setFeUser($this->user->getUid()); + $requestAccess->setRecordId($document->getRecordId()); + $requestAccess->setHidden(true); + $requestAccess->setDlfDocument($document); + + $this->accessRepository->add($requestAccess); + } + + $this->persistenceManager->persistAll(); + } + + //request rejected documents again + if(!empty($this->documents['rejectedDocumentRequests'])) { + /** @var Access $accessRejectedNewRequest */ + foreach($this->documents['rejectedDocumentRequests'] as $accessRejectedNewRequest) { + $accessRejectedNewRequest->setExpireNotification(0); + $accessRejectedNewRequest->setAccessGrantedNotification(0); + $accessRejectedNewRequest->setRejected(0); + $accessRejectedNewRequest->setHidden(1); + $accessRejectedNewRequest->setStarttime(0); + $accessRejectedNewRequest->setEndtime(0); + $accessRejectedNewRequest->setInformUser(0); + $this->accessRepository->update($accessRejectedNewRequest); + } + } + + setcookie('dlf-requests', '[]', '', '/'); + + $message = !empty($this->requestParams['message']) ? $this->requestParams['message'] : ''; + $this->sendRequestAccessMail($documents, $message); + + $this->addFlashMessage( + LocalizationUtility::translate( + 'requestKitodoAccess.success', + 'DigasFeManagement' + ) + ); + $this->redirect('index', 'Basket', 'DigasFeManagement', ['request' => ['sent' => true]]); + } else { + $this->addFlashMessage( + LocalizationUtility::translate( + 'requestKitodoAccess.error', + 'DigasFeManagement' + ), + '', + \TYPO3\CMS\Core\Messaging\AbstractMessage::ERROR + ); + } + + $this->redirect('index', 'Basket', 'DigasFeManagement'); + } + + /** + * test is user is logged in + * + * @throws StopActionException + * @throws UnsupportedRequestTypeException + */ + protected function checkUserLoggedIn() + { + if (empty($this->user) || empty($this->user->getUid())) { + $uriBuilder = $this->uriBuilder; + $uri = $uriBuilder->setTargetPageUid($this->settings['pids']['loginPage'])->build(); + $this->redirectToUri($uri); + } + } + + /** + * Send request access mail with kitodo documents and reset basket cookie + * + * @param KitodoDocument[] $documents + * @param string $message + * @return bool + */ + protected function sendRequestAccessMail(array $documents, string $message = ''): bool + { + // send email for access to kitodo documents + $variables = [ + 'user' => $this->user, + 'settings' => $this->settings, + 'documents' => $documents, + 'message' => $message + ]; + + $mailSentAdmin = $this->sendMailService->send( + 'requestKitodoAccess', + StringUtility::makeEmailArray($this->settings['adminEmail'], $this->settings['adminName']), + StringUtility::makeEmailArray($this->settings['adminEmail'], $this->settings['adminName']), + 'Dokumentfreigabe beantragt', + $variables, + $this->config['requestKitodoAccess.']['email.'] + ); + + //mail to user + $this->sendMailService->send( + 'requestKitodoAccessUser', + StringUtility::makeEmailArray($this->user->getEmail(), $this->user->getFirstName() . ' ' . $this->user->getLastName()), + StringUtility::makeEmailArray($this->settings['adminEmail'], $this->settings['adminName']), + 'Dokumentfreigabe beantragt', + $variables, + $this->config['requestKitodoAccessUser.']['email.'] + ); + + return $mailSentAdmin; + } + + /** + * Get kitodo request ids from basket cookie + * + * @return array + */ + protected function getRequestIdsFromCookie(): array + { + $kitodoRequestIds = $_COOKIE['dlf-requests']; + if (!empty($kitodoRequestIds)) { + return json_decode($kitodoRequestIds); + } + return []; + } +} diff --git a/Classes/Controller/ExtendController.php b/Classes/Controller/ExtendController.php index d54a830..ccfb80a 100644 --- a/Classes/Controller/ExtendController.php +++ b/Classes/Controller/ExtendController.php @@ -28,27 +28,134 @@ use In2code\Femanager\Controller\AbstractController; use In2code\Femanager\Utility\StringUtility; use In2code\Femanager\Utility\HashUtility; +use TYPO3\CMS\Core\Context\Context; +use TYPO3\CMS\Core\Page\PageRenderer; +use TYPO3\CMS\Core\Utility\GeneralUtility; +use TYPO3\CMS\Extbase\Mvc\Exception\StopActionException; +use TYPO3\CMS\Extbase\Mvc\Exception\UnsupportedRequestTypeException; +use TYPO3\CMS\Core\Context\Exception\AspectNotFoundException; /** * Class ExtendController */ -class ExtendController extends AbstractController { +class ExtendController extends AbstractController +{ + /** + * action dialog + * + * @return void + * @throws AspectNotFoundException + */ + public function dialogAction() + { + //get kitodo parameters + $kitodoParams = GeneralUtility::_GET('tx_dlf'); + + //get femanager paramters + $femanagerParams = GeneralUtility::_GET('tx_femanager_pi1'); + + //check if user is logged in + $user = GeneralUtility::makeInstance(Context::class)->getPropertyFromAspect('frontend.user', 'id', 0) > 0; + + //check if fe_user exists AND action is create --> redirect + if ($user && $femanagerParams['action'] === 'create') { + try { + //remove all femanager flashMessages concerning profile create / login + $this->controllerContext->getFlashMessageQueue('extbase.flashmessages.tx_femanager_pi1')->getAllMessagesAndFlush(); + //redirect + $this->redirectToKitodoView(['tx_dlf' => $kitodoParams]); + } catch (StopActionException | UnsupportedRequestTypeException $e) { + } + } + elseif($femanagerParams['action'] === 'create') { + $this->view->assign('checkYes', true); + } + + //check if fe_user exists OR cookie for private usage is set + //return empty string + if ($user || $GLOBALS["TSFE"]->fe_user->getKey("ses", $this->settings['dialog']['cookieName'])) { + return ''; + } + + //get request arguments + $arguments = $this->request->getArguments(); + + //check if cookie for private usage should be set --> redirect + if (isset($arguments['setCookie'])) { + //set cookie for private user + $GLOBALS["TSFE"]->fe_user->setKey("ses", $this->settings['dialog']['cookieName'], true); + try { + $this->redirectToKitodoView(['tx_dlf' => $kitodoParams]); + } catch (StopActionException | UnsupportedRequestTypeException $e) { + } + } + + //add assets + $this->addAssets(); + $this->view->assign('kitodoParams', $kitodoParams); + } + + /** + * @param array $parameters + * @throws StopActionException + * @throws UnsupportedRequestTypeException + */ + protected function redirectToKitodoView(array $parameters) + { + //build redirect uri + $uriBuilder = $this->uriBuilder; + $uri = $uriBuilder + ->reset() + ->setTargetPageUid($GLOBALS['TSFE']->id) + ->setArguments($parameters) + ->build(); + //redirect + $this->redirectToURI($uri); + } + + /** + * add assets + * + * @return void + */ + protected function addAssets() + { + //initialize PageRenderer + $pageRenderer = GeneralUtility::makeInstance(PageRenderer::class); + + //add stylesheets + if (!empty($this->settings['dialog']['assets']['css'])) { + foreach ($this->settings['dialog']['assets']['css'] as $stylesheet) { + $pageRenderer->addCssFile( + $stylesheet['file'], + 'stylesheet', + 'all', + '', + true, + $stylesheet['forceOnTop'], + '', + true + ); + } + } + } /** * action disable * * @return void */ - public function disableAction() { + public function disableAction() + { - if($this->user !== NULL && $this->user->getUid()) { + if ($this->user !== NULL && $this->user->getUid()) { $arguments = $this->request->getArguments(); $this->view->assignMultiple([ 'step' => $arguments['step'] ]); - if($arguments['disable']) { + if ($arguments['disable']) { // first send confirmation about deactivation of account $variables = ['user' => $this->user, 'settings' => $this->settings, 'hash' => HashUtility::createHashForUser($this->user)]; @@ -75,7 +182,10 @@ public function disableAction() { $uri = $uriBuilder ->setTargetPageUid($this->settings['pids']['rootPage']) ->build(); - $this->redirectToUri($uri, 0, 404); + try { + $this->redirectToUri($uri, 0, 404); + } catch (StopActionException | UnsupportedRequestTypeException $e) { + } } } } diff --git a/Classes/Controller/NewController.php b/Classes/Controller/NewController.php index 23e9c67..a1a90aa 100644 --- a/Classes/Controller/NewController.php +++ b/Classes/Controller/NewController.php @@ -27,6 +27,7 @@ use In2code\Femanager\Utility\LocalizationUtility; use Slub\DigasFeManagement\Domain\Model\User; +use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Extbase\Mvc\Exception\UnsupportedRequestTypeException; /** @@ -55,6 +56,10 @@ public function initializeCreateAction() */ public function newAction(\In2code\Femanager\Domain\Model\User $user = null) { + //get kitodo ID if set + $kitodoParams = GeneralUtility::_GET('tx_dlf'); + $this->view->assign('kitodoParams', $kitodoParams); + $this->view->assign('currentUser', $this->user); parent::newAction($user); } diff --git a/Classes/Domain/Model/Access.php b/Classes/Domain/Model/Access.php new file mode 100644 index 0000000..4cb28b9 --- /dev/null +++ b/Classes/Domain/Model/Access.php @@ -0,0 +1,394 @@ + + * All rights reserved + * + * This script is part of the TYPO3 project. The TYPO3 project is + * free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * The GNU General Public License can be found at + * http://www.gnu.org/copyleft/gpl.html. + * + * This script is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This copyright notice MUST APPEAR in all copies of the script! + ***************************************************************/ + +/** + * Class Access + */ +class Access extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity +{ + /** + * dlfDocument + * + * @var \Slub\SlubWebDigas\Domain\Model\KitodoDocument + */ + protected $dlfDocument = ''; + + /** + * recordId + * + * @var string + */ + protected $recordId; + + /** + * feUser + * + * @var int + */ + protected $feUser; + + /** + * hidden + * + * @var bool + */ + protected $hidden; + + /** + * starttimeString + * + * @var string + */ + protected $starttimeString; + + /** + * endtimeString + * + * @var string + */ + protected $endtimeString; + + /** + * starttime + * + * @var int + */ + protected $starttime; + + /** + * endtime + * + * @var int + */ + protected $endtime; + + /** + * @var int Timestamp of email notification to user for granted access + */ + protected $accessGrantedNotification; + + /** + * @var int Timestamp of email notification to user for expiration notice + */ + protected $expireNotification; + + /** + * rejected + * + * @var bool + */ + protected $rejected; + + /** + * rejectedReason + * + * @var string + */ + protected $rejectedReason; + + /** + * Returns the dlfDocument + * + * @return \Slub\SlubWebDigas\Domain\Model\KitodoDocument $dlfDocument + */ + public function getDlfDocument() + { + return $this->dlfDocument; + } + + /** + * informUser + * + * @var bool + */ + protected $informUser; + + + /** + * Sets the dlfDocument + * + * @param \Slub\SlubWebDigas\Domain\Model\KitodoDocument $dlfDocument + * @return void + */ + public function setDlfDocument(\Slub\SlubWebDigas\Domain\Model\KitodoDocument $dlfDocument) + { + $this->dlfDocument = $dlfDocument; + } + + /** + * Returns the recordId + * + * @return string $recordId + */ + public function getRecordId() + { + return $this->recordId; + } + + /** + * Sets the recordId + * + * @param string $recordId + * @return void + */ + public function setRecordId($recordId) + { + $this->recordId = $recordId; + } + + + /** + * Returns the feUser + * + * @return int $feUser + */ + public function getFeUser() + { + return $this->feUser; + } + + /** + * Sets the feUser + * + * @param int $feUser + * @return void + */ + public function setFeUser($feUser) + { + $this->feUser = $feUser; + } + + /** + * Returns the hidden + * + * @return bool $hidden + */ + public function getHidden() + { + return $this->hidden; + } + + /** + * Sets hidden + * + * @param bool $hidden + * @return void + */ + public function setHidden($hidden) + { + $this->hidden = $hidden; + } + + /** + * Returns the starttime + * + * @return string $starttime + */ + public function getStarttime() + { + return $this->starttime; + } + + /** + * Sets the starttime + * + * @param string $starttime + * @return void + */ + public function setStarttime($starttime) + { + $this->starttime = $starttime; + } + + /** + * Returns the endtime + * + * @return int $endtime + */ + public function getEndtime() + { + return $this->endtime; + } + + /** + * Sets the endtime + * + * @param int $endtime + * @return void + */ + public function setEndtime($endtime) + { + $this->endtime = $endtime; + } + + /** + * Returns the starttimeString + * + * @return int $starttimeString + */ + public function getStarttimeString() + { + return $this->starttimeString; + } + + /** + * Sets the starttimeString + * + * @param string $starttimeString + * @return void + */ + public function setStarttimeString($starttimeString) + { + $this->starttimeString = strtotime($starttimeString); + } + + /** + * Returns the endtimeString + * + * @return int $endtimeString + */ + public function getEndtimeString() + { + return $this->endtimeString; + } + + /** + * Sets the endtimeString + * + * @param int $endtimeString + * @return void + */ + public function setEndtimeString($endtimeString) + { + $this->endtimeString = strtotime($endtimeString); + } + + /** + * Returns the accessGrantedNotification + * + * @return int $access_granted_notification + */ + public function getAccessGrantedNotification() + { + return $this->accessGrantedNotification; + } + + /** + * Sets the accessGrantedNotification + * + * @param int $accessGrantedNotification + * @return void + */ + public function setAccessGrantedNotification($accessGrantedNotification) + { + $this->accessGrantedNotification = $accessGrantedNotification; + } + + /** + * Returns the expireNotification + * + * @return int $access_granted_notification + */ + public function getExpireNotification() + { + return $this->expireNotification; + } + + /** + * Sets the expireNotification + * + * @param int $expireNotification + * @return void + */ + public function setExpireNotification($expireNotification) + { + $this->expireNotification = $expireNotification; + } + + /** + * Returns the rejected + * + * @return bool $rejected + */ + public function getRejected() + { + return $this->rejected; + } + + /** + * Sets the rejected + * + * @param bool $rejected + * @return void + */ + public function setRejected($rejected) + { + $this->rejected = $rejected; + } + + /** + * Returns the rejectedReason + * + * @return string $rejectedReason + */ + public function getRejectedReason() + { + return $this->rejectedReason; + } + + /** + * Sets the rejectedReason + * + * @param string $rejectedReason + * @return void + */ + public function setRejectedReason($rejectedReason) + { + $this->rejectedReason = $rejectedReason; + } + + /** + * Returns the informUser + * + * @return bool $informUser + */ + public function getInformUser() + { + return $this->informUser; + } + + /** + * Sets the informUser + * + * @param bool $informUser + * @return void + */ + public function setInformUser($informUser) + { + $this->informUser = $informUser; + } +} diff --git a/Classes/Domain/Model/User.php b/Classes/Domain/Model/User.php index c13d279..2c7f03f 100644 --- a/Classes/Domain/Model/User.php +++ b/Classes/Domain/Model/User.php @@ -35,7 +35,7 @@ class User extends \In2code\Femanager\Domain\Model\User /** * companyType * - * @var int + * @var string */ protected $companyType; @@ -56,10 +56,75 @@ class User extends \In2code\Femanager\Domain\Model\User */ protected $locale; + /** + * pwChangedOnConfirmation + * + * @var bool + */ + protected $pwChangedOnConfirmation; + + /** + * mustChangePassword + * + * @var bool + */ + protected $mustChangePassword; + + /** + * hidden + * + * @var bool + */ + protected $hidden; + + /** + * Sets the inactivemessageTstamp + * + * @param \DateTime $inactivemessageTstamp + * @return void + * @var int + */ + protected $isOnline = false; + + /** + * oldAccount + * + * @var int + */ + protected $oldAccount; + + /** + * tempUserOrderingParty + * + * @var string + */ + protected $tempUserOrderingParty; + + /** + * tempUserAreaLocation + * + * @var string + */ + protected $tempUserAreaLocation; + + /** + * tempUserPurpose + * + * @var string + */ + protected $tempUserPurpose; + + /** + * district + * + * @var string + */ + protected $district; + /** * Returns the companyType * - * @return int $companyType + * @return string $companyType */ public function getCompanyType() { @@ -69,7 +134,7 @@ public function getCompanyType() /** * Sets the companyType * - * @param int $companyType + * @param string $companyType * @return void */ public function setCompanyType($companyType) @@ -119,13 +184,6 @@ public function setLocale($locale) $this->locale = $locale; } - /** - * mustChangePassword - * - * @var bool - */ - protected $mustChangePassword; - /** * Returns the mustChangePassword * @@ -147,13 +205,6 @@ public function setMustChangePassword($mustChangePassword) $this->mustChangePassword = $mustChangePassword; } - /** - * hidden - * - * @var bool - */ - protected $hidden; - /** * Returns the hidden * @@ -196,15 +247,6 @@ public function setDeleted($deleted) $this->deleted = $deleted; } - /** - * Sets the inactivemessageTstamp - * - * @param \DateTime $inactivemessageTstamp - * @var int - * @return void - */ - protected $isOnline = false; - /** * Sets the isOnline * @@ -216,13 +258,6 @@ public function setIsOnline($isOnline) $this->isOnline = $isOnline; } - /** - * oldAccount - * - * @var int - */ - protected $oldAccount; - /** * Returns the oldAccount * @@ -245,32 +280,21 @@ public function setOldAccount($oldAccount) } /** - * kitodoFeuserAccess + * savedSearches * - * @var string + * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\Slub\DigasFeManagement\Domain\Model\Search> + * @TYPO3\CMS\Extbase\Annotation\ORM\Cascade("remove") */ - protected $kitodoFeuserAccess; + protected $savedSearches; - /** - * Returns the kitodoFeuserAccess - * - * @return string $kitodoFeuserAccess - */ - public function getKitodoFeuserAccess() - { - return $this->kitodoFeuserAccess; - } /** - * Sets the kitodoFeuserAccess + * kitodoDocumentAccess * - * @param string $kitodoFeuserAccess - * @return void + * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\Slub\DigasFeManagement\Domain\Model\Access> + * @TYPO3\CMS\Extbase\Annotation\ORM\Cascade("remove") */ - public function setKitodoFeuserAccess($kitodoFeuserAccess) - { - $this->kitodoFeuserAccess = $kitodoFeuserAccess; - } + protected $kitodoDocumentAccess; /** * __construct @@ -293,16 +317,9 @@ public function __construct() protected function initStorageObjects() { $this->savedSearches = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage(); + $this->kitodoDocumentAccess = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage(); } - /** - * savedSearches - * - * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\Slub\DigasFeManagement\Domain\Model\Search> - * @TYPO3\CMS\Extbase\Annotation\ORM\Cascade("remove") - */ - protected $savedSearches; - /** * Adds a savedSearch * @@ -355,4 +372,152 @@ public function getFullName() { return $this->firstName . ' ' . $this->lastName; } + + /** + * Sets the pwChangedOnConfirmation + * + * @param bool $pwChangedOnConfirmation + * @return void + */ + public function setPwChangedOnConfirmation(bool $pwChangedOnConfirmation) + { + $this->pwChangedOnConfirmation = $pwChangedOnConfirmation; + } + + /** + * Returns the pwChangedOnConfirmation + * + * @return bool $pwChangedOnConfirmation + */ + public function getPwChangedOnConfirmation() + { + return $this->pwChangedOnConfirmation; + } + + /** + * Returns the tempUserOrderingParty + * + * @return string $tempUserOrderingParty + */ + public function getTempUserOrderingParty() + { + return $this->tempUserOrderingParty; + } + + /** + * Sets the tempUserOrderingParty + * + * @param string $tempUserOrderingParty + * @return void + */ + public function setTempUserOrderingParty($tempUserOrderingParty) + { + $this->tempUserOrderingParty = $tempUserOrderingParty; + } + + /** + * Returns the tempUserAreaLocation + * + * @return string $tempUserAreaLocation + */ + public function getTempUserAreaLocation() + { + return $this->tempUserAreaLocation; + } + + /** + * Sets the tempUserAreaLocation + * + * @param string $tempUserAreaLocation + * @return void + */ + public function setTempUserAreaLocation($tempUserAreaLocation) + { + $this->tempUserAreaLocation = $tempUserAreaLocation; + } + + /** + * Returns the tempUserPurpose + * + * @return string $tempUserPurpose + */ + public function getTempUserPurpose() + { + return $this->tempUserPurpose; + } + + /** + * Sets the tempUserPurpose + * + * @param string $tempUserPurpose + * @return void + */ + public function setTempUserPurpose($tempUserPurpose) + { + $this->tempUserPurpose = $tempUserPurpose; + } + + /** + * Adds a kitodoDocumentAccess + * + * @param \Slub\DigasFeManagement\Domain\Model\Access $kitodoDocumentAccess + * @return void + */ + public function addKitodoDocumentAccess(\Slub\DigasFeManagement\Domain\Model\Access $kitodoDocumentAccess) + { + $this->kitodoDocumentAccess->attach($kitodoDocumentAccess); + } + + /** + * Removes a kitodoDocumentAccess + * + * @param \Slub\DigasFeManagement\Domain\Model\Access $kitodoDocumentAccessSearchToRemove The savedSearch to be removed + * @return void + */ + public function removeKitodoDocumentAccess(\Slub\DigasFeManagement\Domain\Model\Access $kitodoDocumentAccessSearchToRemove) + { + $this->kitodoDocumentAccess->detach($kitodoDocumentAccessSearchToRemove); + } + + /** + * Returns the kitodoDocumentAccess + * + * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\Slub\DigasFeManagement\Domain\Model\Access> $kitodoDocumentAccess + */ + public function getKitodoDocumentAccess() + { + return $this->kitodoDocumentAccess; + } + + /** + * Sets the kitodoDocumentAccess + * + * @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\Slub\DigasFeManagement\Domain\Model\Access> $icons + * @return void + */ + public function setKitodoDocumentAccess(\TYPO3\CMS\Extbase\Persistence\ObjectStorage $kitodoDocumentAccess) + { + $this->kitodoDocumentAccess = $kitodoDocumentAccess; + } + + /** + * Returns the district + * + * @return string $district + */ + public function getDistrict() + { + return $this->district; + } + + /** + * Sets the district + * + * @param string $district + * @return void + */ + public function setDistrict($district) + { + $this->district = $district; + } } diff --git a/Classes/Domain/Repository/AccessRepository.php b/Classes/Domain/Repository/AccessRepository.php new file mode 100644 index 0000000..33d7235 --- /dev/null +++ b/Classes/Domain/Repository/AccessRepository.php @@ -0,0 +1,177 @@ + + * All rights reserved + * + * This script is part of the TYPO3 project. The TYPO3 project is + * free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * The GNU General Public License can be found at + * http://www.gnu.org/copyleft/gpl.html. + * + * This script is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This copyright notice MUST APPEAR in all copies of the script! + ***************************************************************/ + +use Slub\DigasFeManagement\Domain\Model\Access; +use TYPO3\CMS\Core\Database\ConnectionPool; +use TYPO3\CMS\Core\Database\Query\Restriction\HiddenRestriction; +use TYPO3\CMS\Core\Utility\GeneralUtility; +use TYPO3\CMS\Extbase\Object\ObjectManager; +use TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper; +use TYPO3\CMS\Extbase\Persistence\Repository; + +/** + * DiGAS Frontend User repository + */ +class AccessRepository extends Repository +{ + /** + * @var int Storage PID + */ + protected $storagePid; + + /** + * @param int $storagePid + */ + public function setStoragePid($storagePid) + { + $this->storagePid = $storagePid; + } + + /** + * @var string + */ + protected $tableName = 'tx_digasfemanagement_domain_model_access'; + + /** + * @param int $feUserId + * @return array + */ + public function findRequestsForUser(int $feUserId): array + { + $query = $this->createQuery(); + $query->getQuerySettings()->setIgnoreEnableFields(true); + + return $query->matching( + $query->logicalAnd([ + $query->equals('fe_user', $feUserId), + ])) + ->execute() + ->toArray(); + } + + /** + * @param int $feUserId + * @return Access[] + * @throws \TYPO3\CMS\Extbase\Persistence\Exception\InvalidQueryException + */ + public function findAccessGrantedEntriesByUser(int $feUserId): array + { + $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getConnectionForTable($this->tableName)->createQueryBuilder(); + // starttime + endtime get checked by typo3 core logic + //remove hidden restriction + $queryBuilder->getRestrictions()->removeByType(HiddenRestriction::class); + + $rows = $queryBuilder->select('*') + ->where( + $queryBuilder->expr()->eq($this->tableName . '.access_granted_notification', 0), + $queryBuilder->expr()->eq($this->tableName . '.inform_user', 1), + $queryBuilder->expr()->eq($this->tableName . '.fe_user', $feUserId), + ) + ->from($this->tableName) + ->orderBy($this->tableName . '.rejected','ASC') + ->execute() + ->fetchAll(); + + $dataMapper = GeneralUtility::makeInstance(ObjectManager::class)->get(DataMapper::class); + + return $dataMapper->map(Access::class, $rows); + } + + /** + * Get uids of fe_users with granted access + * + * @return Access[] + */ + public function findAccessGrantedUsers() + { + $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getConnectionForTable($this->tableName)->createQueryBuilder(); + // starttime + endtime get checked by typo3 core logic + //remove hidden restriction + $queryBuilder->getRestrictions()->removeByType(HiddenRestriction::class); + + $rows = $queryBuilder->select('*') + ->where( + $queryBuilder->expr()->eq($this->tableName . '.access_granted_notification', 0), + $queryBuilder->expr()->eq($this->tableName . '.inform_user', true), + ) + ->from($this->tableName) + ->groupBy($this->tableName . '.fe_user') + ->execute() + ->fetchAll(); + + $dataMapper = GeneralUtility::makeInstance(ObjectManager::class)->get(DataMapper::class); + return $dataMapper->map(Access::class, $rows); + } + + /** + * Get uids of fe_users with expiring document acccess + * + * @param int $expirationTimestamp + * @return Access[] + */ + public function findExpirationUsers($expirationTimestamp) + { + $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getConnectionForTable($this->tableName)->createQueryBuilder(); + $rows = $queryBuilder->select('*') + ->where( + $queryBuilder->expr()->eq($this->tableName . '.expire_notification', 0), + $queryBuilder->expr()->lte($this->tableName . '.endtime', $expirationTimestamp) + ) + ->from($this->tableName) + ->groupBy($this->tableName . '.fe_user') + ->execute() + ->fetchAll(); + + $dataMapper = GeneralUtility::makeInstance(ObjectManager::class)->get(DataMapper::class); + return $dataMapper->map(Access::class, $rows); + } + + /** + * @param int $feUserId + * @param int $expirationTimestamp + * @return array + */ + public function findExpiringEntriesByUser(int $feUserId, $expirationTimestamp) + { + $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getConnectionForTable($this->tableName)->createQueryBuilder(); + + // starttime + endtime get checked by typo3 core logic + $rows = $queryBuilder->select('*') + ->where( + $queryBuilder->expr()->eq($this->tableName . '.expire_notification', 0), + $queryBuilder->expr()->lte($this->tableName . '.endtime', $expirationTimestamp), + $queryBuilder->expr()->eq($this->tableName . '.fe_user', $feUserId) + ) + ->from($this->tableName) + ->execute() + ->fetchAll(); + + $dataMapper = GeneralUtility::makeInstance(ObjectManager::class)->get(DataMapper::class); + + return $dataMapper->map(Access::class, $rows); + } +} diff --git a/Classes/Domain/Repository/KitodoDocumentRepository.php b/Classes/Domain/Repository/KitodoDocumentRepository.php new file mode 100644 index 0000000..a451f71 --- /dev/null +++ b/Classes/Domain/Repository/KitodoDocumentRepository.php @@ -0,0 +1,76 @@ + + * All rights reserved + * + * This script is part of the TYPO3 project. The TYPO3 project is + * free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * The GNU General Public License can be found at + * http://www.gnu.org/copyleft/gpl.html. + * + * This script is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This copyright notice MUST APPEAR in all copies of the script! + ***************************************************************/ + +use Slub\SlubWebDigas\Domain\Model\KitodoDocument; +use TYPO3\CMS\Core\Database\Connection; +use TYPO3\CMS\Core\Database\ConnectionPool; +use \TYPO3\CMS\Core\Utility\GeneralUtility; +use TYPO3\CMS\Extbase\Object\ObjectManager; +use TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper; + +class KitodoDocumentRepository extends \TYPO3\CMS\Extbase\Persistence\Repository +{ + /** + * @var string + */ + protected $tableName = 'tx_dlf_documents'; + + /** + * Find Kitodo documents by record_id + * + * @param array $documentIds + * @return array + */ + public function findDocumentsByRecordId(array $documentIds) + { + $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getConnectionForTable($this->tableName)->createQueryBuilder(); + $documents = $queryBuilder->select('*') + ->where( + $queryBuilder->expr()->in('record_id', $queryBuilder->createNamedParameter($documentIds, Connection::PARAM_STR_ARRAY)), + $queryBuilder->expr()->eq('restrictions', $queryBuilder->createNamedParameter('ja')) + ) + ->from($this->tableName) + ->execute() + ->fetchAll(); + + return $this->dataMapQueryResult($documents); + } + + /** + * Map statistic query result to statistic objects + * + * @param array $rows + * @return KitodoDocument[] + */ + protected function dataMapQueryResult(array $rows): array + { + /** @var DataMapper $dataMapper */ + $dataMapper = GeneralUtility::makeInstance(ObjectManager::class)->get(DataMapper::class); + + return $dataMapper->map(KitodoDocument::class, $rows); + } +} diff --git a/Classes/Domain/Repository/UserRepository.php b/Classes/Domain/Repository/UserRepository.php index 95d4a9b..acc3fcd 100644 --- a/Classes/Domain/Repository/UserRepository.php +++ b/Classes/Domain/Repository/UserRepository.php @@ -48,10 +48,10 @@ public function setStoragePid($storagePid) /** * @param int $deleteTimespan The crdate timestamp to check - * @param string $feUserGroup Frontend user group (must be set in constants {$femanager.feUserGroup}) + * @param array $feUserGroups Array of Frontend user groups (must be set in constants {$femanager.feUserGroups}) * @return User[] */ - public function findInactiveAccounts($deleteTimespan, $feUserGroup) + public function findInactiveAccounts(int $deleteTimespan, array $feUserGroups) { $query = $this->createQuery(); $query->getQuerySettings() @@ -62,7 +62,7 @@ public function findInactiveAccounts($deleteTimespan, $feUserGroup) $user = $query->matching( $query->logicalAnd([ $query->equals('disable', true), - $query->equals('usergroup', $feUserGroup), + $query->in('usergroup', $feUserGroups), $query->equals('tx_femanager_confirmedbyuser', 0), $query->equals('tx_femanager_confirmedbyadmin', 0), $query->lessThan('crdate', $deleteTimespan) @@ -75,11 +75,11 @@ public function findInactiveAccounts($deleteTimespan, $feUserGroup) /** * @param int $unusedTimestamp - * @param string $feUserGroup Frontend user group (must be set in constants {$femanager.feUserGroup}) + * @param array $feUserGroups Array of Frontend user groups (must be set in constants {$femanager.feUserGroups}) * @return User[] * @throws \TYPO3\CMS\Extbase\Persistence\Exception\InvalidQueryException */ - public function findUnusedAccounts(int $unusedTimestamp, $feUserGroup) + public function findUnusedAccounts(int $unusedTimestamp, array $feUserGroups) { $query = $this->createQuery(); $query->getQuerySettings()->setStoragePageIds([$this->storagePid]); @@ -90,7 +90,7 @@ public function findUnusedAccounts(int $unusedTimestamp, $feUserGroup) $query->lessThan('lastlogin', $unusedTimestamp), $query->equals('disable', false), $query->equals('tx_femanager_confirmedbyuser', 1), - $query->equals('usergroup', $feUserGroup), + $query->in('usergroup', $feUserGroups), $query->equals('inactivemessage_tstamp', null) ])) ->execute() @@ -101,11 +101,11 @@ public function findUnusedAccounts(int $unusedTimestamp, $feUserGroup) /** * @param int $deleteTimestamp - * @param string $feUserGroup Frontend user group (must be set in constants {$femanager.feUserGroup}) + * @param array $feUserGroups Array of Frontend user groups (must be set in constants {$femanager.feUserGroups}) * @return User[] * @throws \TYPO3\CMS\Extbase\Persistence\Exception\InvalidQueryException */ - public function findAccountsToDelete(int $deleteTimestamp, $feUserGroup) + public function findAccountsToDelete(int $deleteTimestamp, array $feUserGroups) { $query = $this->createQuery(); $query->getQuerySettings()->setStoragePageIds([$this->storagePid]); @@ -114,7 +114,7 @@ public function findAccountsToDelete(int $deleteTimestamp, $feUserGroup) $user = $query->matching( $query->logicalAnd([ $query->lessThan('lastlogin', $deleteTimestamp), - $query->equals('usergroup', $feUserGroup), + $query->in('usergroup', $feUserGroups), $query->lessThan('inactivemessage_tstamp', $deleteTimestamp) ])) ->execute() @@ -125,11 +125,11 @@ public function findAccountsToDelete(int $deleteTimestamp, $feUserGroup) /** * @param int $timestamp - * @param string $feUserGroup Frontend user group (must be set in constants {$femanager.feUserGroup}) + * @param array $feUserGroups Array of Frontend user groups (must be set in constants {$femanager.feUserGroups}) * @return User[] * @throws \TYPO3\CMS\Extbase\Persistence\Exception\InvalidQueryException */ - public function findDeactivatedAccounts(int $timestamp, $feUserGroup) + public function findDeactivatedAccounts(int $timestamp, array $feUserGroups) { $query = $this->createQuery(); $query->getQuerySettings() @@ -140,7 +140,7 @@ public function findDeactivatedAccounts(int $timestamp, $feUserGroup) $user = $query->matching( $query->logicalAnd([ $query->equals('disable', true), - $query->equals('usergroup', $feUserGroup), + $query->in('usergroup', $feUserGroups), $query->lessThan('inactivemessage_tstamp', $timestamp) ])) ->execute() diff --git a/Classes/Slots/AfterPasswordChange.php b/Classes/Slots/AfterPasswordChange.php new file mode 100644 index 0000000..df8e1c5 --- /dev/null +++ b/Classes/Slots/AfterPasswordChange.php @@ -0,0 +1,155 @@ + + * All rights reserved + * + * This script is part of the TYPO3 project. The TYPO3 project is + * free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * The GNU General Public License can be found at + * http://www.gnu.org/copyleft/gpl.html. + * + * This script is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This copyright notice MUST APPEAR in all copies of the script! + ***************************************************************/ + +use In2code\Femanager\Domain\Service\SendMailService; +use In2code\Femanager\Utility\HashUtility; +use In2code\Femanager\Utility\StringUtility; +use Slub\DigasFeManagement\Domain\Model\User; +use Slub\DigasFeManagement\Domain\Repository\UserRepository; +use TYPO3\CMS\Core\Exception; +use TYPO3\CMS\Core\Utility\GeneralUtility; +use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface; +use TYPO3\CMS\Extbase\Object\ObjectManager; +use TYPO3\CMS\Extbase\Persistence\Exception\IllegalObjectTypeException; +use TYPO3\CMS\Extbase\Persistence\Exception\UnknownObjectException; + +class AfterPasswordChange +{ + /** + * @var UserRepository $userRepository + */ + protected $userRepository = null; + + /** + * typoscript settings from femanager + * @var array $settings + */ + protected $settings = []; + + /** + * config from femanager + * @var array $config + */ + protected $config = []; + + /** + * @var SendMailService $sendMailService + */ + protected $sendMailService = null; + + + /** + * initialize userRepository, user, settings, femanagerConfiguration, sendMailService + * @return void + */ + public function init() + { + //initialize objectManager + $objectManager = GeneralUtility::makeInstance(ObjectManager::class); + + //initialize UserRepository + $this->userRepository = $objectManager->get(UserRepository::class); + + //initialize configurationManager + $configurationManager = $objectManager->get(ConfigurationManagerInterface::class); + + //get settings for femanager mail service + $this->settings = $configurationManager->getConfiguration( + ConfigurationManagerInterface::CONFIGURATION_TYPE_SETTINGS, 'femanager') ?? []; + + //get config for femanager mail service + $this->config = $configurationManager->getConfiguration( + ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT)['plugin.']['tx_femanager.']['settings.'] ?? []; + + //invoke sendMailService + $this->sendMailService = $objectManager->get(SendMailService::class); + } + + /** + * + * @param $changePassword + * @param $passwordPasswordController + * @return void + */ + public function createUserNotifyMail($changePassword, $passwordPasswordController) + { + + //check if confirmation mail was already sent + if ($GLOBALS['TSFE']->fe_user->user['pw_changed_on_confirmation'] === 0) { + + //initialize + $this->init(); + + /** + * @var User $userToUpdate + */ + $userToUpdate = $this->userRepository->findByUid($GLOBALS['TSFE']->fe_user->user['uid']); + + //send mail service from fe Manger + $this->sendMail($userToUpdate); + + //confirm, password was changed + $userToUpdate->setPwChangedOnConfirmation(true); + + try { + //update user + $this->userRepository->update($userToUpdate); + + } catch (UnknownObjectException $e) { + new UnknownObjectException('User could not be updated. UnknownObjectException'); + return; + } catch (IllegalObjectTypeException $e) { + new Exception('User could not be updated. IllegalObjectTypeException'); + return; + } + } + } + + /** + * send mail service from femanager + * as found in In2code\Femanager\Controller\AbstractController, line 222ff + * @param User $user + */ + public function sendMail(User $user=null) + { + if (!empty($this->settings) && !empty($this->config) && $user) { + $variables = ['user' => $user, 'settings' => $this->settings, 'hash' => HashUtility::createHashForUser($user)]; + + $this->sendMailService->send( + 'createUserNotifyAfterPwChange', + StringUtility::makeEmailArray($user->getEmail(), $user->getFirstName() . ' ' . $user->getLastName()), + StringUtility::makeEmailArray( + $this->settings['new']['email']['createUserNotifyAfterPwChange']['sender']['email']['value'], + $this->settings['new']['email']['createUserNotifyAfterPwChange']['sender']['name']['value'] + ), + 'Profile creation', + $variables, + $this->config['new.']['email.']['createUserNotifyAfterPwChange.'] + ); + } + } +} diff --git a/Classes/ViewHelpers/KitodoAccessViewHelper.php b/Classes/ViewHelpers/KitodoAccessViewHelper.php index ed34eb4..7b278d3 100644 --- a/Classes/ViewHelpers/KitodoAccessViewHelper.php +++ b/Classes/ViewHelpers/KitodoAccessViewHelper.php @@ -25,9 +25,12 @@ * This copyright notice MUST APPEAR in all copies of the script! ***************************************************************/ +use Slub\DigasFeManagement\Domain\Model\User; +use Slub\DigasFeManagement\Domain\Repository\UserRepository; use TYPO3\CMS\Core\Database\ConnectionPool; use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface; use TYPO3\CMS\Extbase\Object\ObjectManager; +use TYPO3\CMS\Extbase\Persistence\ObjectStorage; use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface; use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper; use TYPO3\CMS\Core\Context\Context; @@ -91,7 +94,7 @@ public static function renderStatic(array $arguments, \Closure $renderChildrenCl $kitodoDocument = KitodoAccessViewHelper::getDlfDocument(intval($arguments['id'])); // check if document could be fetched - if ($kitodoDocument === false) { + if ($kitodoDocument == false) { return false; } @@ -103,7 +106,15 @@ public static function renderStatic(array $arguments, \Closure $renderChildrenCl // check decided access for current fe-user if (GeneralUtility::makeInstance(Context::class)->getPropertyFromAspect('frontend.user','isLoggedIn')) { - $accessIds = explode("\r\n", $GLOBALS['TSFE']->fe_user->user['kitodo_feuser_access']); + //invoke user repository + $userRepository = GeneralUtility::makeInstance(ObjectManager::class)->get(UserRepository::class); + /** + * @var User $currentUser + */ + $currentUser = $userRepository->findByUid($GLOBALS['TSFE']->fe_user->user['uid']); + //get accessible documents of current fe_user + $accessIds = KitodoAccessViewHelper::getKitodoDocmentAccessIdsAsArray($currentUser->getKitodoDocumentAccess()); + return in_array($kitodoDocument['record_id'], $accessIds); } return false; @@ -121,13 +132,34 @@ protected static function getSettings() { return $typoScriptConfiguration['plugin.']['tx_digasfemanagement.']['settings.']; } + + /** + * iterate over accessible documents of current fe_user + * return accessible document ids as array + * + * @param ObjectStorage $kitodoDocumentAccess + * @return array + */ + protected static function getKitodoDocmentAccessIdsAsArray(ObjectStorage $kitodoDocumentAccess) : array + { + $accessIds = []; + + if(!empty($kitodoDocumentAccess)) { + foreach ($kitodoDocumentAccess as $document) { + array_push($accessIds, trim($document->getRecordId())); + } + } + + return $accessIds; + } + /** * fetch dlf document by uid * * @param int $uid * @return void */ - protected static function getDlfDocument($uid) { + protected static function getDlfDocument(int $uid) { $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) ->getQueryBuilderForTable('tx_dlf_documents'); diff --git a/Classes/ViewHelpers/KitodoSessionViewHelper.php b/Classes/ViewHelpers/KitodoSessionViewHelper.php new file mode 100644 index 0000000..c4cc123 --- /dev/null +++ b/Classes/ViewHelpers/KitodoSessionViewHelper.php @@ -0,0 +1,83 @@ + + * All rights reserved + * + * This script is part of the TYPO3 project. The TYPO3 project is + * free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * The GNU General Public License can be found at + * http://www.gnu.org/copyleft/gpl.html. + * + * This script is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This copyright notice MUST APPEAR in all copies of the script! + ***************************************************************/ + +use TYPO3\CMS\Core\Context\Context; +use TYPO3\CMS\Core\Context\Exception\AspectNotFoundException; +use TYPO3\CMS\Core\Utility\GeneralUtility; +use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractConditionViewHelper; + +/** + * ViewHelper to check if user is logged in or has confirmed a dialog + * + * # Example: Basic example + * + * + * + * + * + * + * + * + * no inline code available + * + * + * + * Will return true / false + * + * + * @package TYPO3 + */ +class KitodoSessionViewHelper extends AbstractConditionViewHelper +{ + /** + * Initialize arguments + */ + public function initializeArguments() + { + $this->registerArgument('cookieName', 'string', 'Kitodo cookie to check if private user has seen the dialog', false, 'fe_kitodo_dialog'); + } + + /** + * This method decides if the condition is TRUE or FALSE. It can be overridden in extending viewhelpers to adjust functionality. + * + * @param array $arguments ViewHelper arguments to evaluate the condition for this ViewHelper, allows for flexiblity in overriding this method. + * @return bool + * @throws AspectNotFoundException + */ + protected static function evaluateCondition($arguments = null) + { + $user = GeneralUtility::makeInstance(Context::class)->getPropertyFromAspect('frontend.user', 'id', 0) > 0; + + //user is logged in + if($user) { + return true; + } + + //cookie is set + return $GLOBALS["TSFE"]->fe_user->getKey("ses", $arguments['cookieName']); + } +} diff --git a/Classes/ViewHelpers/RedirectViewHelper.php b/Classes/ViewHelpers/RedirectViewHelper.php index cc845a1..215dd01 100644 --- a/Classes/ViewHelpers/RedirectViewHelper.php +++ b/Classes/ViewHelpers/RedirectViewHelper.php @@ -54,10 +54,38 @@ class RedirectViewHelper extends PageViewHelper */ public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext) { + //check if redirect contains kitodo gp-id and setCookie-param - redirect to set pageUid / set cookie for basket + if(!empty($arguments['additionalParams']['setCookie']) && !empty($arguments['additionalParams']['gp-id'])) { + //set cookie by request params + RedirectViewHelper::setCookie($arguments['additionalParams']['gp-id']); + + //unset redirect parameters + unset($arguments['additionalParams']['setCookie']); + unset($arguments['additionalParams']['gp-id']); + } + $uri = parent::renderStatic($arguments, $renderChildrenClosure, $renderingContext); header("HTTP/1.1 303 See other"); header("Location: $uri"); exit(); } + + /** + * add gp-id to cookie 'dlf-requests' + * + * @param string $newKitodoRequestId + * @return void + */ + protected static function setCookie(string $newKitodoRequestId) { + //get cookie 'dlf-requests' + $kitodoRequestIds = $_COOKIE['dlf-requests']; + $kitodoRequestIds = !empty($kitodoRequestIds) ? json_decode($kitodoRequestIds) : []; + + //add ID to cookie 'dlf-request' if ID is not already contained + if(!in_array($newKitodoRequestId, $kitodoRequestIds)) { + array_push($kitodoRequestIds, $newKitodoRequestId); + setcookie('dlf-requests', json_encode($kitodoRequestIds), '', '/'); + } + } } diff --git a/Configuration/Commands.php b/Configuration/Commands.php index c049f2b..fafabc2 100644 --- a/Configuration/Commands.php +++ b/Configuration/Commands.php @@ -9,6 +9,12 @@ ], 'digas-fe-management:deleteDeactivatedAccountsCommand' => [ 'class' => \Slub\DigasFeManagement\Command\DeleteDeactivatedAccountsCommand::class, + ], + 'digas-fe-management:kitodoAccessGrantedNotification' => [ + 'class' => \Slub\DigasFeManagement\Command\KitodoAccessGrantedNotification::class, + ], + 'digas-fe-management:kitodoAccessExpirationNotification' => [ + 'class' => \Slub\DigasFeManagement\Command\KitodoAccessExpirationNotification::class, ] ]; diff --git a/Configuration/FlexForms/FlexFormBasket.xml b/Configuration/FlexForms/FlexFormBasket.xml new file mode 100644 index 0000000..86901d9 --- /dev/null +++ b/Configuration/FlexForms/FlexFormBasket.xml @@ -0,0 +1,40 @@ + + + 1 + + +
+ + + LLL:EXT:digas_fe_management/Resources/Private/Language/locallang_db.xlf:flexform.main.title + + array + + + + + + reload + + select + selectSingle + + + LLL:EXT:digas_fe_management/Resources/Private/Language/locallang_db.xlf:pleaseChoose + + + + LLL:EXT:digas_fe_management/Resources/Private/Language/locallang_db.xlf:flexform.main.view.list + Basket->index;Basket->request; + + + 1 + 1 + + + + + +
+
+
diff --git a/Configuration/PageTSconfig/Setup/femanager.typoscript b/Configuration/PageTSconfig/Setup/femanager.typoscript index dbe706f..8335db7 100644 --- a/Configuration/PageTSconfig/Setup/femanager.typoscript +++ b/Configuration/PageTSconfig/Setup/femanager.typoscript @@ -3,10 +3,14 @@ tx_femanager { new { addFieldOptions { companyType = LLL:EXT:digas_fe_management/Resources/Private/Language/locallang_db.xlf:tx_femanager_domain_model_user.company_type - kitodoFeuserAccess = LLL:EXT:digas_fe_management/Resources/Private/Language/locallang_db.xlf:tx_femanager_domain_model_user.kitodo_feuser_access disable = LLL:EXT:digas_fe_management/Resources/Private/Language/locallang_db.xlf:tx_femanager_domain_model_user.disable + tempUserOrderingParty = LLL:EXT:digas_fe_management/Resources/Private/Language/locallang_db.xlf:tx_femanager_domain_model_user.temp_user_ordering_party + tempUserAreaLocation = LLL:EXT:digas_fe_management/Resources/Private/Language/locallang_db.xlf:tx_femanager_domain_model_user.temp_user_area_location + tempUserPurpose = LLL:EXT:digas_fe_management/Resources/Private/Language/locallang_db.xlf:tx_femanager_domain_model_user.temp_user_purpose + district = LLL:EXT:digas_fe_management/Resources/Private/Language/locallang_db.xlf:tx_femanager_domain_model_user.district } } + edit < tx_femanager.flexForm.new } } diff --git a/Configuration/PageTSconfig/setup.typoscript b/Configuration/PageTSconfig/setup.typoscript old mode 100755 new mode 100644 diff --git a/Configuration/TCA/Overrides/fe_users.php b/Configuration/TCA/Overrides/fe_users.php index 4717c20..af4b0bf 100644 --- a/Configuration/TCA/Overrides/fe_users.php +++ b/Configuration/TCA/Overrides/fe_users.php @@ -1,6 +1,6 @@ true, 'label' => 'LLL:EXT:digas_fe_management/Resources/Private/Language/locallang_db.xlf:tx_femanager_domain_model_user.company_type', 'config' => [ - 'type' => 'select', - 'renderType' => 'selectSingle', - 'eval' => 'int', - 'default' => 0, - 'items' => [ - [ - '', - '0' - ], - [ - 'LLL:EXT:digas_fe_management/Resources/Private/Language/locallang_db.xlf:' . - 'tx_femanager_domain_model_user.company_type.item1', - '1' - ], - [ - 'LLL:EXT:digas_fe_management/Resources/Private/Language/locallang_db.xlf:' . - 'tx_femanager_domain_model_user.company_type.item2', - '2' - ], - [ - 'LLL:EXT:digas_fe_management/Resources/Private/Language/locallang_db.xlf:' . - 'tx_femanager_domain_model_user.company_type.item3', - '3' - ], - [ - 'LLL:EXT:digas_fe_management/Resources/Private/Language/locallang_db.xlf:' . - 'tx_femanager_domain_model_user.company_type.item4', - '4' - ] - ] + 'type' => 'input', + 'size' => 10, + 'eval' => 'trim', + 'max' => 20 ] ], 'inactivemessage_tstamp' => [ @@ -90,16 +59,6 @@ ] ] ], - 'kitodo_feuser_access' => [ - 'exclude' => true, - 'label' => 'LLL:EXT:digas_fe_management/Resources/Private/Language/locallang_db.xlf:tx_femanager_domain_model_user.kitodo_feuser_access', - 'config' => [ - 'type' => 'text', - 'cols' => 40, - 'rows' => 15, - 'eval' => 'trim' - ] - ], 'saved_searches' => [ 'exclude' => true, 'label' => 'LLL:EXT:digas_fe_management/Resources/Private/Language/locallang_db.xlf:tx_femanager_domain_model_user.saved_searches', @@ -136,7 +95,81 @@ 'eval' => 'trim', 'max' => 20 ] - ] + ], + 'pw_changed_on_confirmation' => [ + 'exclude' => true, + 'label' => 'LLL:EXT:digas_fe_management/Resources/Private/Language/locallang_db.xlf:tx_femanager_domain_model_user.pw_changed_on_confirmation', + 'config' => [ + 'type' => 'check', + #'readOnly' => 1 + ] + ], + 'temp_user_ordering_party' => [ + 'exclude' => true, + 'label' => 'LLL:EXT:digas_fe_management/Resources/Private/Language/locallang_db.xlf:tx_femanager_domain_model_user.temp_user_ordering_party', + 'config' => [ + 'type' => 'input', + 'size' => 50, + 'eval' => 'trim' + ] + ], + 'temp_user_area_location' => [ + 'exclude' => true, + 'label' => 'LLL:EXT:digas_fe_management/Resources/Private/Language/locallang_db.xlf:tx_femanager_domain_model_user.temp_user_area_location', + 'config' => [ + 'type' => 'text', + 'rows' => 3, + 'cols' => 50, + 'eval' => 'trim' + ] + ], + 'temp_user_purpose' => [ + 'exclude' => true, + 'label' => 'LLL:EXT:digas_fe_management/Resources/Private/Language/locallang_db.xlf:tx_femanager_domain_model_user.temp_user_purpose', + 'config' => [ + 'type' => 'text', + 'rows' => 3, + 'cols' => 50, + 'eval' => 'trim' + ] + ], + 'kitodo_document_access' => [ + 'exclude' => true, + 'label' => 'LLL:EXT:digas_fe_management/Resources/Private/Language/locallang_db.xlf:tx_femanager_domain_model_user.kitodo_document_access', + 'config' => [ + 'type' => 'inline', + 'foreign_table' => 'tx_digasfemanagement_domain_model_access', + 'foreign_field' => 'fe_user', + 'foreign_default_sortby' => 'ORDER BY crdate DESC', + 'maxitems' => 1000, + 'eval' => 'int', + 'default' => 0, + 'appearance' => [ + 'collapseAll' => 1, + 'expandSingle' => 1, + 'useSortable' => false, + + 'enabledControls' => [ + 'info' => true, + 'new' => true, + 'dragdrop' => false, + 'sort' => false, + 'hide' => true, + 'delete' => true, + ], + ], + ] + ], + 'district' => [ + 'exclude' => true, + 'label' => 'LLL:EXT:digas_fe_management/Resources/Private/Language/locallang_db.xlf:tx_femanager_domain_model_user.district', + 'config' => [ + 'type' => 'input', + 'size' => 20, + 'eval' => 'trim', + 'max' => 50 + ] + ], ]; @@ -149,6 +182,13 @@ 'after:company' ); +\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes( + 'fe_users', + 'district', + '', + 'after:city' +); + \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes( 'fe_users', 'inactivemessage_tstamp', @@ -172,7 +212,7 @@ \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes( 'fe_users', - '--div--;LLL:EXT:digas_fe_management/Resources/Private/Language/locallang_db.xlf:tx_femanager_domain_model_user.tab.kitodo,kitodo_feuser_access', + '--div--;LLL:EXT:digas_fe_management/Resources/Private/Language/locallang_db.xlf:tx_femanager_domain_model_user.tab.kitodo,kitodo_document_access', '', '' ); @@ -183,3 +223,17 @@ '', '' ); + +\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addFieldsToPalette( + 'fe_users', + 'password_settings', + 'pw_changed_on_confirmation', + 'after:password_expiry_date' +); + +\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes( + 'fe_users', + '--div--;LLL:EXT:digas_fe_management/Resources/Private/Language/locallang_db.xlf:tx_femanager_domain_model_user.tab.temp_user,temp_user_ordering_party,temp_user_area_location,temp_user_purpose', + '', + 'after:saved_searches' +); diff --git a/Configuration/TCA/Overrides/tt_content.php b/Configuration/TCA/Overrides/tt_content.php index 92201c6..ebbfb34 100644 --- a/Configuration/TCA/Overrides/tt_content.php +++ b/Configuration/TCA/Overrides/tt_content.php @@ -53,6 +53,15 @@ 'FILE:EXT:digas_fe_management/Configuration/FlexForms/FlexFormAdministration.xml' ); +/** + * Femanager Access Kitodo Documents + */ +\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin( + 'Slub.DigasFeManagement', + 'Access', + 'FE_Manager Access Kitodo Documents' +); + /** * Disable non needed fields in tt_content */ @@ -77,6 +86,26 @@ 'FILE:EXT:digas_fe_management/Configuration/FlexForms/FlexFormStatistic.xml' ); + +/** + * Femanager Basket Kitodo Documents + */ +\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin( + 'Slub.DigasFeManagement', + 'Basket', + 'FE_Manager Basket' +); + +/** + * Flexform + */ +$pluginSignature = 'digasfemanagement_basket'; +$GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist']['digasfemanagement_basket'] = 'pi_flexform'; +\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue( + $pluginSignature, + 'FILE:EXT:digas_fe_management/Configuration/FlexForms/FlexFormBasket.xml' +); + /** * Disable non needed fields in tt_content */ diff --git a/Configuration/TCA/tx_digasfemanagement_domain_model_access.php b/Configuration/TCA/tx_digasfemanagement_domain_model_access.php new file mode 100644 index 0000000..8d98b33 --- /dev/null +++ b/Configuration/TCA/tx_digasfemanagement_domain_model_access.php @@ -0,0 +1,148 @@ + [ + 'title' => 'LLL:EXT:digas_fe_management/Resources/Private/Language/locallang_db.xlf:tx_digasfemanagement_domain_model_access', + 'label' => 'dlf_document', + 'default_sortby' => 'ORDER BY crdate DESC', + 'hideTable' => true, + 'tstamp' => 'tstamp', + 'crdate' => 'crdate', + 'cruser_id' => 'cruser_id', + 'versioningWS' => true, + 'delete' => 'deleted', + 'enablecolumns' => [ + 'disabled' => 'hidden', + 'starttime' => 'starttime', + 'endtime' => 'endtime', + ], + 'searchFields' => '', + 'iconfile' => 'EXT:digas_fe_management/Resources/Public/Icons/tx_digasfemanagement_domain_model_access.gif' + ], + 'interface' => [ + 'showRecordFieldList' => 'hidden,starttime,endtime,dlf_document,record_id, fe_user', + ], + 'types' => [ + '1' => [ + 'showitem' => '--palette--;;dlf_document,--palette--;;access_dlf_documents,rejected_reason,fe_user,--palette--;;access_notifications' + ], + ], + 'palettes' => [ + 'dlf_document' => [ + 'showitem' => 'dlf_document,record_id,', + ], + 'access_dlf_documents' => [ + 'showitem' => 'hidden,rejected,--linebreak--,starttime,endtime,--linebreak--,', + ], + 'access_notifications' => [ + 'showitem' => 'access_granted_notification,expire_notification, inform_user', + ], + ], + 'columns' => [ + 'hidden' => [ + 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.visible', + 'config' => [ + 'type' => 'check', + 'renderType' => 'checkboxToggle', + 'items' => [ + [ + 0 => '', + 1 => '', + 'invertStateDisplay' => true + ] + ], + 'default' => 1 + ], + ], + 'starttime' => [ + 'label' => 'LLL:EXT:digas_fe_management/Resources/Private/Language/locallang_db.xlf:tx_digasfemanagement_domain_model_access.starttime', + 'config' => [ + 'type' => 'input', + 'renderType' => 'inputDateTime', + 'size' => 13, + 'eval' => 'datetime', + 'default' => 0, + ], + ], + 'endtime' => [ + 'label' => 'LLL:EXT:digas_fe_management/Resources/Private/Language/locallang_db.xlf:tx_digasfemanagement_domain_model_access.endtime', + 'config' => [ + 'type' => 'input', + 'renderType' => 'inputDateTime', + 'size' => 13, + 'eval' => 'datetime', + 'default' => 0, + ], + ], + 'record_id' => [ + 'label' => 'LLL:EXT:digas_fe_management/Resources/Private/Language/locallang_db.xlf:tx_digasfemanagement_domain_model_access.record_id', + 'config' => [ + 'type' => 'input', + 'size' => 20, + 'eval' => 'required,trim' + ], + ], + 'dlf_document' => [ + 'label' => 'LLL:EXT:digas_fe_management/Resources/Private/Language/locallang_db.xlf:tx_digasfemanagement_domain_model_access.dlf_document', + 'config' => [ + 'type' => 'select', + 'foreign_table' => 'tx_dlf_documents', + 'foreign_table_where' => 'AND tx_dlf_documents.restrictions="ja"', + 'items' => [ + ['',''] + ], + 'minitems' => 1, + 'maxitems' => 1, + 'eval' => 'required,int' + ], + ], + 'fe_user' => [ + 'config' => [ + 'type' => 'passthrough', + ], + ], + 'access_granted_notification' => [ + 'label' => 'LLL:EXT:digas_fe_management/Resources/Private/Language/locallang_db.xlf:tx_digasfemanagement_domain_model_access.access_granted_notification', + 'config' => [ + 'type' => 'input', + 'renderType' => 'inputDateTime', + 'size' => 13, + 'eval' => 'datetime', + 'default' => 0, + ], + ], + 'expire_notification' => [ + 'label' => 'LLL:EXT:digas_fe_management/Resources/Private/Language/locallang_db.xlf:tx_digasfemanagement_domain_model_access.expire_notification', + 'config' => [ + 'type' => 'input', + 'renderType' => 'inputDateTime', + 'size' => 13, + 'eval' => 'datetime', + 'default' => 0, + ], + ], + 'rejected' => [ + 'label' => 'LLL:EXT:digas_fe_management/Resources/Private/Language/locallang_db.xlf:tx_digasfemanagement_domain_model_access.rejected', + 'config' => [ + 'type' => 'check', + 'renderType' => 'checkboxToggle' + ], + ], + 'rejected_reason' => [ + 'label' => 'LLL:EXT:digas_fe_management/Resources/Private/Language/locallang_db.xlf:tx_digasfemanagement_domain_model_access.rejected_reason', + 'config' => [ + 'type' => 'text', + 'rows' => 2, + 'cols' => 50, + ], + ], + + 'inform_user' => [ + 'label' => 'LLL:EXT:digas_fe_management/Resources/Private/Language/locallang_db.xlf:tx_digasfemanagement_domain_model_access.inform_user', + 'config' => [ + 'type' => 'check', + 'renderType' => 'checkboxToggle' + ], + ], + + ], +]; diff --git a/Configuration/TypoScript/Setup/Extensions/config/setup.typoscript b/Configuration/TypoScript/Setup/Extensions/config/setup.typoscript index 0c12d19..1386ef4 100644 --- a/Configuration/TypoScript/Setup/Extensions/config/setup.typoscript +++ b/Configuration/TypoScript/Setup/Extensions/config/setup.typoscript @@ -29,6 +29,28 @@ plugin.tx_digasfemanagement { } kitodoAccessGroups = {$femanager.kitodoAccessGroups} + + access { + endTimeFieldDefaultValue = {$femanager.access.endTimeFieldDefaultValue} + } + + dialog { + cookieName = {$femanager.kitodoSessionCookieName} + + assets { + css { + digasCss { + file = EXT:slub_web_digas/Resources/Public/Css/digasStyles.css + forceOnTop = 1 + } + + dialogCSS { + file = EXT:digas_fe_management/Resources/Public/Css/dialog.css + forceOnTop = 0 + } + } + } + } } } @@ -36,6 +58,9 @@ page { 10 { settings { contactFormUid = {$femanager.pids.contactFormUid} + kitodoSessionCookieName = {$femanager.kitodoSessionCookieName} + basketUid = {$femanager.pids.basketUid} + generalAccessFeUserGroup = {$femanager.generalAccessFeUserGroup} } } } diff --git a/Configuration/TypoScript/Setup/Extensions/fe_login/setup.typoscript b/Configuration/TypoScript/Setup/Extensions/fe_login/setup.typoscript index e71307d..d3f4db9 100644 --- a/Configuration/TypoScript/Setup/Extensions/fe_login/setup.typoscript +++ b/Configuration/TypoScript/Setup/Extensions/fe_login/setup.typoscript @@ -9,4 +9,26 @@ plugin.tx_felogin_pi1 { de.username = Email-Adresse default.username = Email-Address } -} \ No newline at end of file +} + +# change logout form labels if temp user +[usergroup('{$femanager.kitodoTempUserGroup}')] + page.headerData.100100101 = TEXT + page.headerData.100100101 { + value ( + + ) + } + + plugin.tx_felogin_pi1 { + _LOCAL_LANG { + de.logout = Jetzt anmelden + default.logout = Login now + de.ll_status_message = Falls Sie bereits einen Login besitzen, können Sie sich hier anmelden: + default.ll_status_message = If you already have a login, you can register here: + } + } +[end] diff --git a/Configuration/TypoScript/Setup/Extensions/femanager/00-config.typoscript b/Configuration/TypoScript/Setup/Extensions/femanager/00-config.typoscript index 2f1b568..498fa7d 100644 --- a/Configuration/TypoScript/Setup/Extensions/femanager/00-config.typoscript +++ b/Configuration/TypoScript/Setup/Extensions/femanager/00-config.typoscript @@ -32,6 +32,24 @@ page { } plugin.tx_femanager { + view { + templateRootPaths { + 0 = EXT:femanager/Resources/Private/Templates/ + 1 = {$plugin.tx_femanager.view.templateRootPath} + 10 = EXT:digas_fe_management/Resources/Private/Templates/ + } + partialRootPaths { + 0 = EXT:femanager/Resources/Private/Partials/ + 1 = {$plugin.tx_femanager.view.partialRootPath} + 10 = EXT:digas_fe_management/Resources/Private/Partials/ + } + layoutRootPaths { + 0 = EXT:femanager/Resources/Private/Layouts/ + 1 = {$plugin.tx_femanager.view.layoutRootPath} + 10 = EXT:digas_fe_management/Resources/Private/Layouts/ + } + } + persistence { storagePid = {$femanager.pids.feUsers} } @@ -40,7 +58,8 @@ plugin.tx_femanager { adminName = {$plugin.tx_femanager.settings.adminName} adminEmail = {$plugin.tx_femanager.settings.adminEmail} - feUserGroup = {$femanager.feUserGroup} + feUserGroups = {$femanager.feUserGroups} + generalAccessFeUserGroup = {$femanager.generalAccessFeUserGroup} languageFile = LLL:EXT:digas_fe_management/Resources/Private/Language/locallang.xlf @@ -56,6 +75,9 @@ plugin.tx_femanager { editProfile = {$femanager.pids.editProfile} editEmail = {$femanager.pids.editEmail} + + kitodoAccessAdministriationPid = {$femanager.pids.kitodoAccessAdministriationPid} + basketUid = {$femanager.pids.basketUid} } administration { diff --git a/Configuration/TypoScript/Setup/Extensions/femanager/10-setup-create.typoscript b/Configuration/TypoScript/Setup/Extensions/femanager/10-setup-create.typoscript index d63928f..0e29231 100644 --- a/Configuration/TypoScript/Setup/Extensions/femanager/10-setup-create.typoscript +++ b/Configuration/TypoScript/Setup/Extensions/femanager/10-setup-create.typoscript @@ -2,6 +2,7 @@ plugin.tx_femanager { settings { languageFile = LLL:EXT:digas_fe_management/Resources/Private/Language/locallang.xlf showCompanyFields = 0 + showFirstNameField = 1 new { login = 1 @@ -26,6 +27,7 @@ plugin.tx_femanager { address.required = 1 zip.required = 1 city.required = 1 + district.required = 0 password.required = 0 password_repeat.required = 0 terms.required = 1 @@ -47,10 +49,18 @@ plugin.tx_femanager { # Email to user to confirm his new profile (with and without admin confirmation) createUserNotify { - _enable.value = 1 + _enable.value = 0 } + # Email to user to confirm his new profile AFTER password change + # extension for slot \Slub\DigasFeManagement\Slots\AfterPasswordChange + createUserNotifyAfterPwChange < plugin.tx_femanager.settings.new.email.createUserNotify + createUserNotifyAfterPwChange { + _enable.value = 1 + } + + # Email for User notify, if admin refused profile registration createUserNotifyRefused { _enable.value = 0 } @@ -67,9 +77,6 @@ plugin.tx_femanager { onUserConfirmation { mustChangePassword = TEXT mustChangePassword.value = 1 - - usergroup = TEXT - usergroup.value = 2 } # Overwrite on admin confirmation (only if admin confirmation was activated) @@ -86,10 +93,15 @@ plugin.tx_femanager { } } -[page["uid"] == {$femanager.pids.createInstitutional}] +[page["uid"] in [{$femanager.pids.createInstitutional}]] plugin.tx_femanager { + # override "lastName" label + _LOCAL_LANG.de.tx_femanager_domain_model_user.lastName = Gesetzlicher Vertreter + _LOCAL_LANG.en.tx_femanager_domain_model_user.lastName = Legal representatives + settings { showCompanyFields = 1 + showFirstNameField = 0 new { validation { @@ -98,7 +110,11 @@ plugin.tx_femanager { } companyType { - required = 1 + required = 0 + } + + firstName { + required = 0 } } } diff --git a/Configuration/TypoScript/Setup/Extensions/femanager/20-setup-edit.typoscript b/Configuration/TypoScript/Setup/Extensions/femanager/20-setup-edit.typoscript index c6ed182..5d158a7 100644 --- a/Configuration/TypoScript/Setup/Extensions/femanager/20-setup-edit.typoscript +++ b/Configuration/TypoScript/Setup/Extensions/femanager/20-setup-edit.typoscript @@ -55,15 +55,21 @@ plugin.tx_femanager { } [end] -[globalVar = TSFE:fe_user|user|company_type>0] +[getTSFE().fe_user.user["usergroup"] in [{$femanager.institutionalFeUserGroups}]] plugin.tx_femanager { + # override "lastName" label + _LOCAL_LANG.de.tx_femanager_domain_model_user.lastName = Gesetzlicher Vertreter + _LOCAL_LANG.en.tx_femanager_domain_model_user.lastName = Legal representatives + settings { showCompanyFields = 1 + showFirstNameField = 0 edit { validation { company.required = 1 - companyType.required = 1 + companyType.required = 0 + firstName.required = 0 } } } @@ -82,7 +88,7 @@ plugin.tx_femanager { new { login = 1 changeEmail = 1 - currentUserFields = company,companyType,address,zip,city,lastName,firstName,gender,telephone,terms,password,usergroup + currentUserFields = company,companyType,address,zip,city,district,country,lastName,firstName,gender,telephone,terms,password,usergroup validation { email.required = 1 @@ -95,6 +101,7 @@ plugin.tx_femanager { address.required = 0 zip.required = 0 city.required = 0 + district.required = 0 terms.required = 0 company.required = 0 companyType.required = 0 @@ -104,9 +111,6 @@ plugin.tx_femanager { onUserConfirmation { mustChangePassword = TEXT mustChangePassword.value = 0 - - usergroup = TEXT - usergroup.value = 2 } } email { @@ -135,9 +139,6 @@ plugin.tx_femanager { onUserConfirmation { mustChangePassword = TEXT mustChangePassword.value = 0 - - usergroup = TEXT - usergroup.value = 2 } } diff --git a/Configuration/TypoScript/Setup/Extensions/femanager/30-setup-administration.typoscript b/Configuration/TypoScript/Setup/Extensions/femanager/30-setup-administration.typoscript index a33c68b..f2c75e2 100644 --- a/Configuration/TypoScript/Setup/Extensions/femanager/30-setup-administration.typoscript +++ b/Configuration/TypoScript/Setup/Extensions/femanager/30-setup-administration.typoscript @@ -11,11 +11,12 @@ plugin.tx_femanager { username.required = 0 usergroup.required = 1 - firstName.required = 1 + firstName.required = 0 lastName.required = 1 address.required = 1 zip.required = 1 city.required = 1 + district.required = 0 company.required = 0 company_type.required = 0 } diff --git a/Configuration/TypoScript/Setup/Extensions/femanager/40-setup-administration-invatiation.typoscript b/Configuration/TypoScript/Setup/Extensions/femanager/40-setup-administration-invatiation.typoscript index 9b550fc..c51d6a8 100644 --- a/Configuration/TypoScript/Setup/Extensions/femanager/40-setup-administration-invatiation.typoscript +++ b/Configuration/TypoScript/Setup/Extensions/femanager/40-setup-administration-invatiation.typoscript @@ -41,6 +41,7 @@ plugin.tx_femanager { address.required = 1 zip.required = 1 city.required = 1 + district.required = 0 password.required = 0 password_repeat.required = 0 } @@ -96,28 +97,25 @@ plugin.tx_femanager { subject.data = LLL:EXT:femanager/Resources/Private/Language/locallang.xlf:emailInvitationSubject } } - - # overwrite any user values with TypoScript - forceValues { - # Overwrite initally (default) - beforeAnyConfirmation { - usergroup = TEXT - usergroup.value = {$femanager.feUserGroup} - } - } } } } -[page["uid"] == {$femanager.administration.pids.createInstitutional}] +[page["uid"] in [{$femanager.administration.pids.createInstitutional}]] plugin.tx_femanager { + # override "lastName" label + _LOCAL_LANG.de.tx_femanager_domain_model_user.lastName = Gesetzlicher Vertreter + _LOCAL_LANG.en.tx_femanager_domain_model_user.lastName = Legal representatives + settings { showCompanyFields = 1 + showFirstNameField = 0 invitation { validation { company.required = 1 - companyType.required = 1 + companyType.required = 0 + firstName.required = 0 } } } diff --git a/Configuration/TypoScript/Setup/Extensions/femanager/50-setup-temp-user.typoscript b/Configuration/TypoScript/Setup/Extensions/femanager/50-setup-temp-user.typoscript new file mode 100644 index 0000000..66fe491 --- /dev/null +++ b/Configuration/TypoScript/Setup/Extensions/femanager/50-setup-temp-user.typoscript @@ -0,0 +1,138 @@ +#################################################################### +# SETUP für temp commercial users +# ------------------------------------------------------------------ +# dialog for frontend user without login: +# - if private, continue with cookie +# - if commercial, register a "temp commercial users" fe_users +#################################################################### +[page["uid"] == {$config.kitodoPageView}] + plugin.tx_femanager { + # add dedicated template path + view { + templateRootPaths.101 = {$plugin.tx_femanager.view.templateRootPath}TempUser/ + } + # set dedicated storagePid + persistence { + storagePid = {$femanager.pids.kitodoTempUserPid} + } + + settings { + new { + # login on create + login = 1 + # redirect to kitodo single view after profile creatin + redirect = TEXT + redirect { + typolink { + parameter = {$config.kitodoPageView} + returnLast = url + addQueryString = 1 + } + } + # remove userConfirmationRedirect: user confirmation is switched off + userConfirmationRedirect> + + validation { + # unset regular validation fields + email.required = 0 + password.required = 0 + password_repeat.required = 0 + username.required = 0 + firstName.required = 0 + lastName.required = 0 + address.required = 0 + zip.required = 0 + city.required = 0 + district.required = 0 + terms.required = 0 + company.required = 0 + companyType.required = 0 + + # set required validation fields for commercial user dialog + name.required = 1 + tempUserOrderingParty.required = 0 + tempUserAreaLocation.required = 1 + tempUserPurpose.required = 1 + } + + forceValues { + beforeAnyConfirmation { + # unset must change password: password is autogenerated + mustChangePassword = TEXT + mustChangePassword.value = 0 + + # set usergroup for temp users + usergroup = TEXT + usergroup.value = {$femanager.kitodoTempUserGroup} + } + onUserConfirmation { + # unset must change password: password is autogenerated + mustChangePassword = TEXT + mustChangePassword.value = 0 + + # set usergroup for temp users + usergroup = TEXT + usergroup.value = {$femanager.kitodoTempUserGroup} + } + } + + # disable all mails + email { + createUserConfirmation { + _enable.value = 0 + } + + createUserNotify { + _enable.value = 0 + } + } + + misc { + # autogenerate settings for temp commercial user + autogenerate { + username { + # Length + length = 10 + } + password { + # Length + length = 32 + # Allow uppercase Characters + addUpperCase = 1 + # Allow special Characters + addSpecialCharacters = 1 + } + } + } + } + } + } + + # render femanager form - needed for lib.kitodoDialogIfLoggedOut + lib.kitodoTempUserForm < styles.content.get + lib.kitodoTempUserForm { + select { + pidInList = {$config.kitodoPageView} + } + } + + # render dialog for frontend user without login before switching to kitodo single view + lib.kitodoDialogIfLoggedOut = USER_INT + lib.kitodoDialogIfLoggedOut { + userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run + extensionName = DigasFeManagement + pluginName = Femanagerextended + vendorName = Slub + action = dialog + controller = Extend + + switchableControllerActions { + Extend { + 1 = dialog + } + } + view < plugin.tx_digasfemanagement.view + persistence < plugin.tx_digasfemanagement.persistence + settings < plugin.tx_digasfemanagement.settings + } +[end] diff --git a/Configuration/TypoScript/Setup/Extensions/femanager/60-setup-request-kitodo-access.typoscript b/Configuration/TypoScript/Setup/Extensions/femanager/60-setup-request-kitodo-access.typoscript new file mode 100644 index 0000000..38928bf --- /dev/null +++ b/Configuration/TypoScript/Setup/Extensions/femanager/60-setup-request-kitodo-access.typoscript @@ -0,0 +1,35 @@ +plugin.tx_femanager { + settings { + requestKitodoAccess { + email { + # (de)activate email completely + _enable = TEXT + _enable.value = 1 + + subject = TEXT + subject.data = LLL:EXT:digas_fe_management/Resources/Private/Language/locallang.xlf:requestKitodoAccess.email.subject + } + } + requestKitodoAccessUser { + email { + # (de)activate email completely + _enable = TEXT + _enable.value = 1 + + subject = TEXT + subject.data = LLL:EXT:digas_fe_management/Resources/Private/Language/locallang.xlf:requestKitodoAccessUser.email.subject + } + } + } +} + +// @todo move to sitepackage extension +page { + includeJSFooter { + digasBasket = EXT:digas_fe_management/Resources/Public/Js/Classes/DigasBasket.js + } + + includeCSS { + digasBasketCss = EXT:digas_fe_management/Resources/Public/Css/digasBasket.css + } +} diff --git a/Configuration/TypoScript/constants.typoscript b/Configuration/TypoScript/constants.typoscript index dbdd10f..d1da3e5 100644 --- a/Configuration/TypoScript/constants.typoscript +++ b/Configuration/TypoScript/constants.typoscript @@ -11,7 +11,7 @@ femanager { # cat=plugin.tx_digasfemanagement/; type=int+; label=Sysfolder uid with fe_users feUsers = - # cat=plugin.tx_digasfemanagement/; type=int+; label=Page uid of "create institutional user" plugin + # cat=plugin.tx_digasfemanagement/; type=string; label=Page uids of "create institutional user" plugin (comma-separated) createInstitutional = # cat=plugin.tx_digasfemanagement/; type=int+; label=Page uid of "create private user" plugin @@ -37,18 +37,44 @@ femanager { # cat=plugin.tx_digasfemanagement/; type=int+; label=Page uid of page "terms of use" termsOfUseUid = + + # cat=plugin.tx_digasfemanagement/; type=int+; label=Sysfolder uid with temp fe_users + kitodoTempUserPid = + + # cat=plugin.tx_digasfemanagement/; type=int+; label=Page uid of kitodo access administration plugin + kitodoAccessAdministriationPid = + + # cat=plugin.tx_digasfemanagement/; type=int+; label=Page uid basket plugin + basketUid = } - # cat=plugin.tx_digasfemanagement/; type=int; label=Uid for frontend users - feUserGroup = + # cat=plugin.tx_digasfemanagement/; type=string; label=Comma-separated list of uids for frontend users + feUserGroups = + + # cat=plugin.tx_digasfemanagement/; type=string; label=Comma-separated list of uids of institutional fe_user groups + institutionalFeUserGroups = + + # cat=plugin.tx_digasfemanagement/; type=ing; label=FE-usergroup with general access to login area (excludes temp user group) + generalAccessFeUserGroup = # cat=plugin.tx_digasfemanagement/; type=string; label=Group access for documents (comma separated group uids) kitodoAccessGroups = + # cat=plugin.tx_digasfemanagement/; type=string+; label=Cookie name for kitodo private user + kitodoSessionCookieName = fe_kitodo_dialog + + # cat=plugin.tx_digasfemanagement/; type=int; label=Uid for kitodo temp users group + kitodoTempUserGroup = + + access { + # cat=plugin.tx_digasfemanagement/; type=string; label=Endtime field default value for document access administration - format strtotime, e.g. "today +1 month" + endTimeFieldDefaultValue = + } + administration { pids { - # cat=plugin.tx_digasfemanagement/; type=int+; label=Page uid of admin create institutional user plugin + # cat=plugin.tx_digasfemanagement/; type=string; label=Page uids of admin create institutional user plugin (comma-separated) createInstitutional = # cat=plugin.tx_digasfemanagement/; type=int+; label=Page uid of admin create private user plugin diff --git a/Configuration/TypoScript/setup.typoscript b/Configuration/TypoScript/setup.typoscript index 77919d8..23c7c5c 100644 --- a/Configuration/TypoScript/setup.typoscript +++ b/Configuration/TypoScript/setup.typoscript @@ -23,4 +23,4 @@ #save search - \ No newline at end of file + diff --git a/Resources/Private/Extensions/femanager/Partials/ChangeEmail/Fields/Email.html b/Resources/Private/Extensions/femanager/Partials/ChangeEmail/Fields/Email.html new file mode 100644 index 0000000..5221495 --- /dev/null +++ b/Resources/Private/Extensions/femanager/Partials/ChangeEmail/Fields/Email.html @@ -0,0 +1,17 @@ +{namespace femanager=In2code\Femanager\ViewHelpers} +
+ + +
+ +
+
diff --git a/Resources/Private/Extensions/femanager/Partials/Fields/AdministrationCompanyType.html b/Resources/Private/Extensions/femanager/Partials/Fields/AdministrationCompanyType.html index c40abf4..781d0c7 100644 --- a/Resources/Private/Extensions/femanager/Partials/Fields/AdministrationCompanyType.html +++ b/Resources/Private/Extensions/femanager/Partials/Fields/AdministrationCompanyType.html @@ -9,18 +9,11 @@
- - - + additionalAttributes="{femanager:Validation.FormValidationData(settings:settings,fieldName:'companyType')}" />
diff --git a/Resources/Private/Extensions/femanager/Partials/Fields/CompanyType.html b/Resources/Private/Extensions/femanager/Partials/Fields/CompanyType.html index 576a21f..8e0ab9a 100644 --- a/Resources/Private/Extensions/femanager/Partials/Fields/CompanyType.html +++ b/Resources/Private/Extensions/femanager/Partials/Fields/CompanyType.html @@ -1,28 +1,19 @@ {namespace femanager=In2code\Femanager\ViewHelpers} -
- -
- - - -
-
+
+ +
+ +
+
diff --git a/Resources/Private/Extensions/femanager/Partials/Fields/Country.html b/Resources/Private/Extensions/femanager/Partials/Fields/Country.html index 608aac1..b7e7282 100644 --- a/Resources/Private/Extensions/femanager/Partials/Fields/Country.html +++ b/Resources/Private/Extensions/femanager/Partials/Fields/Country.html @@ -30,4 +30,4 @@ class="form-control" placeholder="Deutschland" additionalAttributes="{femanager:Validation.FormValidationData(settings:settings,fieldName:'country')}" /> - \ No newline at end of file + diff --git a/Resources/Private/Extensions/femanager/Partials/Fields/Disable.html b/Resources/Private/Extensions/femanager/Partials/Fields/Disable.html index cb08583..18ccf9b 100644 --- a/Resources/Private/Extensions/femanager/Partials/Fields/Disable.html +++ b/Resources/Private/Extensions/femanager/Partials/Fields/Disable.html @@ -1,9 +1,7 @@ {namespace femanager=In2code\Femanager\ViewHelpers} -
-
-
- -
-
- -
-
- -
-
- -
+
diff --git a/Resources/Private/Extensions/femanager/Partials/Fields/KitodoFeuserAccess.html b/Resources/Private/Extensions/femanager/Partials/Fields/KitodoFeuserAccess.html deleted file mode 100644 index 8d6343e..0000000 --- a/Resources/Private/Extensions/femanager/Partials/Fields/KitodoFeuserAccess.html +++ /dev/null @@ -1,15 +0,0 @@ -
- -
- -
-
diff --git a/Resources/Private/Extensions/femanager/Partials/Fields/TempUserAreaLocation.html b/Resources/Private/Extensions/femanager/Partials/Fields/TempUserAreaLocation.html new file mode 100644 index 0000000..1ab5fe8 --- /dev/null +++ b/Resources/Private/Extensions/femanager/Partials/Fields/TempUserAreaLocation.html @@ -0,0 +1,16 @@ +{namespace femanager=In2code\Femanager\ViewHelpers} +
+ +
+ +
+
diff --git a/Resources/Private/Extensions/femanager/Partials/Fields/TempUserOrderingParty.html b/Resources/Private/Extensions/femanager/Partials/Fields/TempUserOrderingParty.html new file mode 100644 index 0000000..8f957e4 --- /dev/null +++ b/Resources/Private/Extensions/femanager/Partials/Fields/TempUserOrderingParty.html @@ -0,0 +1,16 @@ +{namespace femanager=In2code\Femanager\ViewHelpers} +
+ +
+ +
+
diff --git a/Resources/Private/Extensions/femanager/Partials/Fields/TempUserPurpose.html b/Resources/Private/Extensions/femanager/Partials/Fields/TempUserPurpose.html new file mode 100644 index 0000000..bca43a7 --- /dev/null +++ b/Resources/Private/Extensions/femanager/Partials/Fields/TempUserPurpose.html @@ -0,0 +1,16 @@ +{namespace femanager=In2code\Femanager\ViewHelpers} +
+ +
+ +
+
diff --git a/Resources/Private/Extensions/femanager/Partials/Fields/Usergroup.html b/Resources/Private/Extensions/femanager/Partials/Fields/Usergroup.html index 666ddc8..d79013d 100644 --- a/Resources/Private/Extensions/femanager/Partials/Fields/Usergroup.html +++ b/Resources/Private/Extensions/femanager/Partials/Fields/Usergroup.html @@ -19,9 +19,9 @@ optionValueField="uid" optionLabelField="title" sortByOptionLabel="1" + value="{currentFeUserGroup}" defaultOption="{f:translate(key:'pleaseChoose')}" class="form-control" - value="{settings.feUserGroup}" additionalAttributes="{femanager:Validation.FormValidationData(settings:settings,fieldName:'usergroup')}" /> diff --git a/Resources/Private/Extensions/femanager/Templates/Email/CreateUserConfirmation.html b/Resources/Private/Extensions/femanager/Templates/Email/CreateUserConfirmation.html index d488d0b..d28d9f8 100644 --- a/Resources/Private/Extensions/femanager/Templates/Email/CreateUserConfirmation.html +++ b/Resources/Private/Extensions/femanager/Templates/Email/CreateUserConfirmation.html @@ -10,23 +10,23 @@ {hash} Hash to ensure authentication of link -

{user.username},

+

+ +

-

- -
+

+ +

- -
- - - -

+ +

-

+

+ +

diff --git a/Resources/Private/Extensions/femanager/Templates/Email/CreateUserNotify.html b/Resources/Private/Extensions/femanager/Templates/Email/CreateUserNotify.html new file mode 100644 index 0000000..6599e4e --- /dev/null +++ b/Resources/Private/Extensions/femanager/Templates/Email/CreateUserNotify.html @@ -0,0 +1,17 @@ + + + Email / CreateUserNotify + + This mail will be send to the user, to inform him about his new profile. + It's always activated, even if the admin confirmation and/or the double-opt-in is activated. + + Available variables: + {user} User Object + + +

{user.username},

+ +

+ +

+
\ No newline at end of file diff --git a/Resources/Private/Extensions/femanager/Templates/Email/CreateUserNotifyAfterPwChange.html b/Resources/Private/Extensions/femanager/Templates/Email/CreateUserNotifyAfterPwChange.html new file mode 100644 index 0000000..bb2bb01 --- /dev/null +++ b/Resources/Private/Extensions/femanager/Templates/Email/CreateUserNotifyAfterPwChange.html @@ -0,0 +1,17 @@ + + +Email / CreateUserNotify + +This mail will be send to the user, to inform him about his new profile. +It's always activated, even if the admin confirmation and/or the double-opt-in is activated. + +Available variables: +{user} User Object + + +

{user.username},

+ +

+ +

+
diff --git a/Resources/Private/Extensions/femanager/Templates/Email/RequestKitodoAccess.html b/Resources/Private/Extensions/femanager/Templates/Email/RequestKitodoAccess.html new file mode 100644 index 0000000..6474a7d --- /dev/null +++ b/Resources/Private/Extensions/femanager/Templates/Email/RequestKitodoAccess.html @@ -0,0 +1,11 @@ + + + + + + + +

{message}

+
+ +
diff --git a/Resources/Private/Extensions/femanager/Templates/Email/RequestKitodoAccessUser.html b/Resources/Private/Extensions/femanager/Templates/Email/RequestKitodoAccessUser.html new file mode 100644 index 0000000..6474a7d --- /dev/null +++ b/Resources/Private/Extensions/femanager/Templates/Email/RequestKitodoAccessUser.html @@ -0,0 +1,11 @@ + + + + + + + +

{message}

+
+ +
diff --git a/Resources/Private/Extensions/femanager/Templates/Extend/Dialog.html b/Resources/Private/Extensions/femanager/Templates/Extend/Dialog.html new file mode 100644 index 0000000..e589868 --- /dev/null +++ b/Resources/Private/Extensions/femanager/Templates/Extend/Dialog.html @@ -0,0 +1,67 @@ + + +
+ +

+

+ +

+ +
+
+ +
+
+ +
+
+ + +
+ + + +
+ + +
+ +
+ + +

+ +

+ + + +
+ + diff --git a/Resources/Private/Extensions/femanager/Templates/Extend/Disable.html b/Resources/Private/Extensions/femanager/Templates/Extend/Disable.html index 5ff5a96..517fb29 100644 --- a/Resources/Private/Extensions/femanager/Templates/Extend/Disable.html +++ b/Resources/Private/Extensions/femanager/Templates/Extend/Disable.html @@ -1,4 +1,4 @@ -
+ @@ -31,4 +31,4 @@ -
+ diff --git a/Resources/Private/Extensions/femanager/Templates/TempUser/New/New.html b/Resources/Private/Extensions/femanager/Templates/TempUser/New/New.html new file mode 100644 index 0000000..db05303 --- /dev/null +++ b/Resources/Private/Extensions/femanager/Templates/TempUser/New/New.html @@ -0,0 +1,42 @@ +{namespace femanager=In2code\Femanager\ViewHelpers} + + + User / New + Available variables: + {user} + {allUserGroups} + + + + + + + +
+ + + + + + + + + + + + + + + +
+
diff --git a/Resources/Private/Extensions/slub_web_digas/Layouts/KitodoPage.html b/Resources/Private/Extensions/slub_web_digas/Layouts/KitodoPage.html old mode 100755 new mode 100644 index 91634aa..37d9867 --- a/Resources/Private/Extensions/slub_web_digas/Layouts/KitodoPage.html +++ b/Resources/Private/Extensions/slub_web_digas/Layouts/KitodoPage.html @@ -8,7 +8,7 @@ " /> -
+ - - + + + + + + + +
+ + + + +
+
@@ -27,10 +43,11 @@ redirect to pre-filled contact form if access is not granted --> - + + -
+ diff --git a/Resources/Private/Language/de.locallang.xlf b/Resources/Private/Language/de.locallang.xlf index 5eea686..2e15d7e 100644 --- a/Resources/Private/Language/de.locallang.xlf +++ b/Resources/Private/Language/de.locallang.xlf @@ -301,10 +301,18 @@ + + + + + + + + @@ -314,53 +322,29 @@ - - - - - - - - - - - - - - - - - - + + - - + + - - + + - - - - - - + + - - - - @@ -385,10 +369,330 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - \ No newline at end of file + diff --git a/Resources/Private/Language/de.locallang_db.xlf b/Resources/Private/Language/de.locallang_db.xlf index c6051c1..cab32ae 100644 --- a/Resources/Private/Language/de.locallang_db.xlf +++ b/Resources/Private/Language/de.locallang_db.xlf @@ -62,41 +62,21 @@ - - - - - - - - - - - - - - - - - - + + - - - - - - - - + + + + @@ -113,6 +93,89 @@ + + + + + + + + + + + + + + + + + + + + + + Kitodo FE user access + + + + Access start + + + + Access end + + + + Kitodo document uid + + + + Kitodo document record_id + + + + Dispatch date email for access granted + + + + Dispatch date email for expiration notification + + + + Rejected + + + + Rejected reason + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - \ No newline at end of file + diff --git a/Resources/Private/Language/locallang.xlf b/Resources/Private/Language/locallang.xlf index e1917e1..d792464 100644 --- a/Resources/Private/Language/locallang.xlf +++ b/Resources/Private/Language/locallang.xlf @@ -4,20 +4,23 @@
- No Answer + - - Female + Mrs - Male + Mr - - Diverse + + Name Street / Number + + new E-Mail-Address + I / we accept the terms of use (Germany - attribution - version 2.0) of the data offered on this website in the current version. @@ -34,25 +37,10 @@ Name of organization - Type of organization + Organizational unit Inactive Message Date - - - Company - - - University - - - Research institute - - - other - - - Kitodo FE user access Kitodo @@ -60,6 +48,24 @@ Usergroup + + Ordering party + + + Location of the area for which geological data are requested + + + Purpose of the visit + + + Ordering party + + + Location of the area for which geological data are requested + + + Purpose of the visit + Release request for catalog ID: @@ -288,6 +294,226 @@ Homepage + + Vielen Dank für Ihre Registrierung in DiGAS – dem Digitalen Geologischen Archiv Sachsens. + + + Bitte klicken Sie auf den nachfolgenden Link zur Aktivierung Ihres Benutzerkontos: + + + Beachten Sie bitte, dass der Link nur für 12 Stunden gültig ist. + + + Wenn Sie die Registrierung auf der Website nicht selbst vorgenommen haben, können Sie diese E-Mail ignorieren. + + + Registrierung abschließen + + + Purpose of use + + + Soll die Einsichtnahme und Nutzung der markierten Dokumente im Rahmen einer gewerblichen Tätigkeit erfolgen? + + + Hinweis: Ihre Antwort wird für die gesamte Sitzung verwendet. Wenn Sie für mehrereVorhaben recherchieren, müssen Sie jeweils eine neue Browser-Sitzung für DiGAS starten. + + + continue + + + yes + + + no + + + + Inform user about new access / rejected access + + + Message to user about new document access / rejection was queued + + + Create new document access for user "%s" + + + Create document access + + + Create document access + + + Manage access to documents + + + Access start date + + + Access end date + + + Access + + + Access granted + + + Access pending + + + Access expired + + + Access rejected + + + Document Identifier + + + Reason for rejection + + + Release has been denied before and has been requested again. + + + Grant release + + + Reject release + + + Adjust release + + + Delete release + + + Access for document "%s" was granted + + + Access for document "%s" was updated + + + Access for document "%s" was deleted + + + Start date must be today or in the future + + + Release end must be at least one day in the future + + + Please enter a document identifier + + + No document for given identifier was found + + + Document is already in users access list. It's either not accessible yet, the access is expired or the document already been made accessible + + + Are you sure to reject access to the document "%s"? + + + Access to documents were successfully requested + + + Error while access to documents requested + + + Identifier + + + Title + + + Actions + + + remove from basket + + + Status + + + Request basket + + + go back + + + Basket empty + + + continue + + + Submit your request and gain access to the listed documents + + + Please check the data you wish to request + + + Your message + + + Documents already requested for release + + + These documents cannot be requested again + + + [DiGAS FE Management] Access granted + + + The access to the requested documents were granted: + + + You can use this url to login: + + + The access to the requested documents were rejected: + + + The access to the requested documents were granted: + + + [DiGAS FE Management] Expiration Information + + + The access to the following documents will expire soon: + + + You can use this url to login: + + + [DiGAS FE Management] Access requested + + + [DiGAS FE Management] Access requested + + + District + + + Zipcode + + + City + + + Email + + + Salutation + + + Lastname + + + Country + diff --git a/Resources/Private/Language/locallang_db.xlf b/Resources/Private/Language/locallang_db.xlf index a72a23d..108084d 100644 --- a/Resources/Private/Language/locallang_db.xlf +++ b/Resources/Private/Language/locallang_db.xlf @@ -7,16 +7,13 @@ Hidden - No Answer + - - Female + Mrs - Male - - - Diverse + Mr Reference to old account after change of e-mail / username @@ -24,25 +21,13 @@ Name of organization - - Type of organization - - - Company - - - University - - - Research institute - - - other - + + Organizational unit + Inactive Message Date - + Kitodo FE user access @@ -54,9 +39,24 @@ Saved searches + + Temporary commercial user + + + Ordering party + + + Location of the area for which geological data are requested + + + Purpose of the visit + Locale + + Password changed after confirmation + Main Settings @@ -107,6 +107,54 @@ Search log + + + Kitodo FE user access + + + Access start + + + Access end + + + Kitodo document uid + + + Kitodo document record_id + + + District + + + Zipcode + + + City + + + Email + + + Salutation + + + Lastname + + + Dispatch date email for access granted + + + Dispatch date email for expiration notification + + + Rejected + + + Rejected reason + + + Inform user (flag for mailing queue) diff --git a/Resources/Private/Partials/Access/AccessItem.html b/Resources/Private/Partials/Access/AccessItem.html new file mode 100644 index 0000000..62c82af --- /dev/null +++ b/Resources/Private/Partials/Access/AccessItem.html @@ -0,0 +1,80 @@ +
+ +

+ + {access.recordId} + {access.dlfDocument.recordId} + +

+ + + {access.dlfDocument.title} + + + + + + + + +
+ +
+ + + {access.rejectedReason->f:format.nl2br()} + + + - + + +
+
+
+ + + + + +
+ +
+ {access.rejectedReason->f:format.nl2br()} +
+
+ +
+
+ + + + + + + + + + + +
+ +
+ + + + + + + + + + +
+
+
+ +
+ +
diff --git a/Resources/Private/Partials/Access/DateFields.html b/Resources/Private/Partials/Access/DateFields.html new file mode 100644 index 0000000..0d3984a --- /dev/null +++ b/Resources/Private/Partials/Access/DateFields.html @@ -0,0 +1,39 @@ +
+
+ + + + + + + + + +
+ + +
+ + + + + + + + + + + + +
+
diff --git a/Resources/Private/Partials/Administration/ListItems.html b/Resources/Private/Partials/Administration/ListItems.html index 9a742a9..581e8ff 100644 --- a/Resources/Private/Partials/Administration/ListItems.html +++ b/Resources/Private/Partials/Administration/ListItems.html @@ -20,11 +20,8 @@ {user.email} - - -
- {user.company} -
+ + {user.company} @@ -37,6 +34,17 @@ + + + {f:translate(key:'access.list.short')} + +   + + + + + + + + + + + + + + + + + + + + + + {document.recordId} + {document.title} + + + + + + + + + + + diff --git a/Resources/Private/Partials/Basket/TableOldRequests.html b/Resources/Private/Partials/Basket/TableOldRequests.html new file mode 100644 index 0000000..61b469d --- /dev/null +++ b/Resources/Private/Partials/Basket/TableOldRequests.html @@ -0,0 +1,40 @@ +

+ +

+ + + + + + + + + + + + + + + + + + + + + +
{document.recordId}{document.dlfDocument.title} + + + + Freigabe ausstehend + + + bereits freigegeben + + + + + + + +
diff --git a/Resources/Private/Templates/Access/List.html b/Resources/Private/Templates/Access/List.html new file mode 100644 index 0000000..55ab10b --- /dev/null +++ b/Resources/Private/Templates/Access/List.html @@ -0,0 +1,86 @@ +{namespace femanager=In2code\Femanager\ViewHelpers} + + + + + +

+ {user.firstName} {user.lastName} ({user.username}) +

+ + + + + + + + + + + + + + +

+ +

+ + + + + + + + +
--
+
+
+ +

+ +

+ + + + + + + + +
--
+
+
+ +

+ +

+ + + + + + + + +
--
+
+
+ + + +

+ +

+ + + + + + + + +
--
+
+
+ +
diff --git a/Resources/Private/Templates/Access/New.html b/Resources/Private/Templates/Access/New.html new file mode 100644 index 0000000..dfff7f6 --- /dev/null +++ b/Resources/Private/Templates/Access/New.html @@ -0,0 +1,37 @@ +{namespace femanager=In2code\Femanager\ViewHelpers} + + + + +

+ +

+ + + + + +
+
+ + +
+
+ + + +
+
+ + + +
+
+ + +
+ + +
diff --git a/Resources/Private/Templates/Access/RejectReason.html b/Resources/Private/Templates/Access/RejectReason.html new file mode 100644 index 0000000..458cc14 --- /dev/null +++ b/Resources/Private/Templates/Access/RejectReason.html @@ -0,0 +1,39 @@ +{namespace femanager=In2code\Femanager\ViewHelpers} + + + + +

+ +

+ +

+ + {access.recordId} + {access.dlfDocument.recordId} + +
{access.dlfDocument.title} +

+ + + + +
+ + +
+ +
+
+ + + +
+
+ +
+ + +
diff --git a/Resources/Private/Templates/Administration/EditUser.html b/Resources/Private/Templates/Administration/EditUser.html index 7045264..c135132 100644 --- a/Resources/Private/Templates/Administration/EditUser.html +++ b/Resources/Private/Templates/Administration/EditUser.html @@ -28,22 +28,26 @@ - - - - - + - + + + + + + + - + + + diff --git a/Resources/Private/Templates/Administration/Show.html b/Resources/Private/Templates/Administration/Show.html index f5612d7..dd6286f 100644 --- a/Resources/Private/Templates/Administration/Show.html +++ b/Resources/Private/Templates/Administration/Show.html @@ -49,7 +49,7 @@ diff --git a/Resources/Private/Templates/Basket/Index.html b/Resources/Private/Templates/Basket/Index.html new file mode 100644 index 0000000..e9d19ab --- /dev/null +++ b/Resources/Private/Templates/Basket/Index.html @@ -0,0 +1,45 @@ + + + + +
+ + + + + + +
+
1
+
2
+
3
+
+
+ + + + + +

+
+ + + + + + + +
+ + +
+ + + +
+
+
+
+ diff --git a/Resources/Private/Templates/Basket/Overview.html b/Resources/Private/Templates/Basket/Overview.html new file mode 100644 index 0000000..d183b73 --- /dev/null +++ b/Resources/Private/Templates/Basket/Overview.html @@ -0,0 +1,48 @@ + + + + +
+ + +
+
1
+
2
+
3
+
+ +

+ + + + + +
+ +

+
+ {request.message} +

+
+
+ +
+
+ + + +
+
+ + + +
+
+
+
+
+
+ diff --git a/Resources/Private/Templates/Email/Html/KitodoAccessExpirationNotification.html b/Resources/Private/Templates/Email/Html/KitodoAccessExpirationNotification.html new file mode 100644 index 0000000..8199a03 --- /dev/null +++ b/Resources/Private/Templates/Email/Html/KitodoAccessExpirationNotification.html @@ -0,0 +1,10 @@ + +
+

+ +

{expirationEntry.recordId} - {expirationEntry.documentTitle}

+
+

+

{f:uri.typolink(parameter:'{loginPid}')}

+
+ diff --git a/Resources/Private/Templates/Email/Html/KitodoAccessGrantedNotification.html b/Resources/Private/Templates/Email/Html/KitodoAccessGrantedNotification.html new file mode 100644 index 0000000..2a1a51b --- /dev/null +++ b/Resources/Private/Templates/Email/Html/KitodoAccessGrantedNotification.html @@ -0,0 +1,30 @@ + +
+

+
    + + +
  • {accessGrantedEntry.recordId} - {accessGrantedEntry.documentTitle}
  • +
    +
    +
+
+

+
    + + +
  • + {accessGrantedEntry.recordId} - {accessGrantedEntry.documentTitle} + +
    + {accessGrantedEntry.rejectedReason} +
    +
  • +
    +
    +
+
+

+

{f:uri.typolink(parameter:'{loginPid}')}

+
+ diff --git a/Resources/Private/Templates/Email/Text/KitodoAccessExpirationNotification.html b/Resources/Private/Templates/Email/Text/KitodoAccessExpirationNotification.html new file mode 100644 index 0000000..bcf49d9 --- /dev/null +++ b/Resources/Private/Templates/Email/Text/KitodoAccessExpirationNotification.html @@ -0,0 +1,11 @@ + + + + + +{expirationEntry.recordId} - {expirationEntry.documentTitle} + + + +{f:uri.typolink(parameter:'{loginPid}')} + diff --git a/Resources/Private/Templates/Email/Text/KitodoAccessGrantedNotification.html b/Resources/Private/Templates/Email/Text/KitodoAccessGrantedNotification.html new file mode 100644 index 0000000..293a592 --- /dev/null +++ b/Resources/Private/Templates/Email/Text/KitodoAccessGrantedNotification.html @@ -0,0 +1,16 @@ + + + + +- {accessGrantedEntry.recordId} - {accessGrantedEntry.documentTitle} + + +- {accessGrantedEntry.recordId} - {accessGrantedEntry.documentTitle} + * {accessGrantedEntry.rejectedReason} * + + + + + +{f:uri.typolink(parameter:'{loginPid}')} + diff --git a/Resources/Public/Css/dialog.css b/Resources/Public/Css/dialog.css new file mode 100644 index 0000000..c0c7d04 --- /dev/null +++ b/Resources/Public/Css/dialog.css @@ -0,0 +1,15 @@ +.digas-fe-management--dialog { + text-align: left; + margin: 4rem auto 0; + max-width: 768px; + width: auto; + min-height: auto; + background: #fff; + padding: 2rem; + box-sizing: border-box; + line-height: 1.6; +} + +.digas-fe-management--hidden { + display: none; +} diff --git a/Resources/Public/Css/digasBasket.css b/Resources/Public/Css/digasBasket.css new file mode 100644 index 0000000..902412b --- /dev/null +++ b/Resources/Public/Css/digasBasket.css @@ -0,0 +1,113 @@ +.tx-dlf-request { + display: none; +} + +.tx-dlf-request.tx-dlf-request--restricted { + display: inline-block; +} + +.tx-dlf-request span { + opacity: 1; + visibility: visible; + transition: all 0.3s ease-in-out; +} + +.tx-dlf-request .tx-dlf-request--add-basket { + opacity: 1; + visibility: visible; +} + +.tx-dlf-request .tx-dlf-request--remove-basket { + opacity: 0; + visibility: hidden; +} + +.tx-dlf-request--in-basket .tx-dlf-request--add-basket { + opacity: 0; + visibility: hidden; +} + +.tx-dlf-request--in-basket .tx-dlf-request--remove-basket { + opacity: 1; + visibility: visible; +} + +.fe-management-basket-entries--old { + background: #fff8c4; + margin-bottom: 1.5rem; +} + +.fe-management-basket--steps { + display: flex; + justify-content: space-between; + margin: 1rem 0; +} + +.fe-management-basket--step { + flex-grow: 1; + display: flex; + position: relative; + justify-content: right; +} + +.fe-management-basket--step:first-child { + flex-grow: 0; +} + +.fe-management-basket--step span { + box-sizing: border-box; + background: #a6a6a6; + width: 3rem; + height: 3rem; + border-radius: 50%; + display: flex; + justify-content: center; + align-items: center; + font-size: 1.5rem; + font-weight: bold; + color: #fff; +} + +.fe-management-basket--step.active span { + background-color: #429942; +} + +.fe-management-basket--step:before { + content: ''; + position: absolute; + width: 100%; + border-top: 4px solid #a6a6a6; + top: 50%; + left: 0; + z-index: -1; +} + +.fe-management-basket--step.active:before { + border-color: #429942; +} + +.fe-management-basket--step:first-child:before { + display: none; +} + +.fe-management-basket--message { + background: #f0f0f0; + padding: 1rem; +} + +.basket-link { + position: absolute; + top: 0; + right: 150px; + height: 30px; + text-shadow: none; + background-color: transparent; + border: 0; + display: flex; + align-items: center; + text-decoration: none; +} + +.basket-link .basket-link-counter { + margin-left: 5px; +} diff --git a/Resources/Public/Icons/tx_digasfemanagement_domain_model_access.gif b/Resources/Public/Icons/tx_digasfemanagement_domain_model_access.gif new file mode 100644 index 0000000000000000000000000000000000000000..6cc5f16355d84652db5ce39fcbc7256b7ea457cd GIT binary patch literal 533 zcmZ?wbhEHb6krfwc;>^PT&ti`uNc2IM6Fr5d*_GlT^}Mg`l>Z4?cBL@{mqr@Zmft{ z7wEdsHlXM1p|kH6En2i~+qT*bFHc_i5WY6x!0ESfTY`5SewDjFA!B!R!NKH=-7#5v z<8pIzr=96jYgDqIV-eVU&ToZld3pKFnKKjS+;FNpvSrJblpPUfQw-u~UN@U;5Wc}@ z$BrEa{W=>rZk&4HOZ}!-d-m*!-W0Ir`qGWJ*7TfcZfa@@UE^PKph&A-&32ZV$71`A zWAz0q9tEs&-?wjHUteGDl80Iy>iRueDs>7`>w{xsV{`V!C+`Sfvt~_7N=o9k(EtDc zGYnRs_>+Z^fx(AC2joCdoG`E#HTX0&x3sqT=(8Hwwzskf@u~E-2#Sa)Om246yZMom0cTFy<3E({D?-?uh0SOWmDq@H{L literal 0 HcmV?d00001 diff --git a/Resources/Public/Js/Classes/DigasBasket.js b/Resources/Public/Js/Classes/DigasBasket.js new file mode 100644 index 0000000..77ddb58 --- /dev/null +++ b/Resources/Public/Js/Classes/DigasBasket.js @@ -0,0 +1,157 @@ +class DigasBasket { + constructor() { + this.options = { + basketLinkCls: 'tx-dlf-request', + basketLinkActiveCls: 'tx-dlf-request--restricted', + basketIdExistsCls: 'tx-dlf-request--in-basket', + basketEntryCls: 'fe-management-basket-entry', + basketRemoveLinkCls: 'fe-management-basket-remove-link', + basketOverviewCls: 'fe-management-basket', + basketMapCls: 'digas-view-map', + basketListingCls: 'tx-dlf-listview', + listIdentifierCls: 'dlf-identifier', + listRestrictionCLs: 'dlf-restriction', + basketLinkCountCls: 'basket-link-counter', + restrictionContext: { + de: 'ja', + en: 'yes' + }, + cookieName: 'dlf-requests' + } + this.basketIds = this.getBasketIdsFromCookie(); + this.htmlLang = document.documentElement.lang; + this.restrictionString = null; + this.basketEntriesCount = 0; + + // initialize basket link count + this.basketLinkCounter = document.querySelector(`.${this.options.basketLinkCountCls}`); + this.updateBasketCount(this.basketIds.length); + + // initialize basket overview + if (typeof document.querySelector(`.${this.options.basketOverviewCls}`) !== 'undefined') { + this.initializeBasketOverview(); + } + + // initialize listing view / map view + if ( + typeof document.querySelector(`.${this.options.basketMapCls}`) !== 'undefined' || + typeof document.querySelector(`.${this.options.basketListingCls}`) !== 'undefined' + ) { + this.getRestrictionString(); + this.initializeListing(); + } + } + + updateBasketCount(basketCount) { + if (basketCount > 0) { + this.basketLinkCounter.textContent = '(' + basketCount.toString() + ')'; + } else { + this.basketLinkCounter.textContent = ''; + } + } + + initializeBasketOverview() { + this.basketEntries = document.querySelectorAll(`.${this.options.basketEntryCls}`); + + if (this.basketEntries !== null) { + this.basketEntriesCount = this.basketEntries.length; + this.basketEntries.forEach((basketEntry) => { + const basketRemoveLink = basketEntry.querySelector(`.${this.options.basketRemoveLinkCls}`); + + if (typeof basketRemoveLink !== 'undefined') { + if (typeof basketRemoveLink.dataset.id !== 'undefined') { + basketRemoveLink.addEventListener('click', (event) => { + this.onBasketLinkRemoveClick(event, basketRemoveLink, basketEntry); + }); + } + } + }); + } + } + + initializeListing() { + this.basketLinks = document.querySelectorAll(`.${this.options.basketLinkCls}`); + + if (this.basketLinks !== null) { + this.basketLinks.forEach((basketLink) => { + const listEntry = basketLink.parentNode; + + const entryIdentifier = listEntry.querySelector(`.${this.options.listIdentifierCls}`); + const entryRestriction = listEntry.querySelector(`.${this.options.listRestrictionCLs}`); + + if (entryRestriction !== null) { + if (entryRestriction.textContent !== this.restrictionString) { + return; + } + } + basketLink.classList.add(this.options.basketLinkActiveCls); + + if (entryIdentifier !== null && typeof entryIdentifier.dataset.id !== 'undefined') { + if (this.basketIds.includes(entryIdentifier.dataset.id)) { + basketLink.classList.add(this.options.basketIdExistsCls); + } + basketLink.addEventListener('click', (event) => { + this.onBasketLinkClick(event, basketLink, entryIdentifier.dataset.id); + }); + } + }); + } + } + + getRestrictionString() { + if (typeof this.options.restrictionContext[this.htmlLang] !== 'undefined') { + this.restrictionString = this.options.restrictionContext[this.htmlLang]; + } + } + + getBasketIdsFromCookie() { + const basketCookie = Cookies.get(this.options.cookieName); + + if (typeof basketCookie === 'undefined') { + return []; + } + return JSON.parse(basketCookie); + } + + updateBasketCookie(dlfId) { + let basketIds = this.getBasketIdsFromCookie(); + + if (basketIds.includes(dlfId)) { + basketIds = basketIds.filter(id => id !== dlfId); + } else { + basketIds = [...basketIds, dlfId]; + } + + Cookies.set(this.options.cookieName, JSON.stringify(basketIds)); + this.updateBasketCount(basketIds.length); + } + + onBasketLinkClick(event, basketLink, identifier) { + event.preventDefault(); + event.stopPropagation(); + + if (typeof identifier !== 'undefined') { + this.updateBasketCookie(identifier); + basketLink.classList.toggle(this.options.basketIdExistsCls); + } + } + + onBasketLinkRemoveClick(event, basketRemoveLink, basketEntry) { + event.preventDefault(); + event.stopPropagation(); + + // @todo translations + if (confirm('Wollen Sie diesen Datensatz wirklich aus dem Warenkorb entfernen?')) { + this.updateBasketCookie(basketRemoveLink.dataset.id); + basketEntry.remove(); + this.basketEntriesCount--; + + // reload page if last document was deleted to remove request form + if (this.basketEntriesCount < 1) { + location.reload(); + } + } + } +} + +new DigasBasket(); diff --git a/ext_icon.png b/ext_icon.png old mode 100755 new mode 100644 diff --git a/ext_localconf.php b/ext_localconf.php index b837ed2..7fca3f6 100644 --- a/ext_localconf.php +++ b/ext_localconf.php @@ -23,13 +23,13 @@ * This copyright notice MUST APPEAR in all copies of the script! ***************************************************************/ - defined('TYPO3_MODE') || die('Access denied.'); +defined('TYPO3_MODE') || die('Access denied.'); //xclass for PHP error thrown because of extended user model $GLOBALS['TYPO3_CONF_VARS']['SYS']['Objects']['TYPO3\\CMS\\Extbase\\Mvc\\Controller\\Argument'] = ['className' => 'Slub\\DigasFeManagement\\Xclass\\Extbase\\Mvc\\Controller\\Argument']; //override femanager extension settings -$GLOBALS['TYPO3_CONF_VARS']['EXTENSIONS']['femanager']['setCookieOnLogin'] = 1; +$GLOBALS['TYPO3_CONF_VARS']['EXTENSIONS']['femanager']['setCookieOnLogin'] = '1'; //load additional pageTSconfig \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPageTSConfig( @@ -47,10 +47,10 @@ 'Slub.DigasFeManagement', 'Femanagerextended', [ - 'Extend' => 'disable' + 'Extend' => 'disable,dialog' ], [ - 'Extend' => 'disable' + 'Extend' => 'disable,dialog' ] ); @@ -66,6 +66,18 @@ ] ); +//plugin DigasFeManagement Administration - Access Kitodo Documents +\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin( + 'Slub.DigasFeManagement', + 'Access', + [ + 'Access' => 'list,approve,rejectReason,reject,new,create,informUser' + ], + [ + 'Access' => 'list,approve,rejectReason,reject,new,create,informUser' + ] +); + //plugin DigasFeManagement Statistic \TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin( 'Slub.DigasFeManagement', @@ -90,6 +102,18 @@ ] ); +//plugin request kitodo documents from basket +\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin( + 'Slub.DigasFeManagement', + 'Basket', + [ + 'Basket' => 'index,request,overview' + ], + [ + 'Basket' => 'index,request,overview' + ] +); + //fe_login hooks $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['felogin']['login_confirmed'] = [ 'Slub\DigasFeManagement\Hooks\FeUserHook->unsetInactiveMessageTstamp' @@ -98,3 +122,12 @@ $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['felogin']['postProcContent'] = [ 'Slub\DigasFeManagement\Hooks\FeUserHook->checkChangedUsername' ]; + +//fe_change_pwd signal +$signalSlotDispatcher = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\SignalSlot\Dispatcher::class); +$signalSlotDispatcher->connect( + \Derhansen\FeChangePwd\Controller\PasswordController::class, + 'updateActionAfterUpdatePassword', + \Slub\DigasFeManagement\Slots\AfterPasswordChange::class, + 'createUserNotifyMail' +); diff --git a/ext_tables.sql b/ext_tables.sql index 0eaa8be..11e09e6 100644 --- a/ext_tables.sql +++ b/ext_tables.sql @@ -3,11 +3,16 @@ # CREATE TABLE fe_users ( inactivemessage_tstamp int(11) unsigned DEFAULT NULL, - company_type int(11) unsigned DEFAULT '0' NOT NULL, + company_type varchar(255) DEFAULT '' NOT NULL, old_account int(11) unsigned DEFAULT '0' NOT NULL, - kitodo_feuser_access text, saved_searches int(11) unsigned DEFAULT '0' NOT NULL, + kitodo_document_access int(11) unsigned DEFAULT '0' NOT NULL, locale int(10) DEFAULT '0' NOT NULL, + pw_changed_on_confirmation smallint(6) DEFAULT '0' NOT NULL, + temp_user_ordering_party varchar(255) DEFAULT '' NOT NULL, + temp_user_area_location text, + temp_user_purpose text, + district varchar(255) DEFAULT '' NOT NULL, ); # @@ -36,3 +41,14 @@ CREATE TABLE tx_digasfemanagement_domain_model_statistic ( KEY document (document), KEY fe_user (fe_user) ); + +CREATE TABLE tx_digasfemanagement_domain_model_access ( + dlf_document int(11) DEFAULT '0' NOT NULL, + record_id varchar(255) DEFAULT '' NOT NULL, + fe_user int(11) unsigned DEFAULT '0' NOT NULL, + access_granted_notification int(11) DEFAULT '0' NOT NULL, + expire_notification int(11) DEFAULT '0' NOT NULL, + rejected smallint(6) DEFAULT '0' NOT NULL, + rejected_reason text, + inform_user smallint(6) DEFAULT '0' NOT NULL, +);