Opened 14 years ago
Closed 14 years ago
#8936 closed defect (fixed)
Cannot delete user using AccountModule from web_ui
| Reported by: | voithos | Owned by: | Steffen Hoffmann |
|---|---|---|---|
| Priority: | normal | Component: | AccountManagerPlugin |
| Severity: | normal | Keywords: | db web_ui |
| Cc: | Trac Release: | 0.12 |
Description
Running trac 0.12.2, with AccountManagerPlugin 0.3dev-r10371. When trying to delete a user (after logging in) using the web_ui interface, it gives the error:
Traceback (most recent call last):
File "c:\docume~1\voithos\locals~1\temp\easy_install-b06q5m\Trac-0.12.2-py2.6-win32.egg.tmp\trac\web\main.py", line 511, in _dispatch_request
dispatcher.dispatch(req)
File "c:\docume~1\voithos\locals~1\temp\easy_install-b06q5m\Trac-0.12.2-py2.6-win32.egg.tmp\trac\web\main.py", line 237, in dispatch
resp = chosen_handler.process_request(req)
File "c:\docume~1\voithos\locals~1\temp\easy_install-b06q5m\Trac-0.12.2-py2.6-win32.egg.tmp\trac\prefs\web_ui.py", line 77, in process_request
template, data = chosen_provider.render_preference_panel(req, panel_id)
File "build\bdist.win32\egg\acct_mgr\web_ui.py", line 223, in render_preference_panel
data = {'account': self._do_account(req)}
File "build\bdist.win32\egg\acct_mgr\web_ui.py", line 290, in _do_account
data.update(self._do_delete(req))
File "build\bdist.win32\egg\acct_mgr\web_ui.py", line 363, in _do_delete
acctmgr.delete_user(user)
NameError: global name 'acctmgr' is not defined
Traced it back to a missing self when calling a function in acctmgr in web_ui.py. From that point on, it no longer gave an error, but it would delete all of the records correctly. When looking at the database, the email record in session_attribute still existed, as did the user's record in session.
Finally managed to fix it by setting the key along with the table name before passing the SQL to cursor.execute().
Attachments (3)
Change History (11)
Changed 14 years ago by
| Attachment: | delete_user.diff added |
|---|
Changed 14 years ago by
| Attachment: | 20110630_trac-log_user-delete.txt added |
|---|
comment:1 follow-up: 6 Changed 14 years ago by
| Status: | new → assigned |
|---|
Easy one first: Missing self is confirmed, and is a quick fix indeed, thanks for reporting.
The second is not only totally unrelated, it isn't a valid fix according to my test. What db do you use? My debug log with debug_sql = true reveals, that especially the Trac db table session_attribute is re-populated with details from the current session before finally logging out.
Strange, that I didn't notice that before, but is looks like it isn't that easy to drop a user account from within it's own session. I suspect the same for the session record, but did not check that closely by now. I feel like I did it before, but OTOH I may have never checked the db closely afterwards, as you did. Thanks for the hint as well. but a fix looks not remotely as near here.
comment:2 Changed 14 years ago by
(In [10372]) AccountManagerPlugin: Correct wrong reference to AcctMgr object, refs #8936.
Thanks to voithos for testing and reporting back.
comment:3 Changed 14 years ago by
Seems like req.session is the culprit, restoring it's contents to Trac db table session_attribute on logout. I feel like this finding will help resolving #8549 as well.
comment:4 Changed 14 years ago by
| Summary: | Cannot delete user using web_ui when running tracd on Windows → Cannot delete user using AccountModule from web_ui |
|---|
Seems unrelated to the web server nor the os, so better remove possibly misleading parts of the summary.
comment:5 Changed 14 years ago by
(In [10375]) AccountManagerPlugin: Really delete user account by AccountModule, refs #8936.
Changed 14 years ago by
| Attachment: | 20110705_trac_log-user_delete.txt added |
|---|
comment:6 Changed 14 years ago by
Replying to hasienda:
The second is not only totally unrelated, it isn't a valid fix according to my test. What db do you use? My debug log with
debug_sql = truereveals, that especially the Trac db tablesession_attributeis re-populated with details from the current session before finally logging out.
I'm just using SQLite. That's funny, my logs don't contain any insert statements at all. Just so you know, I had applied the patch to my local build of AccountManagerPlugin. Granted, I don't really understand why it fixed it on my end, so you might want to go your own route.
comment:7 Changed 14 years ago by
Seems like your db has only a total of three entries in Trac db table session_attribute for test user 'blah'.
If they don't get changed along the way, there will be no restore attempt either. Admittedly deleting them is a change indeed - well dunno right now, why you can't verify this, sorry.
comment:8 Changed 14 years ago by
| Resolution: | → fixed |
|---|---|
| Status: | assigned → closed |
(In [10393]) AccountManagerPlugin: Releasing version 0.3, pushing development to 0.4.
This new feature release finally propagates a number of solutions into an official release, after some time of testing with trunk, so explicitely closes #442, #816, #2966, #3989, #4160, #6821, #7111, #8534, #8549, #8663, #8813, #8892, #8925, #8936 and #8939.
Should have made this months ago, but felt so many pending issues were too bad for a new release. But it has been a tremendous ticket burndown since last year, so it's really worth considering an upgrade now. See fresh changelog for details.



trac.log snippet from a German localized session trying to delete user
test5via user preferences