mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-23 16:33:17 +01:00
setup_cmd_admin execs "admin/admin-cli.php --edit-user" to run all hooks, which can NOT run in setup
This commit is contained in:
parent
d7f1dc32b3
commit
ba1b0762bd
@ -1053,14 +1053,28 @@ class setup
|
||||
error_log("setup::add_account('$username','$first','$last',\$passwd,'$primary_group',$changepw,'$email') failed! accountid=$accountid");
|
||||
return false;
|
||||
}
|
||||
// call add{account|group} hook to create the vfs-home-dirs
|
||||
// call vfs_home_hooks::add{account|group} hook to create the vfs-home-dirs
|
||||
// calling general add{account|group} hook fails, as we are only in setup
|
||||
// --> setup_cmd_admin execs "admin/admin-cli.php --edit-user" to run them
|
||||
if ($primary_group)
|
||||
{
|
||||
vfs_home_hooks::addAccount($account);
|
||||
/*
|
||||
$GLOBALS['hook_values'] = $account + array('new_passwd' => $account['account_passwd']);
|
||||
$GLOBALS['egw']->hooks->process($GLOBALS['hook_values']+array(
|
||||
'location' => 'addaccount'
|
||||
),False,True); // called for every app now, not only enabled ones
|
||||
*/
|
||||
}
|
||||
else
|
||||
{
|
||||
vfs_home_hooks::addGroup($account+array('account_name' => $account['account_lid']));
|
||||
/*
|
||||
$GLOBALS['hook_values'] = $account+(array('account_name' => $account['account_lid']));
|
||||
$GLOBALS['egw']->hooks->process($GLOBALS['hook_values']+array(
|
||||
'location' => 'addgroup'
|
||||
),False,True); // called for every app now, not only enabled ones)
|
||||
*/
|
||||
}
|
||||
}
|
||||
if ($primary_group) // only for users, NOT groups
|
||||
|
@ -5,7 +5,7 @@
|
||||
* @link http://www.egroupware.org
|
||||
* @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
||||
* @package setup
|
||||
* @copyright (c) 2007 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
||||
* @copyright (c) 2007-10 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
* @version $Id$
|
||||
*/
|
||||
@ -76,7 +76,12 @@ class setup_cmd_admin extends setup_cmd
|
||||
|
||||
if (!$this->admin_firstname) $this->set_defaults['admin_firstname'] = $this->admin_firstname = lang('Admin');
|
||||
if (!$this->admin_lastname) $this->set_defaults['admin_lastname'] = $this->admin_lastname = lang('User');
|
||||
|
||||
if (strpos($this->admin_email,'$') !== false)
|
||||
{
|
||||
$this->set_defaults['email'] = $this->admin_email = str_replace(
|
||||
array('$domain','$uid','$account_lid'),
|
||||
array($this->domain,$this->admin_user,$this->admin_user),$this->admin_email);
|
||||
}
|
||||
$_POST['username'] = $this->admin_user;
|
||||
$_POST['passwd2'] = $_POST['passwd'] = $this->admin_password;
|
||||
$_POST['fname'] = $this->admin_firstname;
|
||||
@ -97,7 +102,18 @@ class setup_cmd_admin extends setup_cmd
|
||||
throw new egw_exception_wrong_userinput(lang('Error in group-creation !!!'),42);
|
||||
}
|
||||
$this->restore_db();
|
||||
|
||||
|
||||
// run admin/admin-cli.php --edit-user to store the new accounts once in EGroupware
|
||||
// to run all hooks (some of them can NOT run inside setup)
|
||||
$cmd = EGW_SERVER_ROOT.'/admin/admin-cli.php --edit-user '.
|
||||
escapeshellarg($this->admin_user.'@'.$this->domain.','.$this->admin_password.','.$this->admin_user);
|
||||
exec($cmd,$output,$ret);
|
||||
$output = implode("\n",$output);
|
||||
//echo "ret=$ret\n".$output;
|
||||
if ($ret)
|
||||
{
|
||||
throw new egw_exception ($output,$ret);
|
||||
}
|
||||
return lang('Admin account successful created.');
|
||||
}
|
||||
}
|
||||
|
@ -59,6 +59,13 @@ if(!defined('EGW_SERVER_ROOT') && !defined('EGW_INCLUDE_ROOT'))
|
||||
|
||||
require_once(EGW_INCLUDE_ROOT . '/phpgwapi/inc/common_functions.inc.php');
|
||||
|
||||
// check if eGW's pear repository is installed and prefer it over the regular one
|
||||
if (is_dir(EGW_SERVER_ROOT.'/egw-pear'))
|
||||
{
|
||||
set_include_path(EGW_SERVER_ROOT.'/egw-pear'.PATH_SEPARATOR.get_include_path());
|
||||
//echo "<p align=right>include_path='".get_include_path()."'</p>\n";
|
||||
}
|
||||
|
||||
define('SEP',filesystem_separator());
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user