public function execute(Request $request, Response $response)
 {
     $sessionRegistry = SessionRegistry::getInstance();
     $registry = Registry::getInstance();
     $view = new TemplateView('changeSchool');
     // Template-Variablen Werte zuweisen.
     $view->assign('accessLevel', $sessionRegistry->get('accessLevel'));
     $view->assign('districtList', $registry->get('ldapAccess')->getDistricts());
     if ($request->issetParameter('districtSelect')) {
         $view->assign('districtSelect', $request->getParameter('districtSelect'));
     }
     // Benutzeraktion: Kreis gewählt.
     if ($request->issetParameter('changeDistrict')) {
         $view->assign('schoolList', $registry->get('ldapAccess')->getSchools($request->getParameter('districtSelect')));
     }
     // Benutzeraktion: Schule gewechselt.
     if ($request->issetParameter('changeSchool')) {
         $sessionRegistry->set('school', 'ou=' . $request->getParameter('schoolSelect'));
         $sessionRegistry->set('district', 'ou=' . $request->getParameter('districtSelect'));
         $view->assign('schoolList', $registry->get('ldapAccess')->getSchools($request->getParameter('districtSelect')));
         $view->assign('schoolSelect', str_replace('ou=', '', $sessionRegistry->get('school')));
     }
     // Ausgabe erzeugen.
     $view->render($request, $response);
 }
 public function execute(Request $request, Response $response)
 {
     $view = new TemplateView('lookUp');
     $sessionRegistry = SessionRegistry::getInstance();
     $registry = Registry::getInstance();
     $view->assign('accessLevel', $sessionRegistry->get('accessLevel'));
     $view->assign('groupList', $registry->get('ldapAccess')->getGroupsDN());
     // Benutzeraktion:
     if ($request->issetParameter('lookUp')) {
         $groupname = $request->getParameter('directSelect');
         $groupDN = $registry->get('ldapAccess')->getGroupDN_2($groupname);
         $user = $sessionRegistry->get('uid');
         $userPW = $sessionRegistry->get('userPW');
         // sTeam
         $steamConnector = new steam_connector('localhost', 1900, 'root', 'h6518_W#');
         if (!$steamConnector->get_login_status()) {
             $view->assign('status', 'warning');
             $view->assign('statusMsg', 'Verbindung zum sTeam-Server konnte nicht erstellt werden!');
         } else {
             $ldapModule = $steamConnector->get_server_module('persistence:ldap');
             $steam_groupname = $steamConnector->predefined_command($ldapModule, 'dn_to_group_name', $groupDN, 0);
             $steamGroup = steam_factory::get_group($steamConnector, $steam_groupname, 0);
             $steamGroup->get_members(0);
             // Rückmeldung
             $view->assign('status', 'ok');
             $view->assign('statusMsg', 'LookUp wurde durchgeführt!');
         }
     }
     // Ausgabe erzeugen.
     $view->render($request, $response);
 }
Пример #3
0
 public function handleRequest()
 {
     $registry = SessionRegistry::getInstance();
     $cmdHnd = CommandHandler::getInstance();
     $cmd = $cmdHnd->getCommand($registry);
     $cmd->execute($registry, View::getInstance($registry));
 }
 public static function getInstance()
 {
     if (self::$instance === null) {
         self::$instance = new SessionRegistry();
     }
     return self::$instance;
 }
 public function execute(Request $request, Response $response)
 {
     $sessionRegistry = SessionRegistry::getInstance();
     $registry = Registry::getInstance();
     $view = new TemplateView('showUserdata');
     // Variablen der Template-Dateien Werte zuordnen.
     $view->assign('accessLevel', $sessionRegistry->get('accessLevel'));
     $view->assign('groupList', $registry->get('ldapAccess')->getGroupsDN());
     // Suche nach Benutzernamen starten.
     if ($request->issetParameter('userSearch')) {
         if ($request->issetParameter('namefilter') and $request->issetParameter('namefilter') != '') {
             $sessionRegistry->set('activeNamefilter', $request->getParameter('namefilter'));
         } else {
             $sessionRegistry->set('activeNamefilter', '*');
         }
         $sessionRegistry->set('activeGroup', $request->getParameter('groupSelect'));
     }
     if ($sessionRegistry->get('activeGroup') != null) {
         $view->assign('namefilter', $sessionRegistry->get('activeNamefilter'));
         $view->assign('groupSelect', $sessionRegistry->get('activeGroup'));
         $view->assign('results', $registry->get('ldapAccess')->search($sessionRegistry->get('activeNamefilter'), $sessionRegistry->get('activeGroup')));
     }
     if ($request->issetParameter('userSelect')) {
         $view->assign('userSelect', $request->getParameter('userSelect'));
         $view->assign('userdata', $registry->get('ldapAccess')->getUserInformation($request->getParameter('userSelect')));
     }
     // Ausgabe erzeugen.
     $view->render($request, $response);
 }
