Modify delete_all() to handle account record deletion by admin

This commit is contained in:
Miles Lott 2001-03-28 12:39:42 +00:00
parent dcdf02842e
commit f57e5d0c3a
2 changed files with 19 additions and 13 deletions

View File

@ -709,8 +709,8 @@
} }
} }
// This is for testing, not intended for release // This is for the admin script deleteaccount.php
function delete_all() function delete_all($owner=0)
{ {
global $phpgw_info; global $phpgw_info;
@ -718,13 +718,17 @@
return False; return False;
} }
$sri = ldap_search($this->ldap, $phpgw_info["server"]["ldap_contact_context"], "uidnumber=*"); if ($owner) {
$sri = ldap_search($this->ldap, $phpgw_info["server"]["ldap_contact_context"], "uidnumber=".$owner);
$ldap_fields = ldap_get_entries($this->ldap, $sri); $ldap_fields = ldap_get_entries($this->ldap, $sri);
$entry = ""; $entry = "";
while (list($null,$entry) = each($ldap_fields)) { while (list($null,$entry) = each($ldap_fields)) {
$err = ldap_delete($this->ldap,$entry['dn']); $err = ldap_delete($this->ldap,$entry['dn']);
} }
$this->db->query("DELETE FROM $this->ext_table WHERE owner=$owner",__LINE__,__FILE__);
}
return; return;
} }
} }

View File

@ -285,8 +285,7 @@
} }
// send this the range, query, sort, order and whatever fields you want to see // send this the range, query, sort, order and whatever fields you want to see
// 'rights' and 'access' are unused at this time function read($start=0,$offset=0,$fields="",$query="",$filter="",$sort="",$order="")
function read($start=0,$offset=0,$fields="",$query="",$filter="",$sort="",$order="",$rights="",$access="")
{ {
global $phpgw,$phpgw_info; global $phpgw,$phpgw_info;
@ -587,11 +586,14 @@
. $this->account_id . "'",__LINE__,__FILE__); . $this->account_id . "'",__LINE__,__FILE__);
} }
// This is for testing, not intended for release // This is for the admin script deleteaccount.php
function delete_all() function delete_all($owner=0)
{ {
$this->db->query("delete from $this->std_table",__LINE__,__FILE__); if ($owner)
$this->db->query("delete from $this->ext_table",__LINE__,__FILE__); {
$this->db->query("DELETE FROM $this->std_table WHERE owner=$owner",__LINE__,__FILE__);
$this->db->query("DELETE FROM $this->ext_table WHERE owner=$owner",__LINE__,__FILE__);
}
return; return;
} }
} }