public static function registerApplication() { Token::registerModule(); Account::registerModule(); Main::getDisplay()->addApplicationNavigation(new Link(new Link\Route(__NAMESPACE__), new Link\Name('Benutzerverwaltung'), new Link\Icon(new Person()))); Main::getDispatcher()->registerRoute(Main::getDispatcher()->createRoute(__NAMESPACE__, 'Authorization::frontendDashboard')); }
/** * @param int $Id * @param bool $Confirm * * @return Stage */ public function frontendDestroyAccount($Id, $Confirm = false) { $Stage = new Stage('Benutzerkonto', 'Löschen'); if ($Id) { $tblAccount = Account::useService()->getAccountById($Id); if (!$Confirm) { $Content = array($tblAccount->getUsername(), ($tblAccount->getServiceTblIdentification() ? new Lock() . ' ' . $tblAccount->getServiceTblIdentification()->getDescription() : '') . ($tblAccount->getServiceTblToken() ? ' ' . new Key() . ' ' . $tblAccount->getServiceTblToken()->getSerial() : '')); $tblPersonAll = Account::useService()->getPersonAllByAccount($tblAccount); if ($tblPersonAll) { array_walk($tblPersonAll, function (TblPerson &$tblPerson) { $tblPerson = new Person() . ' ' . $tblPerson->getFullName(); }); $Content = array_merge($Content, $tblPersonAll); } $tblAuthorizationAll = Account::useService()->getAuthorizationAllByAccount($tblAccount); if ($tblAuthorizationAll) { array_walk($tblAuthorizationAll, function (TblAuthorization &$tblAuthorization) { $tblAuthorization = new Nameplate() . ' ' . $tblAuthorization->getServiceTblRole()->getName(); }); $Content = array_merge($Content, $tblAuthorizationAll); } $Stage->setContent(new Layout(new LayoutGroup(new LayoutRow(new LayoutColumn(array(new Panel(new PersonKey() . ' Benutzerkonto', $Content, Panel::PANEL_TYPE_SUCCESS), new Panel(new Question() . ' Dieses Benutzerkonto wirklich löschen?', array(), Panel::PANEL_TYPE_DANGER, new Standard('Ja', '/Setting/Authorization/Account/Destroy', new Ok(), array('Id' => $Id, 'Confirm' => true)) . new Standard('Nein', '/Setting/Authorization/Account', new Disable())))))))); } else { // Remove Session $tblSessionAll = Account::useService()->getSessionAllByAccount($tblAccount); if (!empty($tblSessionAll)) { /** @var TblSession $tblSession */ foreach ($tblSessionAll as $tblSession) { Account::useService()->destroySession(null, $tblSession->getSession()); } } // Remove User $tblPersonAll = Account::useService()->getPersonAllByAccount($tblAccount); if (!empty($tblPersonAll)) { /** @var TblPerson $tblPerson */ foreach ($tblPersonAll as $tblPerson) { Account::useService()->removeAccountPerson($tblAccount, $tblPerson); } } // Remove Authentication $tblAuthentication = Account::useService()->getAuthenticationByAccount($tblAccount); if (!empty($tblAuthentication)) { Account::useService()->removeAccountAuthentication($tblAccount, $tblAuthentication->getTblIdentification()); } // Remove Authorization $tblAuthorizationAll = Account::useService()->getAuthorizationAllByAccount($tblAccount); if (!empty($tblAuthorizationAll)) { /** @var TblAuthorization $tblAuthorization */ foreach ($tblAuthorizationAll as $tblAuthorization) { Account::useService()->removeAccountAuthorization($tblAccount, $tblAuthorization->getServiceTblRole()); } } $Stage->setContent(new Layout(new LayoutGroup(array(new LayoutRow(new LayoutColumn(array(Account::useService()->destroyAccount($tblAccount) ? new Success('Das Benutzerkonto wurde gelöscht') : new Danger('Das Benutzerkonto konnte nicht gelöscht werden'), new Redirect('/Setting/Authorization/Account', 1)))))))); } } else { $Stage->setContent(new Layout(new LayoutGroup(array(new LayoutRow(new LayoutColumn(array(new Danger('Das Benutzerkonto konnte nicht gefunden werden'), new Redirect('/Setting/Authorization/Account')))))))); } return $Stage; }