Пример #6
0
 public static function instance()
 {
     if (!isset(self::$instance)) {
         self::$instance = new self();
     }
     return self::$instance;
 }
 public function execute(Request $request, Response $response)
 {
     $view = new TemplateView('createDistrict');
     $sessionRegistry = SessionRegistry::getInstance();
     $registry = Registry::getInstance();
     $view->assign('accessLevel', $sessionRegistry->get('accessLevel'));
     // Benutzeraktion: neuen Kreis anlegen.
     if ($request->issetParameter('create')) {
         // Eingabedaten auf Korrektheit prüfen
         $datacorrectness = true;
         if (!$request->issetParameter('districtName') or $request->getParameter('districtName') == '') {
             $datacorrectness = false;
             $view->assign('status', 'warning');
             $view->assign('statusMsg', 'Bitte geben Sie einen Namen für den Kreis an!');
         }
         if ($datacorrectness) {
             $status = $registry->get('ldapAccess')->createDistrict($request->getParameter('districtName'));
             if ($status != false) {
                 $view->assign('status', 'ok');
                 $view->assign('statusMsg', 'Der Kreis wurde korrekt angelegt!');
             } else {
                 $view->assign('status', 'warning');
                 $view->assign('statusMsg', 'Es ist ein Fehler aufgetreten!');
             }
         }
     }
     // Ausgabe erzeugen.
     $view->render($request, $response);
 }
 public function execute(Request $request, Response $response)
 {
     $sessionRegistry = SessionRegistry::getInstance();
     $view = new TemplateView('index');
     $view->assign('message', 'Diese Funktionalität steht Ihnen nicht zur Verfügung!');
     $view->assign('accessLevel', $sessionRegistry->get('accessLevel'));
     $view->render($request, $response);
 }
 public function execute(Request $request, Response $response)
 {
     $sessionRegistry = SessionRegistry::getInstance();
     $registry = Registry::getInstance();
     $view = new TemplateView('deleteUser');
     // Template-Variablen Werte zuordnen.
     $view->assign('accessLevel', $sessionRegistry->get('accessLevel'));
     $view->assign('groupList', $registry->get('ldapAccess')->getGroupsDN());
     // Benutzeraktion: Benutzer löschen.
     if ($request->issetParameter('delete')) {
         $unmovedUser = array();
         for ($i = 1; $i <= $sessionRegistry->get('maxParameterIndex'); $i++) {
             if ($request->issetParameter('name' . $i)) {
                 $done = $registry->get('ldapAccess')->moveUser($request->getParameter('name' . $i), 'TRASH');
                 if ($done == false) {
                     $unmovedUser[] = $request->getParameter('name' . $i);
                 }
             }
         }
         if (count($unmovedUser) == 0) {
             $view->assign('status', 'ok');
             $view->assign('statusMsg', 'Alle markierten Benutzer wurden in den Papierkorb verschoben!');
         } else {
             $statusMsg = 'Folgende Benutzer konnten nicht gel&ouml;scht werden:<ul>';
             foreach ($unmovedUser as $uid) {
                 $statusMsg .= '<li>' . $uid;
             }
             $statusMsg .= '</ul>Die &uuml;brigen wurden in den Papierkorb verschoben.';
             $view->assign('status', 'warning');
             $view->assign('statusMsg', $statusMsg);
         }
     }
     // Benutzeraktion: Nach Benutzernamen suchen.
     if ($request->issetParameter('userSearch')) {
         if ($request->issetParameter('namefilter') and $request->issetParameter('namefilter') != '') {
             $sessionRegistry->set('activeNamefilter', $request->getParameter('namefilter'));
         } else {
             $sessionRegistry->set('activeNamefilter', '*');
         }
         $sessionRegistry->set('activeGroup', $request->getParameter('groupSelect'));
     }
     if ($sessionRegistry->get('activeGroup') != null) {
         $view->assign('namefilter', $sessionRegistry->get('activeNamefilter'));
         $view->assign('groupSelect', $sessionRegistry->get('activeGroup'));
         $results = $registry->get('ldapAccess')->search($sessionRegistry->get('activeNamefilter'), $sessionRegistry->get('activeGroup'));
         $sessionRegistry->set('maxParameterIndex', count($results));
         $view->assign('results', $results);
     }
     // Ausgabe erzeugen.
     $view->render($request, $response);
 }
 public function execute(Request $request, Response $response)
 {
     $sessionRegistry = SessionRegistry::getInstance();
     $registry = Registry::getInstance();
     $view = new TemplateView('undelete');
     $view->assign('accessLevel', $sessionRegistry->get('accessLevel'));
     // Benutzeraktion: Benutzer wiederherstellen
     if ($request->issetParameter('undeleteUser')) {
         $unmovedUser = array();
         for ($i = 1; $i <= $sessionRegistry->get('maxParameterIndex'); $i++) {
             if ($request->issetParameter('name' . $i)) {
                 $done = $registry->get('ldapAccess')->moveUser($request->getParameter('name' . $i), 'student');
                 if ($done == false) {
                     $unmovedUser[] = $request->getParameter('name' . $i);
                 }
             }
         }
         if (count($unmovedUser) == 0) {
             $view->assign('status', 'ok');
             $view->assign('statusMsg', 'Alle markierten Benutzer wurden wiederhergestellt!');
         } else {
             $statusMsg = 'Die folgenden Benutzer konnten nicht wiederhergestellt werden:<ul>';
             foreach ($unmovedUser as $uid) {
                 $statusMsg .= '<li>' . $uid;
             }
             $statusMsg .= '</ul>Die �brigen Benutzer wurden erfolgreich wiederhergestellt.';
             $view->assign('status', 'warning');
             $view->assign('statusMsg', $statusMsg);
         }
         unset($unmovedUser);
     }
     // Benutzeraktion: Nach Benutzernamen suchen.
     if ($request->issetParameter('userSearch')) {
         if ($request->issetParameter('namefilter') and $request->issetParameter('namefilter') != '') {
             $sessionRegistry->set('activeNamefilter', $request->getParameter('namefilter'));
         } else {
             $sessionRegistry->set('activeNamefilter', '*');
         }
         $sessionRegistry->set('activeGroup', $request->getParameter('timespan'));
     }
     if ($sessionRegistry->get('activeGroup') != null) {
         $view->assign('namefilter', $sessionRegistry->get('activeNamefilter'));
         $view->assign('timespan', $sessionRegistry->get('activeGroup'));
         $results = $registry->get('ldapAccess')->search($sessionRegistry->get('activeNamefilter'), 'TRASH', false, $request->getParameter('timespan'));
         $sessionRegistry->set('maxParameterIndex', count($results));
         $view->assign('results', $results);
     }
     // Ausgabe erzeugen.
     $view->render($request, $response);
 }
 public function execute(Request $request, Response $response)
 {
     $sessionRegistry = SessionRegistry::getInstance();
     $registry = Registry::getInstance();
     $view = new TemplateView('moveToPool');
     // Tempalte-Variablen Werten zuweisen.
     $view->assign('accessLevel', $sessionRegistry->get('accessLevel'));
     $view->assign('groupList', $registry->get('ldapAccess')->getGroupsDN());
     // Benutzeraktion: Benutzer in Pool verschieben.
     if ($request->issetParameter('moveUser')) {
         $unmovedUser = array();
         for ($i = 1; $i <= $sessionRegistry->get('maxParameterIndex'); $i++) {
             if ($request->issetParameter('name' . $i)) {
                 $registry->get('ldapAccess')->replaceUserData($request->getParameter('name' . $i), 'description', str_replace('ou=', '', $sessionRegistry->get('school')));
                 $registry->get('ldapAccess')->unsetUserData($request->getParameter('name' . $i), 'membership', array());
                 $done = $registry->get('ldapAccess')->moveUser($request->getParameter('name' . $i), 'POOL');
                 if ($done == false) {
                     $unmovedUser[] = $request->getParameter('name' . $i);
                 }
             }
         }
         if (count($unmovedUser) === 0) {
             $view->assign('status', 'ok');
             $view->assign('statusMsg', 'Alle markierten Benutzer wurden in den Pool verschoben!');
         } else {
             $statusMsg = 'Die folgenden Benutzer konnten nicht verschoben werden:<ul>';
             foreach ($unmovedUser as $uid) {
                 $statusMsg .= '<li>' . $uid;
             }
             $statusMsg .= '</ul>Die &uuml;brigen Benutzer wurden erfolgreich verschoben.';
             $view->assign('status', 'warning');
             $view->assign('statusMsg', $statusMsg);
         }
         unset($unmovedUser);
     }
     // Benutzeraktion: Suche nach Benutzernamen starten.
     if ($request->issetParameter('userSearch')) {
         $sessionRegistry->set('activeNamefilter', $request->getParameter('namefilter'));
         $sessionRegistry->set('activeGroup', $request->getParameter('groupSelect'));
     }
     if ($sessionRegistry->get('activeGroup') != null) {
         $view->assign('namefilter', $sessionRegistry->get('activeNamefilter'));
         $view->assign('groupSelect', $sessionRegistry->get('activeGroup'));
         $results = $registry->get('ldapAccess')->search($sessionRegistry->get('activeNamefilter'), $sessionRegistry->get('activeGroup'));
         $sessionRegistry->set('maxParameterIndex', count($results));
         $view->assign('results', $results);
     }
     // Ausgabe erzeugen.
     $view->render($request, $response);
 }
 public function execute(Request $request, Response $response)
 {
     $sessionRegistry = SessionRegistry::getInstance();
     $registry = Registry::getInstance();
     $view = new TemplateView('getFromPool');
     // Template-Variablen Werte zurordnen.
     $view->assign('accessLevel', $sessionRegistry->get('accessLevel'));
     $view->assign('groupList', $registry->get('ldapAccess')->getOldSchools());
     // Benutzeraktion: Benutzer aus dem Pool holen.
     if ($request->issetParameter('getUser')) {
         $unmovedUser = array();
         for ($i = 1; $i <= $sessionRegistry->get('maxParameterIndex'); $i++) {
             $done = $registry->get('ldapAccess')->moveUser($request->getParameter('name' . $i), $request->getParameter('roleSelect'));
             if ($done == false) {
                 $unmovedUser[] = $request->getParameter('name' . $i);
             }
         }
         if (count($unmovedUser) == 0) {
             $view->assign('status', 'ok');
             $view->assign('statusMsg', 'Alle markierten Benutzer wurden der eigenen Schule hinzugef&uuml;gt!');
         } else {
             $statusMsg = 'Die folgenden Benutzer konnten nicht der eigenen Schule hinzugef&uuml;gt werden:<ul>';
             foreach ($unmovedUser as $uid) {
                 $statusMsg .= '<li>' . $uid;
             }
             $statusMsg .= '</ul>Die &uuml;brigen Benutzer wurden erfolgreich der eigenen Schule hinzugef&uuml;gt.';
             $view->assign('status', 'warning');
             $view->assign('statusMsg', $statusMsg);
         }
         unset($unmovedUser);
     }
     // Benutzeraktion: Suche nach Benutzernamen starten.
     if ($request->issetParameter('userSearch')) {
         if ($request->issetParameter('namefilter') and $request->issetParameter('namefilter') != '') {
             $sessionRegistry->set('activeNamefilter', $request->getParameter('namefilter'));
         } else {
             $sessionRegistry->set('activeNamefilter', '*');
         }
         $sessionRegistry->set('activeGroup', $request->getParameter('schoolSelect'));
     }
     if ($sessionRegistry->get('activeGroup') != null) {
         $view->assign('namefilter', $sessionRegistry->get('activeNamefilter'));
         $view->assign('schoolSelect', $sessionRegistry->get('activeGroup'));
         $results = $registry->get('ldapAccess')->search($sessionRegistry->get('activeNamefilter'), 'POOL', $sessionRegistry->get('activeGroup'));
         $sessionRegistry->set('maxParameterIndex', count($results));
         $view->assign('results', $results);
     }
     // Ausgabe erzeugen.
     $view->render($request, $response);
 }
 public function execute(Request $request, Response $response)
 {
     $sessionRegistry = SessionRegistry::getInstance();
     $registry = Registry::getInstance();
     $view = new TemplateView('deleteGroup');
     // Benutzeraktion: Gruppe löschen
     if ($request->issetParameter('deleteGroup') and $request->getParameter('deleteGroup') == 'true') {
         $view->assign('groupSelect', $request->getParameter('groupSelect'));
         if ($request->issetParameter('acknowledgeResponse') and $sessionRegistry->get('activeGroup') == $request->getParameter('groupSelect')) {
             if ($registry->get('ldapAccess')->hasSubgroups($request->getParameter('groupSelect')) == true) {
                 $done = $registry->get('ldapAccess')->removeGroup($request->getParameter('groupSelect'), true);
                 if ($done) {
                     $view->assign('status', 'ok');
                     $view->assign('statusMsg', 'Die Gruppe und s&auml;mtliche ihrer Untergruppen wurden gel&ouml;scht!');
                 } else {
                     $view->assign('status', 'warning');
                     $view->assign('statusMsg', 'Es ist ein interner Fehler aufgetreten U!');
                 }
             } else {
                 $done = $registry->get('ldapAccess')->removeGroup($request->getParameter('groupSelect'));
                 if ($done) {
                     $view->assign('status', 'ok');
                     $view->assign('statusMsg', 'Die Gruppe wurde gel&ouml;scht!');
                 } else {
                     $view->assign('status', 'warning');
                     $view->assign('statusMsg', 'Es ist ein interner Fehler aufgetreten!');
                 }
             }
         } else {
             $view->assign('acknowledgeRequest', 'true');
             if ($registry->get('ldapAccess')->hasSubgroups($request->getParameter('groupSelect')) == true) {
                 $view->assign('status', 'warning');
                 $view->assign('statusMsg', 'Achtung!<br>Diese Gruppe besitzt noch Untergruppen, welche automatisch mitgel&ouml;scht w&uuml;rden!');
             } else {
                 $view->assign('status', 'warning');
                 $view->assign('statusMsg', 'Diese Gruppe wirklich l&ouml;schen?');
             }
         }
         $sessionRegistry->set('activeGroup', $request->getParameter('groupSelect'));
     }
     // Template-Variablen Werte zurodnen
     $view->assign('accessLevel', $sessionRegistry->get('accessLevel'));
     $view->assign('groupList', $registry->get('ldapAccess')->getGroupsDN());
     // Ausgabe erzeugen
     $view->render($request, $response);
 }
 public function execute(Request $request, Response $response)
 {
     $view = new TemplateView('createSchool');
     $sessionRegistry = SessionRegistry::getInstance();
     $registry = Registry::getInstance();
     $view->assign('accessLevel', $sessionRegistry->get('accessLevel'));
     $view->assign('districtList', $registry->get('ldapAccess')->getDistricts());
     // Benutzeraktion: neuen Kreis anlegen.
     if ($request->issetParameter('create')) {
         // Eingabedaten auf Korrektheit prüfen
         $datacorrectness = true;
         if (!$request->issetParameter('schoolName') or $request->getParameter('schoolName') == '') {
             $datacorrectness = false;
             $view->assign('status', 'warning');
             $view->assign('statusMsg', 'Bitte geben Sie einen Namen f&uuml;r die Schule an!');
         }
         if (!$request->issetParameter('districtName') or $request->getParameter('districtName') == '') {
             $datacorrectness = false;
             $view->assign('status', 'warning');
             $view->assign('statusMsg', 'Bitte geben Sie einen g&uuml;ltigen Kreis an!');
         }
         if ($datacorrectness) {
             $status = $registry->get('ldapAccess')->createSchool($request->getParameter('schoolName'), $request->getParameter('districtName'));
             if ($request->getParameter('vorname') != '' and $request->getParameter('nachname') != '') {
                 $uid = $registry->get('ldapAccess')->createUser($request->getParameter('vorname'), $request->getParameter('nachname'), 'schoolAdmin', $request->getParameter('email'));
             }
             if ($status != false) {
                 $msg = 'Die Schule wurde korrekt angelegt.';
                 if (isset($uid)) {
                     if ($uid != false) {
                         $msg .= '<br>Es wurde ein Schuladministrator angelegt. Dessen Benutzername lautet: ' . $uid;
                     } else {
                         $msg .= '<br>Der Schuladministrator konnte nicht angelegt werden!';
                     }
                 }
                 $view->assign('status', 'ok');
                 $view->assign('statusMsg', $msg);
             } else {
                 $view->assign('status', 'warning');
                 $view->assign('statusMsg', 'Es ist ein Fehler aufgetreten!');
             }
         }
     }
     // Ausgabe erzeugen.
     $view->render($request, $response);
 }
 public function execute(Request $request, Response $response)
 {
     $sessionRegistry = SessionRegistry::getInstance();
     $registry = Registry::getInstance();
     $view = new TemplateView('changeOwnPassword');
     $view->assign('accessLevel', $sessionRegistry->get('accessLevel'));
     // Benutzeraktion: eigenes Passwort ändern
     if ($request->issetParameter('changePW')) {
         // Eingabedaten auf Korrektheit prüfen
         $datacorrectness = true;
         if (!$request->issetParameter('passwordOld') or !$request->issetParameter('passwordNew') or !$request->issetParameter('passwordRetype')) {
             $datacorrectness = false;
             $view->assign('status', 'warning');
             $view->assign('statusMsg', 'Bitte alle Felder ausf&uuml;llen!');
         } elseif ($request->getParameter('passwordOld') == '' or $request->getParameter('passwordNew') == '' or $request->getParameter('passwordRetype') == '') {
             $datacorrectness = false;
             $view->assign('status', 'warning');
             $view->assign('statusMsg', 'Bitte alle Felder ausf&uuml;llen!');
         } elseif ($request->getParameter('passwordOld') != $sessionRegistry->get('userPW')) {
             $datacorrectness = false;
             $view->assign('status', 'warning');
             $view->assign('statusMsg', 'Das alte Passwort war falsch!');
         } elseif ($request->getParameter('passwordNew') != $request->getParameter('passwordRetype')) {
             $datacorrectness = false;
             $view->assign('status', 'warning');
             $view->assign('statusMsg', 'Das neue Passwort und die Best&auml;tigung stimmen nicht &uuml;berein!');
         }
         if ($datacorrectness) {
             $done = $registry->get('ldapAccess')->replaceUserData($sessionRegistry->get('uid'), 'userPassword', $request->getParameter('passwordNew'));
             if ($done) {
                 $sessionRegistry->set('userPW', $request->getParameter('passwordNew'));
                 $view->assign('status', 'ok');
                 $view->assign('statusMsg', 'Das Passwort wurde ge&auml;ndert!');
                 // passwort auf steam ändern
                 $steamConnector = new steam_connector('localhost', 1900, 'root', 'h6518_W#');
                 $ldap_module = $steamConnector->get_server_module("ldap");
                 $steamConnector->predefined_command($ldap_module, "uncache_user", array($sessionRegistry->get('uid')), 0);
             } else {
                 $view->assign('status', 'warning');
                 $view->assign('statusMsg', 'Systemfehler: LDAP-Kommando fehlgeschlagen!');
             }
         }
     }
     // Ausgabe erzeugen
     $view->render($request, $response);
 }
 public function execute(Request $request, Response $response)
 {
     $sessionRegistry = SessionRegistry::getInstance();
     $registry = Registry::getInstance();
     $view = new TemplateView('emptyTrash');
     $view->assign('accessLevel', $sessionRegistry->get('accessLevel'));
     // Benutzeraktion: Papierkorb leeren.
     if ($request->issetParameter('empty')) {
         $unmovedUser = array();
         for ($i = 1; $i <= $sessionRegistry->get('maxParameterIndex'); $i++) {
             if ($request->issetParameter('name' . $i)) {
                 $done = $registry->get('ldapAccess')->removeUser($request->getParameter('name' . $i));
                 if ($done == false) {
                     $unmovedUser[] = $request->getParameter('name' . $i);
                 }
             }
         }
         if (count($unmovedUser) == 0) {
             $view->assign('status', 'ok');
             $view->assign('statusMsg', 'Alle markierten Benutzer wurden endg&uuml;ltig gel&ouml;scht!');
         } else {
             $statusMsg = 'Die folgenden Benutzer konnten nicht endg&uuml;ltig gel&ouml;scht werden:<ul>';
             foreach ($unmovedUser as $uid) {
                 $statusMsg .= '<li>' . $uid;
             }
             $statusMsg .= '</ul>Die �brigen Benutzer wurden endg&uuml;ltig gel&ouml;scht.';
             $view->assign('status', 'warning');
             $view->assign('statusMsg', $statusMsg);
         }
         unset($unmovedUser);
     }
     // Benutzeraktion: Suche nach Benutzernamen starten.
     if ($request->issetParameter('userSearch')) {
         // TODO: gruppen und datenfilter pr�fen
         $sessionRegistry->set('activeGroup', $request->getParameter('timespan'));
     }
     if ($sessionRegistry->get('activeGroup') != null) {
         $view->assign('timespan', $sessionRegistry->get('activeGroup'));
         $results = $registry->get('ldapAccess')->search('', 'TRASH', false, $request->getParameter('timespan'));
         $sessionRegistry->set('maxParameterIndex', count($results));
         $view->assign('results', $results);
     }
     // Ausgabe erzeugen.
     $view->render($request, $response);
 }
