6.0.0-git
2019-03-19

[#10241] removing user data doesn't work
Summary removing user data doesn't work
Queue Horde Framework Packages
Queue Version Git master
Type Bug
State Resolved
Priority 2. Medium
Owners mrubinsk (at) horde (dot) org
Requester vilius (at) lnk (dot) lt
Created 2011-06-14 (2835 days ago)
Due
Updated 2011-09-04 (2753 days ago)
Assigned 2011-09-02 (2755 days ago)
Resolved 2011-09-03 (2754 days ago)
Milestone
Patch No

History
2011-09-04 07:19:25 vilius (at) lnk (dot) lt Comment #31 Reply to this comment
Uf, this a little bit bad, but I just noticed that removeUserData for
kronolith and mnemo removes shares of the admin who is deleting the
data, not the user's data.
My fault. Over zealous refactoring :) Should be fixed now.
Works now.

[Show Quoted Text - 11 lines]
That's what I thought. Yes they are removed, but DELETE is executed 
for every preference in every application:

2011-09-04T10:14:28+03:00 DEBUG: HORDE [horde] SQL  (0,0007s)
         DELETE FROM horde_prefs WHERE pref_uid = 'turba3@lnk.lt' AND pref_name
           = 'id' AND pref_scope = 'horde' [pid 11789 on line 801 of 
"/usr/share/pear/Horde/Db/Adapter/Base.php"]
2011-09-04T10:14:28+03:00 DEBUG: HORDE [horde] SQL  (0,0005s)
         DELETE FROM horde_prefs WHERE pref_uid = 'turba3@lnk.lt' AND pref_name
           = 'fullname' AND pref_scope = 'horde' [pid 11789 on line 
801 of "/usr/share/pear/Horde/Db/Adapter/Base.php"]
2011-09-04T10:14:28+03:00 DEBUG: HORDE [horde] SQL  (0,0005s)
         DELETE FROM horde_prefs WHERE pref_uid = 'turba3@lnk.lt' AND pref_name
           = 'from_addr' AND pref_scope = 'horde' [pid 11789 on line 
801 of "/usr/share/pear/Horde/Db/Adapter/Base.php"]
2011-09-04T10:14:28+03:00 DEBUG: HORDE [horde] SQL  (0,0005s)
         DELETE FROM horde_prefs WHERE pref_uid = 'turba3@lnk.lt' AND pref_name
           = 'location' AND pref_scope = 'horde' [pid 11789 on line 
801 of "/usr/share/pear/Horde/Db/Adapter/Base.php"]
2011-09-04T10:14:28+03:00 DEBUG: HORDE [horde] SQL  (0,0005s)
         DELETE FROM horde_prefs WHERE pref_uid = 'turba3@lnk.lt' AND pref_name
           = 'default_identity' AND pref_scope = 'horde' [pid 11789 on 
line 801 of "/usr/share/pear/Horde/Db/Adapter/Base.php"]


etc. etc.
2011-09-04 01:55:45 Michael Rubinsky Comment #30 Reply to this comment
Uf, this a little bit bad, but I just noticed that removeUserData 
for kronolith and mnemo removes shares of the admin who is deleting 
the data, not the user's data.
My fault. Over zealous refactoring :) Should be fixed now.
Also during debuging I've noticed that horde does spit a lot of 
these messages:
        DELETE FROM horde_prefs WHERE pref_uid = 'turba3@lnk.lt' AND pref_name
This one is confusing me. removeUserData() is supposed to remove the 
user's prefs for all applications. At most this should only be called 
N number of times where N is the number of applications installed. It 
also shouldn't be appending the pref_name clause. Following the code, 
I don't see why that would be happening.  Are the user's prefs removed 
from storage?

2011-09-04 01:48:21 Git Commit Comment #29 Reply to this comment
Changes have been made in Git for this ticket:

Delete all of the shares owned by $user, not just the default.
Bug: 10241

  1 files changed, 14 insertions(+), 19 deletions(-)
http://git.horde.org/horde-git/-/commit/924698eb30c877c194012c2bea739645504a7843
2011-09-04 01:48:16 Git Commit Comment #28 Reply to this comment
Changes have been made in Git for this ticket:

Need the shares owned by $user, not current user.
Bug: 10241

  1 files changed, 2 insertions(+), 1 deletions(-)
http://git.horde.org/horde-git/-/commit/6c52d2c5d95c9826205fe9aae90e7377541e572e
2011-09-04 01:20:40 Git Commit Comment #27 Reply to this comment
Changes have been made in Git for this ticket:

