diff --git a/phpgwapi/inc/class.accounts_ldap.inc.php b/phpgwapi/inc/class.accounts_ldap.inc.php index 8e7a2f2f20..d13f246298 100644 --- a/phpgwapi/inc/class.accounts_ldap.inc.php +++ b/phpgwapi/inc/class.accounts_ldap.inc.php @@ -756,7 +756,7 @@ $entry['homedirectory'] = $account_info['homedirectory'] && $account_info['homedirectory'] != $GLOBALS['phpgw_info']['server']['ldap_account_home'] ? $account_info['homedirectory'] : $GLOBALS['phpgw_info']['server']['ldap_account_home'].SEP.$account_info['account_lid']; $entry['loginshell'] = $account_info['loginshell'] ? $account_info['loginshell'] : $GLOBALS['phpgw_info']['server']['ldap_account_shell']; } - else + elseif($account_info['account_type'] != 'g') { $entry['homedirectory'] = '/home/'.$account_info['account_lid']; $entry['loginshell'] = '/bin/false'; @@ -858,7 +858,7 @@ $entry['phpgwaccountexpires'] = $account_info['account_expires']; } - #_debug_array($entry);exit; + #_debug_array($entry); ldap_add($this->ds, $dn, $entry); } diff --git a/phpgwapi/inc/class.auth_ldap.inc.php b/phpgwapi/inc/class.auth_ldap.inc.php index 31c9afc060..a3e769629d 100644 --- a/phpgwapi/inc/class.auth_ldap.inc.php +++ b/phpgwapi/inc/class.auth_ldap.inc.php @@ -43,6 +43,11 @@ return False; } + if($GLOBALS['phpgw_info']['server']['ldap_version3']) + { + ldap_set_option($ldap, LDAP_OPT_PROTOCOL_VERSION, 3); + } + /* Login with the LDAP Admin. User to find the User DN. */ if(!@ldap_bind($ldap, $GLOBALS['phpgw_info']['server']['ldap_root_dn'], $GLOBALS['phpgw_info']['server']['ldap_root_pw'])) { diff --git a/setup/setup_demo.php b/setup/setup_demo.php index fbfe70429e..37bf415850 100644 --- a/setup/setup_demo.php +++ b/setup/setup_demo.php @@ -31,15 +31,33 @@ function add_account($username,$first,$last,$passwd,$type='u') { - $account_info = array( - 'account_type' => $type, - 'account_lid' => $username, - 'account_passwd' => $passwd, - 'account_firstname' => $first, - 'account_lastname' => $last, - 'account_status' => 'A', - 'account_expires' => -1 - ); + if($type == 'u') + { + $account_info = array( + 'account_type' => $type, + 'account_lid' => $username, + 'account_passwd' => $passwd, + 'account_firstname' => $first, + 'account_lastname' => $last, + 'account_status' => 'A', + 'account_primary_group' => $GLOBALS['phpgw']->accounts->name2id('default'), + 'account_groups' => array($GLOBALS['phpgw']->accounts->name2id('default')), + 'account_expires' => -1 + ); + } + else + { + $account_info = array( + 'account_type' => $type, + 'account_lid' => $username, + 'account_passwd' => $passwd, + 'account_firstname' => $first, + 'account_lastname' => $last, + 'account_status' => 'A', + 'account_expires' => -1 + ); + } + $GLOBALS['phpgw']->accounts->create($account_info); return $GLOBALS['phpgw']->accounts->name2id($username); @@ -101,21 +119,26 @@ $GLOBALS['phpgw_setup']->loaddb(); /* Load up some configured values */ - $GLOBALS['phpgw_setup']->db->query("SELECT config_name,config_value FROM phpgw_config WHERE config_name LIKE 'ldap%' OR config_name='account_repository'",__LINE__,__FILE__); + $GLOBALS['phpgw_setup']->db->query("SELECT config_name,config_value FROM phpgw_config ". + "WHERE config_name LIKE 'ldap%' OR config_name LIKE 'account_%'",__LINE__,__FILE__); while ($GLOBALS['phpgw_setup']->db->next_record()) { $config[$GLOBALS['phpgw_setup']->db->f('config_name')] = $GLOBALS['phpgw_setup']->db->f('config_value'); } - $GLOBALS['phpgw_info']['server']['ldap_host'] = $config['ldap_host']; - $GLOBALS['phpgw_info']['server']['ldap_context'] = $config['ldap_context']; - $GLOBALS['phpgw_info']['server']['ldap_group_context'] = $config['ldap_group_context']; - $GLOBALS['phpgw_info']['server']['ldap_root_dn'] = $config['ldap_root_dn']; - $GLOBALS['phpgw_info']['server']['ldap_root_pw'] = $config['ldap_root_pw']; + $GLOBALS['phpgw_info']['server']['ldap_host'] = $config['ldap_host']; + $GLOBALS['phpgw_info']['server']['ldap_context'] = $config['ldap_context']; + $GLOBALS['phpgw_info']['server']['ldap_group_context'] = $config['ldap_group_context']; + $GLOBALS['phpgw_info']['server']['ldap_root_dn'] = $config['ldap_root_dn']; + $GLOBALS['phpgw_info']['server']['ldap_root_pw'] = $config['ldap_root_pw']; $GLOBALS['phpgw_info']['server']['ldap_extra_attributes'] = $config['ldap_extra_attributes']; - $GLOBALS['phpgw_info']['server']['ldap_account_home'] = $config['ldap_account_home']; - $GLOBALS['phpgw_info']['server']['ldap_account_shell'] = $config['ldap_account_shell']; + $GLOBALS['phpgw_info']['server']['ldap_account_home'] = $config['ldap_account_home']; + $GLOBALS['phpgw_info']['server']['ldap_account_shell'] = $config['ldap_account_shell']; $GLOBALS['phpgw_info']['server']['ldap_encryption_type'] = $config['ldap_encryption_type']; - $GLOBALS['phpgw_info']['server']['account_repository'] = $config['account_repository']; + $GLOBALS['phpgw_info']['server']['account_repository'] = $config['account_repository']; + $GLOBALS['phpgw_info']['server']['ldap_version3'] = $config['ldap_version3']; + $GLOBALS['phpgw_info']['server']['account_min_id'] = $config['account_min_id']; + $GLOBALS['phpgw_info']['server']['account_max_id'] = $config['account_max_id']; + unset($config); /* Create dummy class, then accounts object */