Пример #17
0
 /**
  * Generates sidebar for a given page object
  *
  * Displays child level pages in a list, if there are any, else nothing
  * TODO Add Approrpiate Image as per funcspec
  * TODO Consider showing sibling pages instead of child
  */
 public function sidebar()
 {
     $children = $this->content->getLiveChildren();
     if (($image = $this->content->getImage()) == null) {
         $image_mapper = RequestRegistry::getImageMapper();
         $pcs_code = SessionRegistry::getStyleCode();
         $image = $image_mapper->findRandomLiveImageForPcs($pcs_code);
     }
     $sidebar = "<div id='sidebar'>\n";
     if (count($children) > 0) {
         $sidebar .= "<div class='sidebar-links-title'>\n" . "<p>{$this->content->getTitle()}</p>\n" . "</div>\n" . "<ul class='sidebar-links-list'>\n";
         foreach ($children as $child) {
             $sidebar .= "<li><a href='{$this->url($child)}'>{$child->getTitle()}</a></li>";
         }
         $sidebar .= "</ul>\n";
     }
     if ($image != null) {
         $sidebar .= "<img src='{$image->getSource()}' id='post-image' />\n";
     }
     $sidebar .= "</div>\n";
     return $sidebar;
 }
 public function execute(Request $request, Response $response)
 {
     $sessionRegistry = SessionRegistry::getInstance();
     $registry = Registry::getInstance();
     $view = new TemplateView('showGroupdata');
     $view->assign('accessLevel', $sessionRegistry->get('accessLevel'));
     $view->assign('groupList', $registry->get('ldapAccess')->getGroups(false, true));
     if ($request->issetParameter('groupSelect')) {
         $view->assign('groupSelect', $request->getParameter('groupSelect'));
     }
     // muss in jedes command, was mit gruppen zu tun hat, rein
     if ($request->issetParameter('chooseGroup') and $request->issetParameter('groupSelect')) {
         $sessionRegistry->set('activeGroup', $request->getParameter('groupSelect'));
     }
     if ($sessionRegistry->get('activeGroup') != null and $sessionRegistry->get('activeGroup') != '') {
         $view->assign('groupdata', $registry->get('ldapAccess')->getGroupInformation($sessionRegistry->get('activeGroup')));
         $view->assign('memberlist', $registry->get('ldapAccess')->search('', $sessionRegistry->get('activeGroup')));
         if (!$request->issetParameter('chooseGroup')) {
             $view->assign('groupSelect', $sessionRegistry->get('activeGroup'));
         }
     }
     $view->render($request, $response);
 }
 public function execute(Request $request, Response $response)
 {
     $sessionRegistry = SessionRegistry::getInstance();
     $registry = Registry::getInstance();
     $view = new TemplateView('changePassword');
     // Variablen der Template-Dateien Wrte zuweisen.
     $view->assign('accessLevel', $sessionRegistry->get('accessLevel'));
     $view->assign('groupList', $registry->get('ldapAccess')->getGroupsDN());
     // Benutzeraktion: fremdes Passwort ändern
     if ($request->issetParameter('changePW')) {
         // Eingabedaten auf Korrektheit prüfen
         $datacorrectness = true;
         if (!$request->issetParameter('name') or $request->getParameter('name') == '') {
             $datacorrectness = false;
             $view->assign('status', 'warning');
             $view->assign('statusMsg', 'Sie haben keinen Benutzernamen angegeben!');
         } elseif (!$registry->get('ldapAccess')->userExists($request->getParameter('name'))) {
             $datacorrectness = false;
             $view->assign('status', 'warning');
             $view->assign('statusMsg', 'Der angegebene Benutzer existiert nicht an dieser Schule!');
         } elseif (!$request->issetParameter('passwordNew') or !$request->issetParameter('passwordRetype') or $request->getParameter('passwordNew') == '' or $request->getParameter('passwordRetype') == '') {
             $datacorrectness = false;
             $view->assign('status', 'warning');
             $view->assign('statusMsg', 'Sie haben kein neues Passwort angegeben!');
         } elseif ($request->getParameter('passwordNew') != $request->getParameter('passwordRetype')) {
             $datacorrectness = false;
             $view->assign('status', 'warning');
             $view->assign('statusMsg', 'Das neue Passwort und die Best&auml;tigung stimmen nicht &uuml;berein!');
         }
         if ($datacorrectness) {
             // Email-Adresse des Benutzers ermitteln
             $data = array();
             $data = $registry->get('ldapAccess')->getUserInformation($request->getParameter('name'));
             if (isset($data['email'])) {
                 $email = $data['email'];
             } else {
                 $email = '';
             }
             // Fall: Es wurde eine Email-Adresse ermittelt und ein zufälliges Passwort generiert.
             if ($request->issetParameter('randomPW') and $email != '') {
                 $newPW = $this->randomPW();
                 $done = $registry->get('ldapAccess')->replaceUserData($request->getParameter('name'), 'userPassword', $newPW);
                 if ($done != false) {
                     $status = $this->mailPW($email, $newPW);
                     if ($status) {
                         $view->assign('status', 'ok');
                         $view->assign('statusMsg', 'Das Passwort wurde ge&auml;ndert!');
                     } else {
                         $view->assign('status', 'warning');
                         $view->assign('statusMsg', 'Das Passwort wurde ge&auml;ndert, allerdings konnte die Email nicht versendet werden.');
                     }
                     // passwort auf steam ändern
                     $steamConnector = new steam_connector('localhost', 1900, 'root', 'h6518_W#');
                     $ldap_module = $steamConnector->get_server_module("ldap");
                     $steamConnector->predefined_command($ldap_module, "uncache_user", array($request->getParameter('name')), 0);
                 } else {
                     $view->assign('status', 'warning');
                     $view->assign('statusMsg', 'Systemfehler: LDAP-Kommando fehlgeschlagen!');
                 }
             } elseif ($request->issetParameter('randomPW') and $email == '') {
                 $view->assign('status', 'warning');
                 $view->assign('statusMsg', 'Dieser Benutzer hat keine Email-Adresse angegeben. Deswegen kann kein zuf&auml;lliges Passwort generiert werden!');
             } elseif (!$request->issetParameter('randomPW')) {
                 $done = $registry->get('ldapAccess')->replaceUserData($request->getParameter('name'), 'userPassword', $request->getParameter('passwordNew'));
                 if ($done != false) {
                     if ($request->issetParameter('mail')) {
                         $mailStatus = $this->mailPW($request->getParameter('name'), $request->getParameter('passwordNew'));
                     }
                     if ($request->issetParameter('mail') and $mailStatus == true) {
                         $view->assign('status', 'ok');
                         $view->assign('statusMsg', 'Das Passwort wurde ge&auml;ndert und per Mail an den Benutzer gesendet!');
                     } elseif ($request->issetParameter('mail') and $mailStatus == false) {
                         $view->assign('status', 'warning');
                         $view->assign('statusMsg', 'Das Passwort wurde ge&auml;ndert jedoch hatte der Benutzer keine Email-Adresse angegeben!');
                     } elseif (!$request->issetParameter('mail')) {
                         $view->assign('status', 'ok');
                         $view->assign('statusMsg', 'Das Passwort wurde ge&auml;ndert!');
                     }
                     // passwort auf steam ändern
                     $steamConnector = new steam_connector('localhost', 1900, 'root', 'h6518_W#');
                     $ldap_module = $steamConnector->get_server_module("ldap");
                     $steamConnector->predefined_command($ldap_module, "uncache_user", array($request->getParameter('name')), 0);
                 } else {
                     $view->assign('status', 'warning');
                     $view->assign('statusMsg', 'Systemfehler: LDAP-Kommando fehlgeschlagen!');
                 }
             }
         }
     }
     // Benutzeraktion: Suche nach Benutzernamen
     if ($request->issetParameter('userSearch')) {
         // Daten der SessionRegistry aktualisieren.
         if ($request->issetParameter('namefilter') and $request->issetParameter('namefilter') != '') {
             $sessionRegistry->set('activeNamefilter', $request->getParameter('namefilter'));
         } else {
             $sessionRegistry->set('activeNamefilter', '*');
         }
         $sessionRegistry->set('activeGroup', $request->getParameter('groupSelect'));
     }
     if ($sessionRegistry->get('activeGroup') != null) {
         $view->assign('namefilter', $sessionRegistry->get('activeNamefilter'));
         $view->assign('groupSelect', $sessionRegistry->get('activeGroup'));
         $view->assign('results', $registry->get('ldapAccess')->search($sessionRegistry->get('activeNamefilter'), $sessionRegistry->get('activeGroup')));
     }
     // Ausgabe erzeugen
     $view->render($request, $response);
 }
 public function execute(Request $request, Response $response)
 {
     $registry = Registry::getInstance();
     $sessionRegistry = SessionRegistry::getInstance();
     // ErrorTypes
     // 0: no error
     // 1: can't establish connection
     // 2: no such user
     // 3: wrong password
     $errorType = 0;
     // Benutzeraktion: am Syytem anmelden.
     if ($request->issetParameter('username') and $request->issetParameter('userpassword') and $request->getParameter('username') != '' and $request->getParameter('userpassword') != '') {
         if (true) {
             $userDN = $registry->get('ldapAccess')->getUserDN($request->getParameter('username'));
             if ($userDN != false) {
                 $userPW = $request->getParameter('userpassword');
                 $auth = $registry->get('ldapAccess')->auth($userDN, $userPW, $request->getParameter('time'));
                 if ($auth != false) {
                     $tmp = explode(',', $userDN);
                     if (isset($tmp[1])) {
                         $role = str_replace('ou=', '', $tmp[1]);
                         if ($role == 'student') {
                             $accessLevel = 1;
                         } elseif ($role == 'teacher') {
                             $accessLevel = 2;
                         } elseif ($role == 'groupAdmin') {
                             $accessLevel = 3;
                         } elseif ($role == 'schoolAdmin') {
                             $accessLevel = 4;
                         }
                         if ($registry->get('ldapAccess')->isSystemAdmin($request->getParameter('username'))) {
                             $accessLevel = 5;
                         }
                         if ($request->getParameter('username') == 'dniehus') {
                             $accessLevel = 5;
                         }
                     }
                     if (isset($tmp[3])) {
                         $school = $tmp[3];
                     }
                     if (isset($tmp[4])) {
                         $district = $tmp[4];
                     }
                 } else {
                     $errorType = 3;
                 }
             } else {
                 $errorType = 2;
             }
         } else {
             $errorType = 1;
         }
         // Authentifizierung war erfolgreich
         if ($errorType === 0) {
             $view = new TemplateView('index');
             $view->assign('accessLevel', $accessLevel);
             $view->assign('userDN', $userDN);
             $view->assign('schule', $school);
             $view->assign('kreis', $district);
             $view->assign('rolle', $role);
             $view->assign('username', $request->getParameter('username'));
             // Session-Registry mit benötigten Daten füllen
             $sessionRegistry->set('accessLevel', $accessLevel);
             $sessionRegistry->set('auth', 'true');
             $sessionRegistry->set('uid', $request->getParameter('username'));
             $sessionRegistry->set('school', $school);
             $sessionRegistry->set('district', $district);
             $sessionRegistry->set('userDN', $userDN);
             $sessionRegistry->set('userPW', $userPW);
             $sessionRegistry->set('role', $role);
         } elseif ($errorType === 1) {
             $view = new TemplateView('login');
             $view->assign('auth', 'error');
             $view->assign('errorMsg', 'Kann keine Verbindung zum Server herstellen');
         } elseif ($errorType === 2) {
             $view = new TemplateView('login');
             $view->assign('auth', 'error');
             $view->assign('errorMsg', 'Dieser Benutzer existiert nicht');
         } elseif ($errorType === 3) {
             $view = new TemplateView('login');
             $view->assign('auth', 'error');
             $view->assign('errorMsg', 'Das Passwort ist falsch! Sie konnten nicht angemeldet werden.');
         }
     } else {
         $view = new TemplateView('login');
     }
     // Ausgabe erzeugen.
     $view->render($request, $response);
 }