oops. We want the shares owned by $user, not current user.
Bug: 10241

  1 files changed, 3 insertions(+), 1 deletions(-)
http://git.horde.org/horde-git/-/commit/8175bae5a8bf81117da207a4f351bacd4fd33800
2011-09-03 19:40:21 vilius (at) lnk (dot) lt Comment #26 Reply to this comment

[Show Quoted Text - 10 lines]
Yes, i'm using NG driver. For me entries in kronolith_sharesng and 
mnemo_sharesng are still there.

Uf, this a little bit bad, but I just noticed that removeUserData for 
kronolith and mnemo removes shares of the admin who is deleting the 
data, not the user's data.

          DELETE FROM kronolith_sharesng_groups WHERE share_id = 450 
[pid 31447 on line 801 of "/usr/share/pear/Horde/Db/Adapter/Base.php"]
         DELETE FROM mnemo_sharesng_users WHERE share_id = 462 [pid 
31447 on line 801 of "/usr/share/pear/Horde/Db/Adapter/Base.php"]

Both shares_ids are mine :(.

Also during debuging I've noticed that horde does spit a lot of these 
messages:
        DELETE FROM horde_prefs WHERE pref_uid = 'turba3@lnk.lt' AND pref_name

They are executed like 40 or 50 times.
2011-09-03 18:01:46 Michael Rubinsky Comment #25 Reply to this comment
Should shares in *_sharesng tables still exist after user data 
removal? Because currently they still do.
Shares that the user is the owner of, in the currently active share 
driver should be removed. So, if you are using the ng sql driver, then 
no, they shouldn't still exist. If you are using the legacy sql share 
driver, then the ng table would not be touched. If you *are* using the 
ng driver, then check your log for any errors and post back. I've 
tested locally with both sql drivers and all user-owned shares are now 
properly removed.
I have also grepped database for the user in question. Entries in 
horde_history
horde_history is purposely not deleted since it is, well, a history of 
what has happened. They are necessary e.g., If some other user (User 
B) had rights to the deleted user's (User A) address book, and User B 
has it set to synch to one of his devices, then the history entries 
are necessary to ensure User A's entries are properly removed from 
User B's device(s).
and imp_sentmail persist too.
The IMP_Sentmail table's garbage collection is managed by the sentmail 
driver itself. The API doesn't contain any facility for deleting a 
specific user's entries in that table. Instead, it deletes all entries 
that are older than a configurable time-period.
2011-09-03 17:35:51 vilius (at) lnk (dot) lt Comment #24 Reply to this comment
Should shares in *_sharesng tables still exist after user data 
removal? Because currently they still do.

I have also grepped database for the user in question. Entries in 
horde_history and imp_sentmail persist too.
2011-09-03 03:57:25 Michael Rubinsky State ⇒ Resolved
 
2011-09-03 03:56:31 Git Commit Comment #23 Reply to this comment
Changes have been made in Git for this ticket:

Fix kronolith's removeUserData API
Bug: 10241

  4 files changed, 51 insertions(+), 51 deletions(-)
http://git.horde.org/horde-git/-/commit/1de3f9a2e018a959cdf22fce2a4e6814e9ddb310
2011-09-02 15:24:21 Michael Rubinsky Comment #22
Taken from Horde DevelopersHorde Developers
Taken from Jan Schneider
State ⇒ Assigned
Reply to this comment

[Show Quoted Text - 9 lines]
That should indeed be logged as an ERR. It's being thrown from the 
getShare method. If we ask for a share, and can not find it, that is 
indeed an error.

Looks like the Kronolith_Application#removeUserData method needs to be 
tweaked though, as it is still assuming that the user's default share 
is keyed by the username. This is no longer the case.
2011-09-01 16:45:41 Michael Slusarz Comment #21
Assigned to Jan Schneider
Assigned to Michael Rubinsky
Taken from Michael Slusarz
Reply to this comment
2011-08-31T10:14:48+03:00 ERR: HORDE [nag] Share name turba3@lnk.lt
not found [pid 30082 on line 179 of
"/usr/share/pear/Horde/Share/Sql.php"]
Interestingly these are still shown as ERR level.
Yeah... looks like the errors are being logged in the Share driver.   
Don't know anything about that driver so I will leave to the other 
devs to determine if this is the appropriate log level.
Also shares for that user exist in _sharesng tables for nag, 
kronolith and mnemo. The error message says that the name of the 
share is turba3@lnk.lt but in the database all share names are in a 
form of such id: uJceVjxJBD9ON8OsLRTSc9A.
Reassigning to Jan and Mike R., since they normally deal with the 
share system (I think).
2011-09-01 06:18:27 vilius (at) lnk (dot) lt Comment #20 Reply to this comment
Horde preferences are now cleared. However I get an uncought exception:
Uncaught exception has been fixed.
Thank you.

[Show Quoted Text - 16 lines]
Interestingly these are still shown as ERR level. Also shares for that 
user exist in _sharesng tables for nag, kronolith and mnemo. The error 
message says that the name of the share is turba3@lnk.lt but in the 
database all share names are in a form of such id: 
uJceVjxJBD9ON8OsLRTSc9A.
2011-08-31 17:12:49 Michael Slusarz Comment #19 Reply to this comment
Horde preferences are now cleared. However I get an uncought exception:
Uncaught exception has been fixed.
Logs say:

2011-08-31T10:14:48+03:00 ERR: HORDE [horde] to be refactored [pid 
30082 on line 943 of 
"/var/www/html/horde/kronolith/lib/Driver/Sql.php"]
That's a TODO item.  Someone with familiarity with kronolith needs to 
look at this.

[Show Quoted Text - 12 lines]
I'm assuming these are not important - meaning that their 
non-existence is expected.  I've toned down the logging level to 
NOTICE to reflect this (should it be DEBUG?)

2011-08-31 17:11:01 Git Commit Comment #18 Reply to this comment
Changes have been made in Git for this ticket:

Bug #10241: Tone down error levels; do as much as possible before 
throwing exception

  4 files changed, 33 insertions(+), 19 deletions(-)
http://git.horde.org/horde-git/-/commit/fdf9785c1cce154fc492de2dd22cec963825abaf
2011-08-31 17:10:55 Git Commit Comment #17 Reply to this comment
Changes have been made in Git for this ticket:

Bug #10241: Registry throws Horde_Exception, not Horde_Auth_Exceptions

  1 files changed, 2 insertions(+), 2 deletions(-)
http://git.horde.org/horde-git/-/commit/0a90133cf28f0327818672b3883eb815fab1e446
2011-08-31 07:25:34 vilius (at) lnk (dot) lt Comment #16 Reply to this comment
Horde preferences are now cleared. However I get an uncought exception:

"The following applications encountered errors removing user data:   
kronolith, nag, mnemo"
1. Horde_Registry->removeUserData() /var/www/html/horde/admin/user.php:142

Logs say:

2011-08-31T10:14:48+03:00 ERR: HORDE [horde] to be refactored [pid 
30082 on line 943 of "/var/www/html/horde/kronolith/lib/Driver/Sql.php"]
2011-08-31T10:14:48+03:00 ERR: HORDE [nag] Share name turba3@lnk.lt 
not found [pid 30082 on line 179 of 
"/usr/share/pear/Horde/Share/Sql.php"]
2011-08-31T10:14:48+03:00 ERR: HORDE [horde] Share name turba3@lnk.lt 
not found [pid 30082 on line 180 of 
"/usr/share/pear/Horde/Share/Sql.php"]
2011-08-31T10:14:48+03:00 ERR: HORDE [mnemo] Share name turba3@lnk.lt 
not found [pid 30082 on line 179 of 
"/usr/share/pear/Horde/Share/Sql.php"]
2011-08-31T10:14:48+03:00 ERR: HORDE [horde] Share name turba3@lnk.lt 
not found [pid 30082 on line 180 of 
"/usr/share/pear/Horde/Share/Sql.php"]

2011-08-31 07:05:55 Michael Slusarz Comment #15
State ⇒ Feedback
Priority ⇒ 2. Medium
Reply to this comment
Take 4 (5?)  The problem was that the removeUserData method in horde 
was in the API - not a standard Horde application method.  These fixes 
should take care of that problem (mnemo had the same issue).  Also, 
fixes moved permissions checking and preferences deletion into the 
general Horde_Registry#removeUserData method.
2011-08-31 07:04:03 Git Commit Comment #14 Reply to this comment
Changes have been made in Git for this ticket:

Bug #10241: Remove user data fixes/refactor
[mms] Revamp and fix Horde_Registry#removeUserData(); this method
should now be the sole access point to delete user data for any/all
apps.

  6 files changed, 144 insertions(+), 114 deletions(-)
http://git.horde.org/horde-git/-/commit/f43e6149066bc3a7915ede64bf14e667a6a5ca4b
2011-08-02 17:55:49 vilius (at) lnk (dot) lt Comment #13 Reply to this comment
Nope, preferences are still not deleted.

This may sound insane, but I have try to modify removeUserData in 
horde/lib/Api.php without a success. Even things like print_r($prefs); 
exit; doesn't work. Seems like it is never called?
2011-08-02 17:13:19 Michael Slusarz Comment #12
Assigned to Horde DevelopersHorde Developers
State ⇒ Assigned
Reply to this comment
Maybe this fixes the prefs deletion?  I have no idea about the 
Turba/Kronolith stuff - that will need to be dealt with by another dev.
2011-08-02 17:12:55 Git Commit Comment #11 Reply to this comment
Changes have been made in Git for this ticket:

Bug #10241: Load all pref scopes before deleting them

  1 files changed, 4 insertions(+), 0 deletions(-)
http://git.horde.org/horde-git/-/commit/fc99a631fc40123732e5349111bcf3eb375de2ed
2011-08-02 17:12:50 Git Commit Comment #10 Reply to this comment
Changes have been made in Git for this ticket:

Bug #10241: Fix passing $userId.
Signed-off-by: Michael M Slusarz <slusarz@curecanti.org>

  1 files changed, 1 insertions(+), 1 deletions(-)
http://git.horde.org/horde-git/-/commit/94a98610dc77280cb2b987016bc6a4dfb22dd2d0
2011-08-02 11:52:15 vilius (at) lnk (dot) lt Comment #9
New Attachment: 0001-Fix-passing-userId.patch Download
Reply to this comment
I hate to reopen old bugs but this still doesn't work. Attaching a 
patch for Registry.php however even with this fix there are problems 
when deleting user data.

Firstly, none of the preferences from horde_prefs gets deleted for the user.

Secondly, Horde log shows:
2011-08-02T14:34:07+03:00 ERR: HORDE [turba] Removing user data is not 
supported in the current address book storage driver. [pid 4769 on 
line 2769 of "/var/www/html/horde/turba/lib/Driver.php"]
2011-08-02T14:34:07+03:00 ERR: HORDE [horde] There was an error 
removing an address book for user@example.com [pid 4769 on line 414 of 
"/var/www/html/horde/turba/lib/Application.php"]
2011-08-02T14:34:07+03:00 ERR: HORDE [horde] to be refactored [pid 
4769 on line 943 of "/var/www/html/horde/kronolith/lib/Driver/Sql.php"]
2011-08-02T14:34:07+03:00 ERR: HORDE [nag] Share name user@example.com 
not found [pid 4769 on line 179 of 
"/usr/share/pear/Horde/Share/Sql.php"]
2011-08-02T14:34:07+03:00 ERR: HORDE [horde] Share name 
user@example.com not found [pid 4769 on line 180 of 
"/usr/share/pear/Horde/Share/Sql.php"]

2011-07-14 06:25:55 Michael Slusarz State ⇒ Resolved
 
2011-07-14 06:25:52 Git Commit Comment #8 Reply to this comment
Changes have been made in Git for this ticket:

Bug #10241: Fix removing user data from applications.

  2 files changed, 7 insertions(+), 7 deletions(-)
http://git.horde.org/horde-git/-/commit/ee2b27473a7fa9e5a69b94b7fa7814d7e4666588
2011-06-14 20:43:05 vilius (at) lnk (dot) lt Comment #7 Reply to this comment
First two errors are gone. These still remain:

Horde interface:

"The following applications encountered errors removing user data: 
imp, ingo, turba, kronolith, nag, mnemo"

Horde log:

2011-06-14T23:38:59+03:00 ERR: HORDE [horde] The method 
"removeUserData" is not defined in the API for imp. [pid 26452 on line 
991 of "/usr/share/pear/Horde/Registry.php"]
2011-06-14T23:38:59+03:00 ERR: HORDE [horde] The method 
"removeUserData" is not defined in the API for ingo. [pid 26452 on 
line 991 of "/usr/share/pear/Horde/Registry.php"]
2011-06-14T23:38:59+03:00 ERR: HORDE [horde] The method 
"removeUserData" is not defined in the API for turba. [pid 26452 on 
line 991 of "/usr/share/pear/Horde/Registry.php"]
2011-06-14T23:38:59+03:00 ERR: HORDE [horde] The method 
"removeUserData" is not defined in the API for kronolith. [pid 26452 
on line 991 of "/usr/share/pear/Horde/Registry.php"]
2011-06-14T23:38:59+03:00 ERR: HORDE [horde] The method 
"removeUserData" is not defined in the API for nag. [pid 26452 on line 
991 of "/usr/share/pear/Horde/Registry.php"]

2011-06-14 20:06:04 Michael Slusarz Comment #6 Reply to this comment
Try this.
2011-06-14 20:05:55 Git Commit Comment #5 Reply to this comment
Changes have been made in Git for this ticket:

Bug #10241: Cast to array

  1 files changed, 1 insertions(+), 1 deletions(-)
http://git.horde.org/horde-git/-/commit/ed92bcda64d65813162674f4ec602b533e0ab114
2011-06-14 19:40:49 vilius (at) lnk (dot) lt Comment #4 Reply to this comment
First part of the error message changed a little bit:

2011-06-14T22:38:03+03:00 WARN: HORDE [horde] PHP ERROR: array_keys() 
expects parameter 1 to be array, object given [pid 3411 on line 151 of 
"/usr/share/pear/Horde/Prefs.php"]
2011-06-14T22:38:03+03:00 WARN: HORDE [horde] PHP ERROR: Invalid 
argument supplied for foreach() [pid 3411 on line 151 of 
"/usr/share/pear/Horde/Prefs.php"]
2011-06-14T22:38:03+03:00 ERR: HORDE [horde] The method 
"removeUserData" is not defined in the API for imp. [pid 3411 on line 
991 of "/usr/share/pear/Horde/Registry.php"]
2011-06-14T22:38:03+03:00 ERR: HORDE [horde] The method 
"removeUserData" is not defined in the API for ingo. [pid 3411 on line 
991 of "/usr/share/pear/Horde/Registry.php"]
2011-06-14T22:38:03+03:00 ERR: HORDE [horde] The method 
"removeUserData" is not defined in the API for turba. [pid 3411 on 
line 991 of "/usr/share/pear/Horde/Registry.php"]
2011-06-14T22:38:03+03:00 ERR: HORDE [horde] The method 
"removeUserData" is not defined in the API for kronolith. [pid 3411 on 
line 991 of "/usr/share/pear/Horde/Registry.php"]
2011-06-14T22:38:03+03:00 ERR: HORDE [horde] The method 
"removeUserData" is not defined in the API for nag. [pid 3411 on line 
991 of "/usr/share/pear/Horde/Registry.php"]

2011-06-14 17:59:17 Michael Slusarz Comment #3
Assigned to Michael Slusarz
State ⇒ Feedback
Reply to this comment
Does this fix?  (Will require updating Horde_Prefs from git).
2011-06-14 17:58:13 Git Commit Comment #2 Reply to this comment
Changes have been made in Git for this ticket:

Bug #10241: Null argument to Horde_Prefs#remove() will remove all prefs.

  3 files changed, 58 insertions(+), 9 deletions(-)
http://git.horde.org/horde-git/-/commit/0563088d0c5fa20afdab68360602ec1fd3c8b7fa
2011-06-14 07:10:00 vilius (at) lnk (dot) lt Comment #1
Type ⇒ Bug
State ⇒ Unconfirmed
Priority ⇒ 1. Low
Summary ⇒ removing user data doesn't work
Queue ⇒ Horde Framework Packages
Milestone ⇒
Patch ⇒ No
Reply to this comment
When I delete a user I always get a message that user data could not 
be deleted. Logs say:

2011-06-14T10:01:53+03:00 WARN: HORDE [horde] PHP ERROR: Missing 
argument 1 for Horde_Prefs::remove(), called in 
/var/www/html/horde/lib/Api.php on line 232 and defined [pid 25320 on 
line 146 of "/usr/share/pear/Horde/Prefs.php"]
2011-06-14T10:01:53+03:00 NOTICE: HORDE [horde] PHP ERROR: Undefined 
variable: pref [pid 25320 on line 148 of 
"/usr/share/pear/Horde/Prefs.php"]

And after that:

2011-06-14T10:01:53+03:00 ERR: HORDE [horde] The method 
"removeUserData" is not defined in the API for imp. [pid 25320 on line 
991 of "/usr/share/pear/Horde/Registry.php"]
2011-06-14T10:01:53+03:00 ERR: HORDE [horde] The method 
"removeUserData" is not defined in the API for ingo. [pid 25320 on 
line 991 of "/usr/share/pear/Horde/Registry.php"]
2011-06-14T10:01:53+03:00 ERR: HORDE [horde] The method 
"removeUserData" is not defined in the API for turba. [pid 25320 on 
line 991 of "/usr/share/pear/Horde/Registry.php"]
2011-06-14T10:01:53+03:00 ERR: HORDE [horde] The method 
"removeUserData" is not defined in the API for kronolith. [pid 25320 
on line 991 of "/usr/share/pear/Horde/Registry.php"]
2011-06-14T10:01:53+03:00 ERR: HORDE [horde] The method 
"removeUserData" is not defined in the API for nag. [pid 25320 on line 
991 of "/usr/share/pear/Horde/Registry.php"]

Saved Queries