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
function delete_all()
// This is for the admin script deleteaccount.php
function delete_all($owner=0)
{
global $phpgw_info;
@ -718,12 +718,16 @@
return False;
}
$sri = ldap_search($this->ldap, $phpgw_info["server"]["ldap_contact_context"], "uidnumber=*");
$ldap_fields = ldap_get_entries($this->ldap, $sri);
if ($owner) {
$sri = ldap_search($this->ldap, $phpgw_info["server"]["ldap_contact_context"], "uidnumber=".$owner);
$ldap_fields = ldap_get_entries($this->ldap, $sri);
$entry = "";
while (list($null,$entry) = each($ldap_fields)) {
$err = ldap_delete($this->ldap,$entry['dn']);
$entry = "";
while (list($null,$entry) = each($ldap_fields)) {
$err = ldap_delete($this->ldap,$entry['dn']);
}
$this->db->query("DELETE FROM $this->ext_table WHERE owner=$owner",__LINE__,__FILE__);
}
return;
}

View File

@ -285,8 +285,7 @@
}
// 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="",$rights="",$access="")
function read($start=0,$offset=0,$fields="",$query="",$filter="",$sort="",$order="")
{
global $phpgw,$phpgw_info;
@ -587,11 +586,14 @@
. $this->account_id . "'",__LINE__,__FILE__);
}
// This is for testing, not intended for release
function delete_all()
// This is for the admin script deleteaccount.php
function delete_all($owner=0)
{
$this->db->query("delete from $this->std_table",__LINE__,__FILE__);
$this->db->query("delete from $this->ext_table",__LINE__,__FILE__);
if ($owner)
{
$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;
}
}