* SiteMgr: fixed not working anonymous user and using now a random password

This commit is contained in:
Ralf Becker 2013-10-15 09:25:23 +00:00
parent 80c633cc14
commit 10a7d6a7a6
2 changed files with 15 additions and 1 deletions

View File

@ -998,6 +998,12 @@ class setup
return true;
}
/**
* Used to store and share password of user "anonymous" between calls to add_account from different app installs
* @var unknown
*/
protected $anonpw;
/**
* add an user account or a user group
*
@ -1010,14 +1016,21 @@ class setup
* @param string/boolean $primary_group Groupname for users primary group or False for a group, default 'Default'
* @param boolean $changepw user has right to change pw, default False = Pw change NOT allowed
* @param string $email
* @param string &$anonpw=null on return password for anonymous user
* @return int the numerical user-id
*/
function add_account($username,$first,$last,$passwd,$primary_group='Default',$changepw=False,$email='')
function add_account($username,$first,$last,$passwd,$primary_group='Default',$changepw=False,$email='',&$anonpw=null)
{
$this->setup_account_object();
$primary_group_id = $primary_group ? $this->accounts->name2id($primary_group) : False;
if ($username == 'anonymous')
{
if (!isset($this->anonpw)) $this->anonpw = auth::randomstring(16);
$passwd = $anonpw = $this->anonpw;
}
if(!($accountid = $this->accounts->name2id($username)))
{
$account = array(

View File

@ -288,6 +288,7 @@ class setup_process
}
// so the default_records use the current data
$GLOBALS['egw_info']['server'] = array_merge((array)$GLOBALS['egw_info']['server'], $current_config);
$GLOBALS['egw_setup']->setup_account_object($current_config);
}