User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; rv:1.7.3) Gecko/20040913 Firefox/0.10 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; rv:1.7.3) Gecko/20040913 Firefox/0.10 Try do delete an existing user, you should see an error. The user does get deleted though (but not from the groups, see related bug #194355). I've tracked down the problem to this piece of code in editusers.cgi: SendSQL("DELETE FROM profiles WHERE login_name=" . SqlQuote($user)); Bugzilla->logout_user_by_id($userid); print "User deleted.<BR>\n"; The problem is that Bugzilla->logout_user_by_id() tries to get some user info from the database, but it is called AFTER the user is deleted from the database. Putting that statement before the SQL DELETE fixes the problem. While you're at it, you also might add another DELETE statements to clear the groups properly, so the resulting code should be something like this: Bugzilla->logout_user_by_id($userid); SendSQL("DELETE FROM profiles WHERE login_name=" . SqlQuote($user)); SendSQL("DELETE FROM user_group_map WHERE user_id=" . $userid); print "User deleted.<BR>\n"; Reproducible: Always Steps to Reproduce: 1. Create some user 2. Delete it Actual Results: Deleting user Software error: Can't call method "id" on an undefined value at Bugzilla/Auth/CGI.pm line 195. For help, please send mail to the webmaster (firstname.lastname@example.org), giving this error message and the time and date of the error. Expected Results: Print "User deleted", with no errors.
I was going to go stick this to Future and assign it to nobody, since we've officially stated many places that we don't really support deleting users (see http://weblogs.mozillazine.org/gerv/archives/006543.html for a good writeup on this). However, since you've more or less provided the fix here, we might as well get it in. :) Are you comfortable enough with cvs diff to turn this into a patch?
Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: Windows XP → All
Hardware: PC → All
Target Milestone: --- → Bugzilla 2.22
Created attachment 160042 [details] [diff] [review] Patch to delete a user semi-properly (only works for users with no bugs/comments) Heheh, just read that article... "If people want to do dumb stuff, they can write the code for it on their own time" Well, guess what I just did :) Attaching patch.
assigning to patch author
Assignee: justdave → grnch
Attachment #160042 - Flags: review?(justdave)
The patch in bug 119485 covers this.
Attachment #160042 - Flags: review?(justdave) → review+
This looks like the right thing to do, and no reason not to backport it to 2.18 as long as we have it. No offence to Wurzlbap, but this was here first, so let's get it in this way so Ivan gets credit. :) I'm not comfortable with an entire templatization patch going on 2.18, anyway, and this one can.
Target Milestone: Bugzilla 2.22 → Bugzilla 2.18
Checking in editusers.cgi; /cvsroot/mozilla/webtools/bugzilla/editusers.cgi,v <-- editusers.cgi new revision: 1.69; previous revision: 1.68 done Checking in editusers.cgi; /cvsroot/mozilla/webtools/bugzilla/editusers.cgi,v <-- editusers.cgi new revision: 188.8.131.52; previous revision: 184.108.40.206 done
Status: NEW → RESOLVED
Last Resolved: 14 years ago
Resolution: --- → FIXED
Summary: Delete user gives a Perl error in Bugzilla/Auth/CGI.pm → Improve deleting users (remove Perl error, make it work semi-properly)
You need to log in before you can comment on or make changes to this bug.