mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-26 16:48:49 +01:00
Modify save and create to check for attrs, and added some users to the exclusion list.
This commit is contained in:
parent
3a38f4cf4c
commit
06957d529b
@ -37,6 +37,7 @@
|
||||
'sync' => True,
|
||||
'shutdown' => True,
|
||||
'halt' => True,
|
||||
'ldap' => True,
|
||||
'mail' => True,
|
||||
'news' => True,
|
||||
'uucp' => True,
|
||||
@ -48,9 +49,21 @@
|
||||
'pgsql' => True,
|
||||
'mysql' => True,
|
||||
'postgres' => True,
|
||||
'oracle' => True,
|
||||
'ftp' => True,
|
||||
'gdm' => True,
|
||||
'named' => True
|
||||
'named' => True,
|
||||
'alias' => True,
|
||||
'web' => True,
|
||||
'sweep' => True,
|
||||
'cvs' => True,
|
||||
'qmaild' => True,
|
||||
'qmaill' => True,
|
||||
'qmaillog' => True,
|
||||
'qmailp' => True,
|
||||
'qmailq' => True,
|
||||
'qmailr' => True,
|
||||
'qmails' => True
|
||||
);
|
||||
|
||||
class accounts_
|
||||
@ -117,8 +130,25 @@
|
||||
$entry["loginshell"] = $this->data["loginshell"];
|
||||
}
|
||||
|
||||
ldap_modify($ds, $allValues[0]["dn"], $entry);
|
||||
#print ldap_error($ds);
|
||||
while (list($key,$val) = each($entry))
|
||||
{
|
||||
$tmpentry = '';
|
||||
$tmpentry[$key] = trim($val); // must trim!
|
||||
//echo '<br>'.$key.' '.$val;
|
||||
if ($tmpentry[$key] && $key)
|
||||
{
|
||||
if (!$allValues[0][$key][0])
|
||||
{
|
||||
// attribute was not in LDAP, add it
|
||||
ldap_mod_add($ds, $allValues[0]["dn"], $tmpentry);
|
||||
}
|
||||
else
|
||||
{
|
||||
// attribute was in LDAP, modify it
|
||||
ldap_modify($ds, $allValues[0]["dn"], $tmpentry);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->db->query("update phpgw_accounts set account_firstname='" . $this->data['firstname']
|
||||
. "', account_lastname='" . $this->data['lastname'] . "', account_status='"
|
||||
@ -271,7 +301,7 @@
|
||||
if(gettype($account_lid) == 'integer')
|
||||
{
|
||||
$account_id = $account_lid;
|
||||
settype($acount_lid,'string');
|
||||
settype($account_lid,'string');
|
||||
$account_lid = $this->id2name($account_id);
|
||||
}
|
||||
|
||||
@ -336,7 +366,7 @@
|
||||
. "','" . $account_type . "','" . md5($account_pwd) . "', '" . $account_firstname
|
||||
. "','" . $account_lastname . "','" . $account_status . "')",__LINE__,__FILE__);
|
||||
|
||||
$sri = ldap_search($ds, $phpgw_info["server"]["ldap_context"], "uid=".$account_lid);
|
||||
$sri = ldap_search($ds, $phpgw_info["server"]["ldap_context"], "uid=$account_lid");
|
||||
$allValues = ldap_get_entries($ds, $sri);
|
||||
|
||||
$entry["uidnumber"] = $account_id;
|
||||
@ -346,11 +376,6 @@
|
||||
$entry["sn"] = $account_lastname;
|
||||
$entry["givenname"] = $account_firstname;
|
||||
$entry["userpassword"] = $phpgw->common->encrypt_password($account_pwd);
|
||||
$entry["objectclass"][0] = 'person';
|
||||
$entry["objectclass"][1] = 'organizationalPerson';
|
||||
$entry["objectclass"][2] = 'account';
|
||||
$entry["objectclass"][3] = 'posixAccount';
|
||||
$entry["objectclass"][4] = 'shadowAccount';
|
||||
|
||||
if ($phpgw_info["server"]["ldap_extra_attributes"] && $account_type != 'g') {
|
||||
if ($account_home)
|
||||
@ -375,9 +400,61 @@
|
||||
if ($allValues[0]["dn"]) {
|
||||
// This should keep the password from being overwritten here ?
|
||||
unset($entry["userpassword"]);
|
||||
ldap_modify($ds, $allValues[0]["dn"], $entry);
|
||||
|
||||
while (list($key,$val) = each($entry))
|
||||
{
|
||||
$tmpentry = '';
|
||||
$tmpentry[$key] = trim($val); // must trim!
|
||||
//echo '<br>'.$key.' '.$val;
|
||||
if ($tmpentry[$key])
|
||||
{
|
||||
if (!$allValues[0][$key][0])
|
||||
{
|
||||
// attribute was not in LDAP, add it
|
||||
ldap_mod_add($ds, $allValues[0]["dn"], $tmpentry);
|
||||
}
|
||||
else
|
||||
{
|
||||
// attribute was in LDAP, modify it
|
||||
ldap_modify($ds, $allValues[0]["dn"], $tmpentry);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($account_type == "g")
|
||||
{
|
||||
$tmpentry["objectclass"][0] = 'top';
|
||||
$tmpentry["objectclass"][1] = 'posixGroup';
|
||||
}
|
||||
else
|
||||
{
|
||||
$tmpentry["objectclass"][0] = 'top';
|
||||
$tmpentry["objectclass"][1] = 'person';
|
||||
$tmpentry["objectclass"][2] = 'organizationalPerson';
|
||||
$tmpentry["objectclass"][3] = 'account';
|
||||
$tmpentry["objectclass"][4] = 'posixAccount';
|
||||
$tmpentry["objectclass"][5] = 'shadowAccount';
|
||||
}
|
||||
|
||||
ldap_modify($ds, $allValues[0]["dn"], $tmpentry);
|
||||
} else {
|
||||
$dn = 'uid=' . $account_lid . ',' . $phpgw_info["server"]["ldap_context"];
|
||||
|
||||
if ($account_type == "g")
|
||||
{
|
||||
$entry["objectclass"][0] = 'top';
|
||||
$entry["objectclass"][1] = 'posixGroup';
|
||||
}
|
||||
else
|
||||
{
|
||||
$entry["objectclass"][0] = 'top';
|
||||
$entry["objectclass"][1] = 'person';
|
||||
$entry["objectclass"][2] = 'organizationalPerson';
|
||||
$entry["objectclass"][3] = 'account';
|
||||
$entry["objectclass"][4] = 'posixAccount';
|
||||
$entry["objectclass"][5] = 'shadowAccount';
|
||||
}
|
||||
|
||||
ldap_add($ds, $dn, $entry);
|
||||
}
|
||||
//print ldap_error($ds);
|
||||
|
Loading…
Reference in New Issue
Block a user