ldap fixes

This commit is contained in:
Lars Kneschke 2003-09-14 14:35:36 +00:00
parent 19984a1a82
commit bfb56ec1de
3 changed files with 48 additions and 20 deletions

View File

@ -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);
}

View File

@ -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']))
{

View File

@ -30,6 +30,22 @@
}
function add_account($username,$first,$last,$passwd,$type='u')
{
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,
@ -40,6 +56,8 @@
'account_status' => 'A',
'account_expires' => -1
);
}
$GLOBALS['phpgw']->accounts->create($account_info);
return $GLOBALS['phpgw']->accounts->name2id($username);
@ -101,7 +119,8 @@
$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');
@ -116,6 +135,10 @@
$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']['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 */