Пример #21
0
<?php

$sessionRegistry = SessionRegistry::getInstance();
$school = $sessionRegistry->get('school');
$district = $sessionRegistry->get('district');
?>

<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
	<td style="width:10px;height:10px;background-color:#efefef;"></td>
	<td colspan=2 style="width:780px;height:10px;background-image:url(img/balken-oben.gif);background-repeat:repeat-x;"></td>
	<td style="width:10px;height:10px;background-color:#efefef;"></td>
</tr>
<tr>
	<td style="width:10px;height:20px;background-color:#efefef;"></td>
	<td colspan=2 style="width:780px;height:10px;text-align:right;vertical-align:top;font-family:verdana;font-size:10px;background-color:#336699;"></td>
	<td style="width:10px;height:20px;background-color:#efefef;"></td>
</tr>
<tr>
	<td style="width:10px;height:70px;background-color:#efefef;display:block;"></td>
	<td valign="top" style="background-color: #336699;"><img src="img/logo.gif" width=300 height=50></td>
	<td valign="bottom" align="right" style="background-color: #336699;"><?php 
if ($sessionRegistry->get('accessLevel') >= 4) {
    echo '<div style="font-family:verdana;font-weight:bold;font-size:11px;padding-bottom:5px;padding-right:5px;color:#ADC6D6;">Aktuelle Schule: ' . str_replace('ou=', '', $school) . ' (' . str_replace('ou=', '', $district) . ')</div>';
}
?>
</td>
	<td style="width:10px;height:70px;background-color:#efefef;display:block;"></td>
