From 6f6415fdc58c525a04beb56e6db1dd298158f161 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Wed, 19 May 2010 09:13:23 +0000 Subject: [PATCH] "store if super user authentifications is done via setup config user or a vfs root user from setup >> configuration with his regular password" --- filemanager/inc/class.filemanager_ui.inc.php | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/filemanager/inc/class.filemanager_ui.inc.php b/filemanager/inc/class.filemanager_ui.inc.php index 3d3b084c25..cc5a758506 100644 --- a/filemanager/inc/class.filemanager_ui.inc.php +++ b/filemanager/inc/class.filemanager_ui.inc.php @@ -50,21 +50,26 @@ class filemanager_ui * * @param string $user='' setup config user to become root or '' to log off as root * @param string $password=null setup config password to become root + * @param boolean &$is_setup=null on return true if authenticated user is setup config user, false otherwise + * @return boolean true is root user given, false otherwise (including logout / empty $user) */ - protected function sudo($user='',$password=null) + protected function sudo($user='',$password=null,&$is_setup=null) { if (!$user) { - $is_root = false; + $is_root = $is_setup = false; } else { - $is_root = egw_session::user_pw_hash($user,$password) === $GLOBALS['egw_info']['server']['config_hash'] || // config user&password - $GLOBALS['egw_info']['server']['vfs_root_user'] && // vfs root user from setup >> configuration - in_array($user,split(', *',$GLOBALS['egw_info']['server']['vfs_root_user'])) && + // config user & password + $is_setup = egw_session::user_pw_hash($user,$password) === $GLOBALS['egw_info']['server']['config_hash']; + // or vfs root user from setup >> configuration + $is_root = $is_setup || $GLOBALS['egw_info']['server']['vfs_root_user'] && + in_array($user,preg_split('/, */',$GLOBALS['egw_info']['server']['vfs_root_user'])) && $GLOBALS['egw']->auth->authenticate($user, $password, 'text'); } - //echo "

".__METHOD__."('$user','$password') user_pw_hash(...)='".egw_session::user_pw_hash($user,$password)."', config_hash='{$GLOBALS['egw_info']['server']['config_hash']}' --> returning ".array2string($is_root)."

\n"; + //echo "

".__METHOD__."('$user','$password',$is_setup) user_pw_hash(...)='".egw_session::user_pw_hash($user,$password)."', config_hash='{$GLOBALS['egw_info']['server']['config_hash']}' --> returning ".array2string($is_root)."

\n"; + egw_session::appsession('is_setup','filemanager',$is_setup); return egw_session::appsession('is_root','filemanager',egw_vfs::$is_root = $is_root); }