openrat-cms

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit 0980fb346646b5453bbffe408a36364e805fcb3a
parent 090ecd0e73b5c3b8f3c69b96a9f22cc49b9d4e3e
Author: Jan Dankert <devnull@localhost>
Date:   Wed,  7 Nov 2012 11:20:36 +0100

Auto-Login in IndexAction aktivieren.

Diffstat:
action/IndexAction.class.php | 56+++++++++++++++++++++++++++++++++++++++++++++++++++++---
action/WorkbenchAction.class.php | 13++-----------
dispatcher.php | 3++-
themes/default/layout/perspective/administration.ini.php | 4+---
4 files changed, 58 insertions(+), 18 deletions(-)

diff --git a/action/IndexAction.class.php b/action/IndexAction.class.php @@ -24,12 +24,16 @@ class IndexAction extends Action { public $security = SECURITY_GUEST; + + + private $perspective; /** * Konstruktor */ function IndexAction() { + $this->perspective = Session::get('perspective'); } @@ -37,14 +41,60 @@ class IndexAction extends Action { global $conf; + // Schauen, ob eine Perspektive existiert. + if ( empty($this->perspective) ) + { + // Da keine Perspektive existiert, handelt es sich wohl um den + // ersten Aufruf in dieser Sitzung. + + // Versuchen, einen Benutzernamen zu ermitteln, der im Eingabeformular vorausgewählt wird. + $modules = explode(',',$conf['security']['modules']['autologin']); + + $username = ''; + foreach( $modules as $module) + { + Logger::debug('Auto-Login module: '.$module); + $moduleClass = $module.'Auth'; + $auth = new $moduleClass; + $username = $auth->username(); + + if ( !empty($username) ) + { + Logger::debug('Auto-Login for User '.$username); + break; // Benutzername gefunden. + } + } + + if ( !empty( $username ) ) + { + try + { + $user = User::loadWithName( $username ); + Session::setUser($user); + Logger::info('auto-login for user '.$username); + } + catch( ObjectNotFoundException $e ) + { + Logger::warn('Username for autologin does not exist: '.$username); + $this->setPerspective('start'); + } + } + else + { + // Kein Auto-Login moeglich, die Anmeldemaske anzeigen. + $this->setPerspective('login'); + } + } + + // Theme für den angemeldeten Benuter ermitteln, dieser wird für + // den Link auf die CSS-Datei benoetigt. $user = Session::getUser(); if ( is_object($user) ) $style = $user->style; else $style = 'default'; - - - + + // HTML-Datei direkt einbinden. require('themes/default/layout/index.php'); exit; } diff --git a/action/WorkbenchAction.class.php b/action/WorkbenchAction.class.php @@ -31,17 +31,6 @@ class WorkbenchAction extends Action { global $conf; global $preselectedobjects; - if ( empty($this->perspective) ) - { - $guestConf = $conf['security']['guest']; - - if ( $guestConf['enable'] ) - $this->perspective = 'start'; - else - $this->perspective = 'login'; - - Session::set('perspective',$this->perspective); - } $preselectedobjects = array();; @@ -70,6 +59,8 @@ class WorkbenchAction extends Action } global $viewconfig; + + Logger::debug('Workbench is using perspektive: '.$this->perspective); $viewconfig = parse_ini_file('themes/default/layout/perspective/'.$this->perspective.'.ini.php',true); require_once('themes/default/layout/perspective/window.php'); diff --git a/dispatcher.php b/dispatcher.php @@ -222,7 +222,8 @@ else // GET-Request => ...View() wird aufgerufen. $subactionMethodName = $subaction.'View'; // Daten werden nur angezeigt, die Sitzung kann also schon geschlossen werden. - Session::close(); + if ( $action != 'index' ) // In Index wird die Perspektive manipuliert. + Session::close(); } Logger::debug("Executing $actionClassName::$subactionMethodName"); diff --git a/themes/default/layout/perspective/administration.ini.php b/themes/default/layout/perspective/administration.ini.php @@ -1,7 +1,5 @@ <?php ?> -icons=projectlist,userlist,grouplist,configuration - [tree] views=tree @@ -20,7 +18,7 @@ default=edit [side] -views=memberships,info +views=memberships action=project refreshable=true default=memberships