1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-12-03 17:36:05 +00:00

fix(admin): two administrators at once leave a superuser and one user per address

An administrator cannot block, delete or demote their own account, but
with two superusers each could block the other at the same moment, and
none was left. Changes of the panel's users (create, edit, block,
unblock, delete, group edits, and a user's own profile) now run one at
a time, under a claim every worker sees, and a block, delete or edit
that would leave no active superuser is refused.

Under that claim each change reads the user or group as saved now: the
edit forms' fingerprint is compared there, a block writes only the
account's Active flag, and a profile saved while an administrator
blocks the account keeps the block.

A user's e-mail address is one user's, case aside, so that "Lost OTP?"
can mail it; two users created or edited at once each passed that check.
The form checks the address again under the same claim, with the save.
This commit is contained in:
catborise 2026-11-13 14:33:06 +03:00
parent ab77b198f2
commit b65d2abaf6
9 changed files with 330 additions and 147 deletions

View file

@ -58,6 +58,11 @@ def nwfilters_key(compute_id):
return f"nwfilters:{compute_id}"
def users_key():
"""The panel's users: one change of them at a time, checked as it is saved."""
return "users"
def name_key(name):
"""A VM name is the panel's on every compute (the name checks are global)."""
return f"name:{name}"