mirror of
https://github.com/retspen/webvirtcloud
synced 2026-12-03 17:36:05 +00:00
fix(admin): a user or group form opened before another change does not undo it
The user and group edit forms send back every field they show. A form opened before another administrator blocked the user, took away a group or a permission, or changed a group's members, put those back when it was saved for another change. The forms now send a fingerprint of what they showed, and a user or group changed meanwhile is shown again as it is now, with nothing saved. The user's password and last login are no change of the form.
This commit is contained in:
parent
35a5bbdb62
commit
ab77b198f2
12 changed files with 208 additions and 121 deletions
15
admin/tests/edits.py
Normal file
15
admin/tests/edits.py
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
"""What an edit form sends back as the state it showed (admin.views.form_seen)."""
|
||||
|
||||
from accounts.models import UserAttributes
|
||||
from logs.audit import snapshot
|
||||
|
||||
from admin.views import form_seen, group_snapshot
|
||||
|
||||
|
||||
def user_seen(user):
|
||||
attributes, _created = UserAttributes.objects.get_or_create(user=user)
|
||||
return form_seen(snapshot(user), snapshot(attributes))
|
||||
|
||||
|
||||
def group_seen(group):
|
||||
return form_seen(group_snapshot(group))
|
||||
Loading…
Add table
Add a link
Reference in a new issue