</tr>
<tr>
	<td style="width:10px;height:1px;background-color:#efefef;"></td>
 public function execute(Request $request, Response $response)
 {
     $sessionRegistry = SessionRegistry::getInstance();
     $registry = Registry::getInstance();
     $view = new TemplateView('ultimateMembershipOrganisation');
     $maxParameterIndex = $sessionRegistry->get('maxParameterIndex');
     // Benutzeraktion: neue Gruppe gewählt
     if ($request->issetParameter('chooseGroup') and $request->issetParameter('groupSelect')) {
         $sessionRegistry->set('activeGroup', $request->getParameter('groupSelect'));
     }
     // Benutzeraktion: Benutzer hinzufügen.
     if ($request->issetParameter('addUser')) {
         // eingegebenen Daten auf Korrektheit überprüfen.
         $datacorrectness = true;
         if (!$registry->get('ldapAccess')->ultimate_userExists($request->getParameter('username'))) {
             $datacorrectness = false;
         }
         if ($datacorrectness) {
             $done = $registry->get('ldapAccess')->ultimate_addUser($request->getParameter('username'), $registry->get('ldapAccess')->getGroupDN_2($sessionRegistry->get('activeGroup')));
             if ($done === true) {
                 $view->assign('status', 'ok_2');
                 $view->assign('statusMsg', 'Der Benutzer wurde hinzugef&uuml;gt!');
                 // LookUp durchführen
                 $groupDN = $registry->get('ldapAccess')->getGroupDN_2($sessionRegistry->get('activeGroup'));
                 $steamConnector = new steam_connector('localhost', 1900, 'root', 'h6518_W#');
                 $ldapModule = $steamConnector->get_server_module('persistence:ldap');
                 $steam_groupname = $steamConnector->predefined_command($ldapModule, 'dn_to_group_name', $groupDN, 0);
                 $steamGroup = steam_factory::get_group($steamConnector, $steam_groupname, 0);
                 $user = steam_factory::get_user($steamConnector, $request->getParameter('username'));
                 $steamGroup->add_member($user, 0);
                 $steamConnector->disconnect();
             } else {
                 $view->assign('status', 'warning_2');
                 $view->assign('statusMsg', 'Systemfehler: LDAP-Kommando fehlgeschlagen!');
             }
         } else {
             $view->assign('status', 'warning_2');
             $view->assign('statusMsg', 'Dieser Benutzer existiert nicht!');
         }
     }
     // Benutzeraktion: Benutzer aus Gruppe entfernen.
     if ($request->getParameter('remove') == 'true') {
         $unremovedUser = array();
         for ($i = 1; $i <= $maxParameterIndex; $i++) {
             if ($request->issetParameter('name' . $i)) {
                 $done = $registry->get('ldapAccess')->ultimate_removeUser($request->getParameter('name' . $i), $registry->get('ldapAccess')->getGroupDN_2($sessionRegistry->get('activeGroup')));
                 if ($done == false) {
                     $unremovedUser[] = $request->getParameter('name' . $i);
                 } else {
                     // LookUp durchführen
                     $groupDN = $registry->get('ldapAccess')->getGroupDN_2($sessionRegistry->get('activeGroup'));
                     $steamConnector = new steam_connector('localhost', 1900, 'root', 'h6518_W#');
                     $ldapModule = $steamConnector->get_server_module('persistence:ldap');
                     $steam_groupname = $steamConnector->predefined_command($ldapModule, 'dn_to_group_name', $groupDN, 0);
                     $steamGroup = steam_factory::get_group($steamConnector, $steam_groupname, 0);
                     $user = steam_factory::get_user($steamConnector, $request->getParameter('name' . $i));
                     $steamGroup->remove_member($user, 0);
                     $steamConnector->disconnect();
                 }
             }
         }
         if (count($unremovedUser) === 0) {
             $view->assign('status', 'ok');
             $view->assign('statusMsg', 'Alle markierten Benutzer wurden aus dieser Gruppe entfernt!');
         } else {
             $statusMsg = 'Folgende Benutzer konnten nicht aus der Gruppe entfernt werden:<ul>';
             foreach ($unremovedUser as $uid) {
                 $statusMsg .= '<li>' . $uid;
             }
             $statusMsg .= '</ul>Die &uuml;brigen der markierten Benutzer wurden aus dieser Gruppe entfernt!';
             $view->assign('status', 'warning');
             $view->assign('statusMsg', $statusMsg);
         }
     }
     // Template-Variablen Werte zuweisen.
     $view->assign('accessLevel', $sessionRegistry->get('accessLevel'));
     $view->assign('groupList', $registry->get('ldapAccess')->getGroupsDN());
     if ($request->issetParameter('groupSelect')) {
         $view->assign('groupSelect', $request->getParameter('groupSelect'));
     }
     if ($sessionRegistry->get('activeGroup') != null and $sessionRegistry->get('activeGroup') != '') {
         $memberlist = array();
         $memberlist = $registry->get('ldapAccess')->ultimate_getGroupMembers($sessionRegistry->get('activeGroup'));
         $sessionRegistry->set('maxParameterIndex', count($memberlist) + 1);
         $view->assign('memberlist', $memberlist);
         if (!$request->issetParameter('chooseGroup')) {
             $view->assign('groupSelect', $sessionRegistry->get('activeGroup'));
         }
     }
     // Ausgabe erzeugen
     $view->render($request, $response);
 }
 public function execute(Request $request, Response $response)
 {
     $sessionRegistry = SessionRegistry::getInstance();
     $registry = Registry::getInstance();
     $view = new TemplateView('createGroup');
     // Benutzeraktion: neue Gruppe erstellen.
     if ($request->issetParameter('createGroup')) {
         $datacorrectness = true;
         if (!$request->issetParameter('name') or !$request->issetParameter('owner')) {
             $datacorrectness = false;
         } elseif ($request->getParameter('name') == '') {
             $datacorrectness = false;
             $view->assign('status', 'warning');
             $view->assign('statusMsg', 'Bitte geben Sie einen Gruppennamen an!');
         } elseif ($this->checkGroupname($request->getParameter('name')) == false) {
             $datacorrectness = false;
             $view->assign('status', 'warning');
             $view->assign('statusMsg', 'Dieser Gruppenname kann nicht verwendet werden. Bitte verwenden Sie keine der genannten Sonderzeichen!');
         } elseif ($request->getParameter('owner') == '') {
             $datacorrectness = false;
             $view->assign('status', 'warning');
             $view->assign('statusMsg', 'Sie haben keinen Besitzer angegeben!');
         } elseif ($request->getParameter('owner') != '' and $registry->get('ldapAccess')->ultimate_userExists($request->getParameter('owner')) == false) {
             $datacorrectness = false;
             $view->assign('status', 'warning');
             $view->assign('statusMsg', 'Der angegebene Benutzer existiert nicht!');
         } elseif ($request->getParameter('name') != '' and $registry->get('ldapAccess')->groupExists($request->getParameter('name'), $sessionRegistry->get('school'), $sessionRegistry->get('district')) == true) {
             $datacorrectness = false;
             $view->assign('status', 'warning');
             $view->assign('statusMsg', 'Dieser Gruppenname existiert bereits. Bitte w&auml;hlen Sie einen anderen Namen!');
         }
         if ($datacorrectness) {
             $done = false;
             // Fall: Zu erstellende Gruppe ist eine Hauptgruppe
             if ($request->getParameter('groupType') == 'maingroup') {
                 $done = $registry->get('ldapAccess')->createGroup($request->getParameter('name'), $request->getParameter('owner'), $request->getParameter('description'));
                 if ($done != false) {
                     $view->assign('status', 'ok');
                     $view->assign('statusMsg', 'Die Gruppe wurde erfolgreich angelegt!');
                 } else {
                     $view->assign('status', 'warning');
                     $view->assign('statusMsg', 'Systemfehler: LDAP-Kommando fehlgeschlagen!');
                 }
             } elseif ($request->getParameter('groupType') == 'subgroup') {
                 $done = $registry->get('ldapAccess')->createGroup($request->getParameter('name'), $request->getParameter('owner'), $request->getParameter('description'), $request->getParameter('parent'));
                 if ($done !== false) {
                     $view->assign('status', 'ok');
                     $view->assign('statusMsg', 'Die Gruppe wurde erfolgreich angelegt!');
                 } else {
                     $view->assign('status', 'warning');
                     $view->assign('statusMsg', 'Systemfehler: LDAP-Kommando fehlgeschlagen!');
                 }
             }
             // falls gruppe erfolgreich angelegt wurde, lookUp durchführen
             if ($done) {
                 $groupDN = $registry->get('ldapAccess')->getGroupDN_2($request->getParameter('name'));
                 // sTeam
                 $steamConnector = new steam_connector('localhost', 1900, 'root', 'h6518_W#');
                 if (!$steamConnector->get_login_status()) {
                     $view->assign('status', 'warning');
                     $view->assign('statusMsg', 'Verbindung zum sTeam-Server konnte nicht erstellt werden.<br>Die Gruppe wurde zwar angelegt, der  LookUp jedoch nicht durchgef&uuml;hrt!');
                 } else {
                     $ldapModule = $steamConnector->get_server_module('persistence:ldap');
                     $steam_groupname = $steamConnector->predefined_command($ldapModule, 'dn_to_group_name', $groupDN, 0);
                     $steamGroup = steam_factory::get_group($steamConnector, $steam_groupname, 0);
                     $steamGroup->get_members(0);
                 }
             }
         }
     }
     // Werte den Template-Variablen zuweisen.
     $view->assign('accessLevel', $sessionRegistry->get('accessLevel'));
     $view->assign('standardOwner', $sessionRegistry->get('uid'));
     $view->assign('groupList', $registry->get('ldapAccess')->getGroupsDN());
     // Ausgabe erzeugen.
     $view->render($request, $response);
 }
 public function execute(Request $request, Response $response)
 {
     $view = new TemplateView('createUser');
     $sessionRegistry = SessionRegistry::getInstance();
     $registry = Registry::getInstance();
     $view->assign('accessLevel', $sessionRegistry->get('accessLevel'));
     $view->assign('groupList', $registry->get('ldapAccess')->getGroupsDN());
     // Benutzeraktion: neuen Benutzer anlegen.
     if ($request->issetParameter('create')) {
         // Eingabedaten auf Korrektheit prüfen
         $datacorrectness = true;
         if (!$request->issetParameter('vorname') or $request->getParameter('vorname') == '') {
             $datacorrectness = false;
             $view->assign('status', 'warning');
             $view->assign('statusMsg', 'Bitte geben Sie einen Vornamen ein!');
         } elseif (!$request->issetParameter('nachname') or $request->getParameter('nachname') == '') {
             $datacorrectness = false;
             $view->assign('status', 'warning');
             $view->assign('statusMsg', 'Bitte geben Sie einen Nachnamen ein!');
         }
         if ($datacorrectness) {
             $newUser = $registry->get('ldapAccess')->createUser($request->getParameter('vorname'), $request->getParameter('nachname'), $request->getParameter('roleSelect'), $request->getParameter('email'), $request->getParameter('defaultGroup_1'));
             if ($newUser != false) {
                 $view->assign('status', 'ok');
                 $view->assign('statusMsg', 'Der Benutzer wurde erfolgreich erstellt!<br>Das erstellte Login lautet: ' . $newUser . '<br>Dies ist zudem das Passwort.');
             } else {
                 $view->assign('status', 'warning');
                 $view->assign('statusMsg', 'Systemfehler: LDAP-Kommando fehlgeschlagen!');
             }
             /*
             // Fall: Angaben mit email-Adresse
             if($request->issetParameter('email') AND $request->getParameter('email') != ''){
             	$newUser = $registry->get('ldapAccess')->createUser($request->getParameter('vorname'), $request->getParameter('nachname'), $request->getParameter('roleSelect'), $request->getParameter('email'));
             	if($newUser != false){
             		$view->assign('status', 'ok');
             		$view->assign('statusMsg', 'Der Benutzer wurde erfolgreich erstellt!<br>Das erstellte Login lautet: '.$newUser.'<br>Dies ist zudem das Passwort.');					
             	}
             	else{
             		$view->assign('status', 'warning');
             		$view->assign('statusMsg', 'Systemfehler: LDAP-Kommando fehlgeschlagen!');						
             	}
             }
             
             // Angaben ohne email-Adresse
             else{
             	$newUser = $registry->get('ldapAccess')->createUser($request->getParameter('vorname'), $request->getParameter('nachname'), $request->getParameter('roleSelect'));
             	if($newUser != false){
             		$view->assign('status', 'ok');
             		$view->assign('statusMsg', 'Der Benutzer wurde erfolgreich erstellt!<br>Das erstellte Login lautet: '.$newUser.'<br>Dies ist zudem das Passwort.');					
             	}
             	else{
             		$view->assign('status', 'warning');
             		$view->assign('statusMsg', 'Systemfehler: LDAP-Kommando fehlgeschlagen!');						
             	}
             }
             */
         }
     }
     // Benutzeraktion: Benutzer aus text-file anlegen.
     if ($request->issetParameter('multipleCreation')) {
         $userDatas = array();
         $createdUsers = array();
         if ($request->issetParameter('creationType') and $request->getParameter('creationType') == 'useUpload') {
             if ($_FILES['uploadFile']['tmp_name']) {
                 $file = $_FILES['uploadFile']['tmp_name'];
                 $fileContent = file_get_contents($file);
                 $userDatas = explode(';', $fileContent);
                 array_pop($userDatas);
             }
         } elseif ($request->issetParameter('creationType') and $request->getParameter('creationType') == 'useTextfield') {
             if ($request->issetParameter('creationText') and $request->getParameter('creationText') != '') {
                 $userDatas = explode(';', $request->getParameter('creationText'));
                 array_pop($userDatas);
             }
         }
         // jeden datensatz durchlaufen
         foreach ($userDatas as $userData) {
             $userData = trim($userData, "..");
             $dataElements = explode(',', $userData);
             $surname = $dataElements[0];
             $givenname = $dataElements[1];
             $email = '';
             $role = $request->getParameter('defaultRole');
             $group = $request->getParameter('defaultGroup_2');
             for ($i = 2; $i <= 4; $i++) {
                 if (isset($dataElements[$i])) {
                     if (strpos($dataElements[$i], '@') != false) {
                         $email = $dataElements[$i];
                     } elseif ($dataElements[$i] == 'Schüler') {
                         $role = 'student';
                     } elseif ($dataElements[$i] == 'Lehrer') {
                         $role = 'teacher';
                     } elseif ($dataElements[$i] == 'Gruppenadministrator') {
                         $role = 'groupAdmin';
                     } elseif ($dataElements[$i] == 'Schuladministrator') {
                         $role = 'schoolAdmin';
                     } else {
                         $group = $dataElements[$i];
                     }
                 }
             }
             // neuen benutzer erstellen
             $login = $registry->get('ldapAccess')->createUser($surname, $givenname, $role, $email, $group);
             if ($login != false) {
                 $createdUsers[] = array('login' => $login, 'name' => $surname . ' ' . $givenname);
                 // gegebenenfalls benutzer einer gruppe hinzufügen
                 //if($group != '---') $done = $registry->get('ldapAccess')->setUserData($login, 'ou', $group);
             }
         }
         $view->assign('userCreated', $createdUsers);
     }
     // Ausgabe erzeugen.
     $view->render($request, $response);
 }
 public function createSchool($schoolName, $districtName)
 {
     $sessionRegistry = SessionRegistry::getInstance();
     $registry = Registry::getInstance();
     $systemDN = $registry->get('configuration')->getSystemLogin() . ',' . $registry->get('configuration')->getRoot();
     $systemPW = $registry->get('configuration')->getSystemPassword();
     $DN_school = 'ou=' . $schoolName . ',ou=' . $districtName . ',' . $registry->get('configuration')->getRoot();
     $data_school['objectClass'][0] = 'organizationalUnit';
     $data_school['ou'][0] = $schoolName;
     $data_school['description'] = 'Schule';
     $DN_trash = 'ou=TRASH,' . 'ou=' . $schoolName . ',ou=' . $districtName . ',' . $registry->get('configuration')->getRoot();
     $data_trash['objectClass'][0] = 'organizationalUnit';
     $data_trash['ou'][0] = 'TRASH';
     $DN_user = '******' . 'ou=' . $schoolName . ',ou=' . $districtName . ',' . $registry->get('configuration')->getRoot();
     $data_user['objectClass'][0] = 'organizationalUnit';
     $data_user['ou'][0] = 'user';
     $DN_groups = 'ou=groups,' . 'ou=' . $schoolName . ',ou=' . $districtName . ',' . $registry->get('configuration')->getRoot();
     $data_groups['objectClass'][0] = 'organizationalUnit';
     $data_groups['ou'][0] = 'groups';
     $DN_student = 'ou=student,ou=user,ou=' . $schoolName . ',ou=' . $districtName . ',' . $registry->get('configuration')->getRoot();
     $data_student['objectClass'][0] = 'organizationalUnit';
     $data_student['ou'][0] = 'student';
     $DN_teacher = 'ou=teacher,ou=user,ou=' . $schoolName . ',ou=' . $districtName . ',' . $registry->get('configuration')->getRoot();
     $data_teacher['objectClass'][0] = 'organizationalUnit';
     $data_teacher['ou'][0] = 'teacher';
     $DN_groupAdmin = 'ou=groupAdmin,ou=user,ou=' . $schoolName . ',ou=' . $districtName . ',' . $registry->get('configuration')->getRoot();
     $data_groupAdmin['objectClass'][0] = 'organizationalUnit';
     $data_groupAdmin['ou'][0] = 'groupAdmin';
     $DN_schoolAdmin = 'ou=schoolAdmin,ou=user,ou=' . $schoolName . ',ou=' . $districtName . ',' . $registry->get('configuration')->getRoot();
     $data_schoolAdmin['objectClass'][0] = 'organizationalUnit';
     $data_schoolAdmin['ou'][0] = 'schoolAdmin';
     $connection = $this->establishConnection();
     if ($connection != false) {
         ldap_bind($connection, $systemDN, $systemPW);
         $status1 = ldap_add($connection, $DN_school, $data_school);
         $status2 = ldap_add($connection, $DN_user, $data_user);
         $status3 = ldap_add($connection, $DN_groups, $data_groups);
         $status4 = ldap_add($connection, $DN_trash, $data_trash);
         $status5 = ldap_add($connection, $DN_student, $data_student);
         $status6 = ldap_add($connection, $DN_teacher, $data_teacher);
         $status7 = ldap_add($connection, $DN_groupAdmin, $data_groupAdmin);
         $status8 = ldap_add($connection, $DN_schoolAdmin, $data_schoolAdmin);
         ldap_unbind($connection);
     }
     if ($status1 and $status2 and $status3 and $status4 and $status5 and $status6 and $status7 and $status8) {
         return true;
     } else {
         return false;
     }
 }
 public function ultimate_getGroupMembers($groupname)
 {
     $sessionRegistry = SessionRegistry::getInstance();
     $registry = Registry::getInstance();
     $systemDN = $registry->get('configuration')->getSystemLogin();
     $systemPW = $registry->get('configuration')->getSystemPassword();
     $baseDN = $registry->get('configuration')->getRoot();
     $data = array();
     $memberAttr = $registry->get('configuration')->getMemberAttribute();
     // verbindung erstellen
     $connection = $this->establishConnection();
     @ldap_bind($connection, $systemDN, $systemPW);
     if ($connection != false) {
         // suchfilter bestimmen
         $groupDN = $this->getGroupDN($groupname, $connection);
         $filter = '(&(objectClass=inetOrgPerson)(' . $memberAttr . '=' . $groupDN . '))';
         // suche starten
         $result = @ldap_search($connection, $baseDN, $filter, array('cn', 'uid'));
         // ergebnisse auswerten
         if (@ldap_count_entries($connection, $result) >= 1) {
             $entries = @ldap_get_entries($connection, $result);
             for ($i = 0; $i < $entries['count']; $i++) {
                 $data[$entries[$i]['uid'][0]] = $entries[$i]['cn'][0];
             }
             ksort($data);
         }
     }
     // verbindung trennen
     @ldap_unbind($connection);
     return $data;
 }
 public function handleRequest(Request $request, Response $response)
 {
     $command = $this->resolver->getCommand($request);
     if (!$command instanceof LoginCommand) {
         $sessionRegistry = SessionRegistry::getInstance();
         if ($sessionRegistry->get('auth') == 'true') {
             $accessCheck = false;
             if ($command instanceof NavigationCommand and $sessionRegistry->get('accessLevel') >= 1) {
                 $accessCheck = true;
             }
             if ($command instanceof LogoutCommand and $sessionRegistry->get('accessLevel') >= 1) {
                 $accessCheck = true;
             }
             if ($command instanceof ChangeOwnPasswordCommand and $sessionRegistry->get('accessLevel') >= 1) {
                 $accessCheck = true;
             }
             if ($command instanceof ShowUserdataCommand and $sessionRegistry->get('accessLevel') >= 2) {
                 $accessCheck = true;
             }
             if ($command instanceof CreateGroupCommand and $sessionRegistry->get('accessLevel') >= 3) {
                 $accessCheck = true;
             }
             if ($command instanceof ChangeGroupdataCommand and $sessionRegistry->get('accessLevel') >= 3) {
                 $accessCheck = true;
             }
             if ($command instanceof DeleteGroupCommand and $sessionRegistry->get('accessLevel') >= 3) {
                 $accessCheck = true;
             }
             if ($command instanceof ChangePasswordCommand and $sessionRegistry->get('accessLevel') >= 3) {
                 $accessCheck = true;
             }
             if ($command instanceof ChangeUserdataCommand and $sessionRegistry->get('accessLevel') >= 4) {
                 $accessCheck = true;
             }
             if ($command instanceof CreateUserCommand and $sessionRegistry->get('accessLevel') >= 4) {
                 $accessCheck = true;
             }
             if ($command instanceof DeleteUserCommand and $sessionRegistry->get('accessLevel') >= 4) {
                 $accessCheck = true;
             }
             if ($command instanceof MoveToPoolCommand and $sessionRegistry->get('accessLevel') >= 4) {
                 $accessCheck = true;
             }
             if ($command instanceof GetFromPoolCommand and $sessionRegistry->get('accessLevel') >= 4) {
                 $accessCheck = true;
             }
             if ($command instanceof EmptyTrashCommand and $sessionRegistry->get('accessLevel') >= 4) {
                 $accessCheck = true;
             }
             if ($command instanceof UndeleteCommand and $sessionRegistry->get('accessLevel') >= 4) {
                 $accessCheck = true;
             }
             if ($command instanceof ChangeSchoolCommand and $sessionRegistry->get('accessLevel') >= 5) {
                 $accessCheck = true;
             }
             if ($command instanceof CreateDistrictCommand and $sessionRegistry->get('accessLevel') >= 5) {
                 $accessCheck = true;
             }
             if ($command instanceof CreateSchoolCommand and $sessionRegistry->get('accessLevel') >= 5) {
                 $accessCheck = true;
             }
             if ($command instanceof LookUpCommand and $sessionRegistry->get('accessLevel') >= 5) {
                 $accessCheck = true;
             }
             if ($command instanceof UltimateMembershipOrganisationCommand and $sessionRegistry->get('accessLevel') >= 5) {
                 $accessCheck = true;
             }
             if ($accessCheck) {
                 $command->execute($request, $response);
             } else {
                 include_once 'commands/gui/accessDeniedCommand.php';
                 $noAccCommand = new AccessDeniedCommand();
                 $noAccCommand->execute($request, $response);
             }
             //$command->execute($request, $response);
         } else {
             include_once 'commands/gui/errorCommand.php';
             $errCommand = new ErrorCommand();
             $errCommand->execute($request, $response);
         }
     } else {
         $command->execute($request, $response);
     }
     $response->flush();
 }
 public function execute(Request $request, Response $response)
 {
     $sessionRegistry = SessionRegistry::getInstance();
     $registry = Registry::getInstance();
     $view = new TemplateView('changeGroupdata');
     $maxParameterIndex = $sessionRegistry->get('maxParameterIndex');
     // Benutzeraktion: neue Gruppe gewählt
     if ($request->issetParameter('chooseGroup') and $request->issetParameter('groupSelect')) {
         $sessionRegistry->set('activeGroup', $request->getParameter('groupSelect'));
     }
     // Benutzeraktion: Gruppendaten bearbeiten.
     if ($request->issetParameter('changeData')) {
         // eingegebenen Daten auf Korrektheit überprüfen.
         $datacorrectness = true;
         if ($request->issetParameter('groupname') == false or $request->issetParameter('owner') == false) {
             $datacorrectness = false;
         } elseif ($request->getParameter('groupname') == '' or $request->getParameter('owner') == '') {
             $datacorrectness = false;
             $view->assign('status', 'warning_2');
             $view->assign('statusMsg', 'Bitte geben Sie alle benötigten Daten ein!');
         } elseif ($request->getParameter('groupname') != '' and $request->getParameter('groupname') != $sessionRegistry->get('activeGroup') and $registry->get('ldapAccess')->groupExists($request->getParameter('groupname'), $sessionRegistry->get('school'), $sessionRegistry->get('district')) == true) {
             $datacorrectness = false;
             $view->assign('status', 'warning_2');
             $view->assign('statusMsg', 'Dieser Gruppenname existiert bereits. Bitte w&auml;hlen Sie einen anderen Namen!');
         } elseif ($request->getParameter('owner') != '' and $registry->get('ldapAccess')->ultimate_userExists($request->getParameter('owner')) == false) {
             $datacorrectness = false;
             $view->assign('status', 'warning_2');
             $view->assign('statusMsg', 'Der als Besitzer angegebene Benutzername existiert nicht!');
         } elseif ($request->getParameter('parent') == $sessionRegistry->get('activeGroup')) {
             $datacorrectness = false;
             $view->assign('status', 'warning_2');
             $view->assign('statusMsg', 'Eine Gruppe kann nicht sich selbst als Elterngruppe haben!');
         } elseif ($request->getParameter('parent') != $registry->get('ldapAccess')->getParentGroupname($sessionRegistry->get('activeGroup')) and $registry->get('ldapAccess')->hasSubgroups($sessionRegistry->get('activeGroup'))) {
             $datacorrectness = false;
             $view->assign('status', 'warning_2');
             $view->assign('statusMsg', 'Diese Gruppe besitzt noch Untergruppen, und kann daher keiner neuen Elterngruppe zugeordnet werden!');
         }
         /*
         // falls die gruppe umbenannt wurde, auf steam-seite aktualisieren
         if($datacorrectness AND $request->getParameter('groupname') != $sessionRegistry->get('activeGroup')){
         	
         	$groupDN_new = str_replace('cn='.$sessionRegistry->get('activeGroup'), 'cn='.$request->getParameter('groupname') ,$registry->get('ldapAccess')->getGroupDN_2($sessionRegistry->get('activeGroup')));
         	$groupDN_old = $registry->get('ldapAccess')->getGroupDN_2($sessionRegistry->get('activeGroup'));
         	
         	// verbindung zu steam aufbauen
         	$steamConnector = new steam_connector('localhost', 1900, 'root', 'h6518_W#');
         	
         	// neuen steam-namen der gruppe ermitteln
         	$ldap_module = $steamConnector->get_server_module('persistence:ldap');					
         	$steam_groupname_new = $steamConnector->predefined_command($ldap_module, 'dn_to_group_name', $groupDN_new, 0);
         	$steam_groupname_old = $steamConnector->predefined_command($ldap_module, 'dn_to_group_name', $groupDN_old, 0);
         	
         	echo 'alter steam_name: '.$steam_groupname_old.'<br>';
         	echo 'neuer steam_name: '.$request->getParameter('groupname').'<br>';
         	
         	$steamGroup = steam_factory::get_group($steamConnector, $steam_groupname_old, 0);
         	echo $steamGroup->set_name($request->getParameter('groupname'), 0);
         }
         */
         if ($datacorrectness) {
             $data = array();
             $data['groupname'] = $request->getParameter('groupname');
             $data['owner'] = $request->getParameter('owner');
             $data['description'] = $request->getParameter('description');
             $data['parent'] = $request->getParameter('parent');
             $done = $registry->get('ldapAccess')->setGroupInformation($sessionRegistry->get('activeGroup'), $data);
             if ($done === true) {
                 $view->assign('status', 'ok_2');
                 $view->assign('statusMsg', 'Die Daten wurden ge&auml;ndert!');
             } else {
                 $view->assign('status', 'warning_2');
                 $view->assign('statusMsg', 'Systemfehler: LDAP-Kommando fehlgeschlagen!');
             }
         }
     }
     if ($request->issetParameter('performAction')) {
         if ($request->issetParameter('actionSelect')) {
             // Benutzeraktion: Benutzer aus Gruppe entfernen.
             if ($request->getParameter('actionSelect') == 'remove') {
                 $unremovedUser = array();
                 $groupDN = $registry->get('ldapAccess')->getGroupDN_2($sessionRegistry->get('activeGroup'));
                 $steamConnector = new steam_connector('localhost', 1900, 'root', 'h6518_W#');
                 $ldapModule = $steamConnector->get_server_module('persistence:ldap');
                 $steam_groupname = $steamConnector->predefined_command($ldapModule, 'dn_to_group_name', $groupDN, 0);
                 $steamGroup = steam_factory::get_group($steamConnector, $steam_groupname, 0);
                 for ($i = 1; $i <= $maxParameterIndex; $i++) {
                     if ($request->issetParameter('name' . $i)) {
                         $done = $registry->get('ldapAccess')->unsetUserData($request->getParameter('name' . $i), 'membership', $sessionRegistry->get('activeGroup'));
                         if ($done == false) {
                             $unremovedUser[] = $request->getParameter('name' . $i);
                         } else {
                             $user = steam_factory::get_user($steamConnector, $request->getParameter('name' . $i));
                             $steamGroup->remove_member($user, 0);
                         }
                     }
                 }
                 $steamConnector->disconnect();
                 if (count($unremovedUser) === 0) {
                     $view->assign('status', 'ok');
                     $view->assign('statusMsg', 'Alle markierten Benutzer wurden aus dieser Gruppe entfernt!');
                 } else {
                     $statusMsg = 'Folgende Benutzer konnten nicht aus der Gruppe entfernt werden:<ul>';
                     foreach ($unremovedUser as $uid) {
                         $statusMsg .= '<li>' . $uid;
                     }
                     $statusMsg .= '</ul>Die &uuml;brigen der markierten Benutzer wurden aus dieser Gruppe entfernt!';
                     $view->assign('status', 'warning');
                     $view->assign('statusMsg', $statusMsg);
                 }
             } elseif ($request->getParameter('actionSelect') == 'add') {
                 $unaddedUser = array();
                 $groupDN = $registry->get('ldapAccess')->getGroupDN_2($request->getParameter('targetGroup'));
                 $steamConnector = new steam_connector('localhost', 1900, 'root', 'h6518_W#');
                 $ldapModule = $steamConnector->get_server_module('persistence:ldap');
                 $steam_groupname = $steamConnector->predefined_command($ldapModule, 'dn_to_group_name', $groupDN, 0);
                 $steamGroup = steam_factory::get_group($steamConnector, $steam_groupname, 0);
                 for ($i = 1; $i <= $maxParameterIndex; $i++) {
                     if ($request->issetParameter('name' . $i)) {
                         if ($request->issetParameter('targetGroup')) {
                             $done = $registry->get('ldapAccess')->setUserData($request->getParameter('name' . $i), 'membership', $request->getParameter('targetGroup'));
                             if ($done == false) {
                                 $unaddedUser[] = $request->getParameter('name' . $i);
                             } else {
                                 $user = steam_factory::get_user($steamConnector, $request->getParameter('name' . $i));
                                 $steamGroup->add_member($user, 0);
                             }
                         }
                     }
                 }
                 $steamConnector->disconnect();
                 if (count($unaddedUser) === 0) {
                     $view->assign('status', 'ok');
                     $view->assign('statusMsg', 'Alle markierten Benutzer wurden der Gruppe "' . $request->getParameter('targetGroup') . '" hinzugef&uuml;gt!');
                 } else {
                     $statusMsg = 'Folgende Benutzer konnten der Gruppe "' . $request->getParameter('targetGroup') . '" nicht hinzugef&uuml;gt werden:<ul>';
                     foreach ($unaddedUser as $uid) {
                         $statusMsg .= '<li>' . $uid;
                     }
                     $statusMsg .= '</ul>';
                     $view->assign('status', 'warning');
                     $view->assign('statusMsg', $statusMsg);
                 }
             } elseif ($request->getParameter('actionSelect') == 'move') {
                 $unmovedUser = array();
                 $groupDN_old = $registry->get('ldapAccess')->getGroupDN_2($sessionRegistry->get('activeGroup'));
                 $groupDN_new = $registry->get('ldapAccess')->getGroupDN_2($request->getParameter('targetGroup'));
                 $steamConnector = new steam_connector('localhost', 1900, 'root', 'h6518_W#');
                 $ldapModule = $steamConnector->get_server_module('persistence:ldap');
                 $steam_groupname_old = $steamConnector->predefined_command($ldapModule, 'dn_to_group_name', $groupDN_old, 0);
                 $steam_groupname_new = $steamConnector->predefined_command($ldapModule, 'dn_to_group_name', $groupDN_new, 0);
                 $steamGroup_old = steam_factory::get_group($steamConnector, $steam_groupname_old, 0);
                 $steamGroup_new = steam_factory::get_group($steamConnector, $steam_groupname_new, 0);
                 for ($i = 1; $i <= $maxParameterIndex; $i++) {
                     if ($request->issetParameter('name' . $i)) {
                         if ($sessionRegistry->get('activeGroup') != 'Gruppenlos') {
                             $done = $registry->get('ldapAccess')->unsetUserData($request->getParameter('name' . $i), 'membership', $sessionRegistry->get('activeGroup'));
                         }
                         $done2 = $registry->get('ldapAccess')->setUserData($request->getParameter('name' . $i), 'membership', $request->getParameter('targetGroup'));
                         if ($done == false or $done2 == false) {
                             $unremovedUser[] = $request->getParameter('name' . $i);
                         } else {
                             $user = steam_factory::get_user($steamConnector, $request->getParameter('name' . $i));
                             $steamGroup_old->remove_member($user, 0);
                             $steamGroup_new->add_member($user, 0);
                         }
                     }
                 }
                 if (count($unmovedUser) === 0) {
                     $view->assign('status', 'ok');
                     $view->assign('statusMsg', 'Alle markierten Benutzer wurden in die Gruppe "' . $request->getParameter('targetGroup') . '" verschoben!');
                 } else {
                     $statusMsg = 'Folgende Benutzer konnten nicht in die Gruppe verschoben werden:<ul>';
                     foreach ($unremovedUser as $uid) {
                         $statusMsg .= '<li>' . $uid;
                     }
                     $statusMsg .= '</ul>Die &uuml;brigen der markierten Benutzer wurden verschoben!';
                     $view->assign('status', 'warning');
                     $view->assign('statusMsg', $statusMsg);
                 }
             }
         }
     }
     // Template-Variablen Werte zuweisen.
     $view->assign('accessLevel', $sessionRegistry->get('accessLevel'));
     $view->assign('groupList', $registry->get('ldapAccess')->getGroupsDN());
     $view->assign('groupList2', $registry->get('ldapAccess')->getGroupsDN());
     $view->assign('targetGroupList', $registry->get('ldapAccess')->getGroupsDN());
     if ($request->issetParameter('groupSelect')) {
         $view->assign('groupSelect', $request->getParameter('groupSelect'));
     }
     if ($sessionRegistry->get('activeGroup') != null and $sessionRegistry->get('activeGroup') != '') {
         $view->assign('groupdata', $registry->get('ldapAccess')->getGroupInformation($sessionRegistry->get('activeGroup')));
         if ($sessionRegistry->get('activeGroup') == 'Gruppenlos') {
             $memberlist = array();
             //$memberlist = $registry->get('ldapAccess')->search('', $sessionRegistry->get('activeGroup'));
             $memberlist = $registry->get('ldapAccess')->getGroupMembers('Gruppenlos');
             $sessionRegistry->set('maxParameterIndex', count($memberlist) + 1);
             $view->assign('memberlist', $memberlist);
         } else {
             $memberlist = array();
             $memberlist = $registry->get('ldapAccess')->getGroupMembers($sessionRegistry->get('activeGroup'));
             $sessionRegistry->set('maxParameterIndex', count($memberlist) + 1);
             $view->assign('memberlist', $memberlist);
         }
         if (!$request->issetParameter('chooseGroup')) {
             $view->assign('groupSelect', $sessionRegistry->get('activeGroup'));
         }
     }
     // Ausgabe erzeugen
     $view->render($request, $response);
 }
 public function execute(Request $request, Response $response)
 {
     $sessionRegistry = SessionRegistry::getInstance();
     $registry = Registry::getInstance();
     $view = new TemplateView('changeUserdata');
     // Template-Variablen Werte zuwesien
     $view->assign('accessLevel', $sessionRegistry->get('accessLevel'));
     $view->assign('groupList', $registry->get('ldapAccess')->getGroupsDN());
     // Benutzeraktion: Benutzerdaten ändern.
     if ($request->issetParameter('changeData')) {
         // Eigegebene Daten auf Korrektheit überprüfen
         $datacorrectness = true;
         if ($request->getParameter('givenname') == '') {
             $datacorrectness = false;
             $view->assign('status', 'warning');
             $view->assign('statusMsg', 'Bitte einen Vornamen eingeben!');
         }
         if ($request->getParameter('surname') == '') {
             $datacorrectness = false;
             $view->assign('status', 'warning');
             $view->assign('statusMsg', 'Bitte einen Nachnamen eingeben!');
         }
         if ($datacorrectness) {
             $givenname = $request->getParameter('givenname');
             $surname = $request->getParameter('surname');
             $email = $request->getParameter('email');
             $role = $request->getParameter('role');
             $uid = $sessionRegistry->get('activeUser');
             $done = $registry->get('ldapAccess')->setUserInformation($uid, $givenname, $surname, $email, $role);
             if ($done) {
                 $view->assign('status', 'ok');
                 $view->assign('statusMsg', 'Die Daten wurden ge&auml;ndert!');
             } else {
                 $view->assign('status', 'warning');
                 $view->assign('statusMsg', 'Systemfehler: LDAP-Kommand fehlgeschlagen!');
             }
         }
     }
     // Benutzeraktion: Suche nach Benutzernamen starten.
     if ($request->issetParameter('userSearch')) {
         if ($request->issetParameter('namefilter') and $request->issetParameter('namefilter') != '') {
             $sessionRegistry->set('activeNamefilter', $request->getParameter('namefilter'));
         } else {
             $sessionRegistry->set('activeNamefilter', '*');
         }
         $sessionRegistry->set('activeGroup', $request->getParameter('groupSelect'));
     }
     if ($sessionRegistry->get('activeGroup') != null) {
         $view->assign('namefilter', $sessionRegistry->get('activeNamefilter'));
         $view->assign('groupSelect', $sessionRegistry->get('activeGroup'));
         $view->assign('results', $registry->get('ldapAccess')->search($sessionRegistry->get('activeNamefilter'), $sessionRegistry->get('activeGroup')));
     }
     // Daten des gewählten Benutzers ermitteln
     if ($request->issetParameter('userSelect') or $sessionRegistry->get('activeUser') != null and $sessionRegistry->get('activeUser') != '') {
         if ($request->issetParameter('userSelect')) {
             $sessionRegistry->set('activeUser', $request->getParameter('userSelect'));
         }
         $view->assign('userSelect', $sessionRegistry->get('activeUser'));
         $view->assign('userdata', $registry->get('ldapAccess')->getUserInformation($sessionRegistry->get('activeUser')));
     }
     // Ausgabe erzeugen.
     $view->render($request, $response);
 }
Пример #30
0
 public function init_pcs_stylesheet()
 {
     $code = SessionRegistry::instance()->getStyleCode();
     if (in_array($code, array('prospective', 'current', 'staff'))) {
         $this->pcs_stylesheet = "<link rel='stylesheet' type='text/css'\n\t\t\t\thref='/css/{$code}.css' />\n";
     } else {
         $this->pcs_stylesheet = '';
     }
 }