mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-06-21 10:27:52 +02: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,
|
'sync' => True,
|
||||||
'shutdown' => True,
|
'shutdown' => True,
|
||||||
'halt' => True,
|
'halt' => True,
|
||||||
|
'ldap' => True,
|
||||||
'mail' => True,
|
'mail' => True,
|
||||||
'news' => True,
|
'news' => True,
|
||||||
'uucp' => True,
|
'uucp' => True,
|
||||||
@ -48,9 +49,21 @@
|
|||||||
'pgsql' => True,
|
'pgsql' => True,
|
||||||
'mysql' => True,
|
'mysql' => True,
|
||||||
'postgres' => True,
|
'postgres' => True,
|
||||||
|
'oracle' => True,
|
||||||
'ftp' => True,
|
'ftp' => True,
|
||||||
'gdm' => 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_
|
class accounts_
|
||||||
@ -117,8 +130,25 @@
|
|||||||
$entry["loginshell"] = $this->data["loginshell"];
|
$entry["loginshell"] = $this->data["loginshell"];
|
||||||
}
|
}
|
||||||
|
|
||||||
ldap_modify($ds, $allValues[0]["dn"], $entry);
|
while (list($key,$val) = each($entry))
|
||||||
#print ldap_error($ds);
|
{
|
||||||
|
$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']
|
$this->db->query("update phpgw_accounts set account_firstname='" . $this->data['firstname']
|
||||||
. "', account_lastname='" . $this->data['lastname'] . "', account_status='"
|
. "', account_lastname='" . $this->data['lastname'] . "', account_status='"
|
||||||
@ -271,7 +301,7 @@
|
|||||||
if(gettype($account_lid) == 'integer')
|
if(gettype($account_lid) == 'integer')
|
||||||
{
|
{
|
||||||
$account_id = $account_lid;
|
$account_id = $account_lid;
|
||||||
settype($acount_lid,'string');
|
settype($account_lid,'string');
|
||||||
$account_lid = $this->id2name($account_id);
|
$account_lid = $this->id2name($account_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -336,7 +366,7 @@
|
|||||||
. "','" . $account_type . "','" . md5($account_pwd) . "', '" . $account_firstname
|
. "','" . $account_type . "','" . md5($account_pwd) . "', '" . $account_firstname
|
||||||
. "','" . $account_lastname . "','" . $account_status . "')",__LINE__,__FILE__);
|
. "','" . $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);
|
$allValues = ldap_get_entries($ds, $sri);
|
||||||
|
|
||||||
$entry["uidnumber"] = $account_id;
|
$entry["uidnumber"] = $account_id;
|
||||||
@ -346,11 +376,6 @@
|
|||||||
$entry["sn"] = $account_lastname;
|
$entry["sn"] = $account_lastname;
|
||||||
$entry["givenname"] = $account_firstname;
|
$entry["givenname"] = $account_firstname;
|
||||||
$entry["userpassword"] = $phpgw->common->encrypt_password($account_pwd);
|
$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 ($phpgw_info["server"]["ldap_extra_attributes"] && $account_type != 'g') {
|
||||||
if ($account_home)
|
if ($account_home)
|
||||||
@ -375,9 +400,61 @@
|
|||||||
if ($allValues[0]["dn"]) {
|
if ($allValues[0]["dn"]) {
|
||||||
// This should keep the password from being overwritten here ?
|
// This should keep the password from being overwritten here ?
|
||||||
unset($entry["userpassword"]);
|
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 {
|
} else {
|
||||||
$dn = 'uid=' . $account_lid . ',' . $phpgw_info["server"]["ldap_context"];
|
$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);
|
ldap_add($ds, $dn, $entry);
|
||||||
}
|
}
|
||||||
//print ldap_error($ds);
|
//print ldap_error($ds);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user