ldap fixes

This commit is contained in:
Lars Kneschke 2003-09-21 19:02:12 +00:00
parent 90331f1b45
commit 2a4b75c483
2 changed files with 40 additions and 31 deletions

View File

@ -853,6 +853,7 @@
$entry['objectclass'][4] = 'posixAccount';
$entry['objectclass'][5] = 'shadowAccount';
$entry['objectclass'][6] = 'phpgwAccount';
if($account_info['account_status'])
$entry['phpgwaccountstatus'] = $account_info['account_status'];
$entry['phpgwaccounttype'] = $account_info['account_type'];
$entry['phpgwaccountexpires'] = $account_info['account_expires'];
@ -860,7 +861,11 @@
#_debug_array($entry);
ldap_add($this->ds, $dn, $entry);
// stop processing if ldap_add fails
if(!ldap_add($this->ds, $dn, $entry))
{
return false;
}
}
// print ldap_error($this->ds);
@ -903,10 +908,12 @@
}
}
}
if($account_id && is_object($GLOBALS['phpgw']->preferences) && $default_prefs)
{
$GLOBALS['phpgw']->preferences->create_defaults($account_id);
}
return $account_id;
}

View File

@ -1,10 +1,11 @@
<?php
/**************************************************************************\
* phpGroupWare API - Auth from LDAP *
* This file written by Lars Kneschke <kneschke@phpgroupware.org> *
* This file written by Lars Kneschke <lkneschke@linux-at-work.de> *
* and Joseph Engo <jengo@phpgroupware.org> *
* Authentication based on LDAP Server *
* Copyright (C) 2000, 2001 Joseph Engo *
* Copyright (C) 2002, 2003 Lars Kneschke *
* -------------------------------------------------------------------------*
* This library is part of the phpGroupWare API *
* http://www.phpgroupware.org/api *
@ -55,7 +56,8 @@
}
/* find the dn for this uid, the uid is not always in the dn */
$attributes = array( "uid", "dn" );
$sri = ldap_search($ldap, $GLOBALS['phpgw_info']['server']['ldap_context'], "(uid=$username)", $attributes);
$filter = "(&(uid=$username)(phpgwaccountstatus=A))";
$sri = ldap_search($ldap, $GLOBALS['phpgw_info']['server']['ldap_context'], $filter, $attributes);
$allValues = ldap_get_entries($ldap, $sri);
if ($allValues['count'] > 0)
{