extended the check for (admin-)accounts to other account storages

This commit is contained in:
Ralf Becker 2005-10-15 07:57:06 +00:00
parent aac9ec7d10
commit 021d72b93e
2 changed files with 44 additions and 15 deletions

View File

@ -293,20 +293,19 @@
return False;
}
/**
* check if username and password is valid
*
* this function compares the supplied and stored username and password
/**
* check if username and password is valid
*
* this function compares the supplied and stored username and password
* as any of the passwords can be clear text or md5 we convert them to md5
* internal and compare always the md5 hashs
*
* @param string $user the user supplied username
* @param string $pw the user supplied password
* @param string $conf_user the configured username
* @param string $conf_pw the configured password
* @returns bool
*/
*
* @param string $user the user supplied username
* @param string $pw the user supplied password
* @param string $conf_user the configured username
* @param string $conf_pw the configured password
* @returns bool
*/
function check_auth($user,$pw,$conf_user,$conf_pw)
{
#echo "<p>setup::check_auth('$user','$pw','$conf_user','$conf_pw')</p>\n";exit;
@ -947,6 +946,38 @@
return $accountid;
}
/**
* Check if accounts other then the automatically installed anonymous account exist
*
* We check via the account object, to deal with different account-storages
*
* @return boolean
*/
function accounts_exist()
{
$this->setup_account_object();
$accounts = $GLOBALS['egw']->accounts->search(array(
'type' => 'accounts',
'start' => 0,
'offset' => 2, // we only need to check 2 accounts, if we just check for not anonymous
));
if (!$accounts || !is_array($accounts) || !count($accounts))
{
return false;
}
foreach($accounts as $account)
{
if ($account['account_lid'] != 'anonymous')
{
// we might add further checks, eg. if the account really has admin rights here
return true;
}
}
return false;
}
/**
* Add ACL rights
*

View File

@ -512,9 +512,7 @@ function check_dir($dir,&$msg,$check_in_docroot=false)
{
case 10:
// check if there is already a user account (not the anonymous account of sitemgr or a group)
// Note: this does not check the availiblitly of accounts via other auth-methods then sql !!!
$GLOBALS['egw_setup']->db->query("SELECT count(*) FROM phpgw_accounts WHERE account_type='u' AND account_lid!='anonymous'",__LINE__,__FILE__);
$no_accounts = !$GLOBALS['egw_setup']->db->next_record() || !$GLOBALS['egw_setup']->db->f(0);
$no_accounts = !$GLOBALS['egw_setup']->accounts_exist();
$setup_tpl->set_var('admin_status_img',$no_accounts ? $incomplete : $completed);
$setup_tpl->set_var('admin_status_alt',$no_accounts ? lang('not completed') : lang('completed'));
$setup_tpl->set_var('admin_table_data',$GLOBALS['egw_setup']->html->make_frm_btn_simple(