possible to delete the "last" superuser

RESOLVED WONTFIX

Status

Mozilla QA
MozTrap
RESOLVED WONTFIX
5 years ago
a year ago

People

(Reporter: yoshi yokotani, Unassigned)

Tracking

Details

(URL)

Attachments

(1 attachment)

(Reporter)

Description

5 years ago
User Agent: Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:20.0) Gecko/20100101 Firefox/20.0
Build ID: 20130329030848

Steps to reproduce:

in the local version of moztrap (localhost:8000)
1. Manage->Users
2. click the trash-bin icon on the "last" superuser



Actual results:

the superuser can be deleted. Then, it is not possible to recover the user from moztrap.


Expected results:

it might be better to prevent the deletion to avoid a work on the django
(Reporter)

Comment 1

5 years ago
it was found that clicking the deactivate button on the superuser landed on the same issue. So, the title can be rephrased as "possible to delete/deactivate the "last" superuser.".

Comment 2

5 years ago
Created attachment 822140 [details] [review]
Patch for this bug
Attachment #822140 - Flags: review?(cdawson)

Comment 3

5 years ago
Comment on attachment 822140 [details] [review]
Patch for this bug

I modified the User model a little bit.
Now, when deletion/deactivation of a User is triggered, moztrap will check whether the one is the "last" superuser or not.
Shiro-- this looks very close.  I found an edge case.  I left a message on github on the PR as follows:



@sh1r0 : So I tested this a bit, and it does prevent deactivation when you are in the manage/users list and click the green button and select disable. But for some reason it does NOT prevent this when you edit the user and uncheck the "active" checkbox and save.

I think this would require you override the save function and do your check there as well. Perhaps if they ARE the last superuser, allow the save to continue, but silently set active=True.

Thanks.

Updated

5 years ago
Attachment #822140 - Flags: review?(cdawson) → review+
Mass-closing remaining MozTrap bugs as WONTFIX, due to 1) the Mozilla-hosted instance being decommissioned (see https://wiki.mozilla.org/TestEngineering/Testrail), and, for now, 2) the still-up code archived at its GitHub page: https://github.com/mozilla/moztrap (we'll decide what's next for that, in the near future).

See also the history and more-detailed discussion which led us here, at https://groups.google.com/forum/#!topic/mozilla.dev.quality/Sa75hV8Ywvk

(If you'd like, you should be able to filter these notification emails using at least the unique string of "Sa75hV8Ywvk" in the message body.

Thanks!
Status: UNCONFIRMED → RESOLVED
Last Resolved: a year ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.