1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-12-02 17:06:09 +00:00

fix(accounts): owners given before one owner was the rule keep editable rights

With "Multiple Owner for VM" turned off after a VM was given two owners,
changing either owner's rights (Delete the VM, say) was refused: the
form's one-owner check counted the other owner. The check now applies to
a new owner only, as its message says.

The user and group forms showed the permissions by the English names the
database keeps (Can clone instances, ...), in every language; they are
named in the user's language now.
This commit is contained in:
catborise 2026-11-13 14:27:32 +03:00
parent dde7672375
commit 35a5bbdb62
10 changed files with 151 additions and 100 deletions

View file

@ -44,6 +44,14 @@ class UserCreateTests(TestCase):
ticked = set(re.findall(r'<input[^>]*name="user_permissions"[^>]*value="(\d+)"[^>]*checked', page))
self.assertEqual(ticked, {str(self.change_password.pk), str(Permission.objects.get(codename="passwordless_console").pk)})
def test_permissions_are_named_in_the_users_language(self):
# the database keeps each permission's English name
page = self.client.get(reverse("admin:user_create"), HTTP_ACCEPT_LANGUAGE="tr").content.decode()
for name in ("Parola değiştirebilir", "Sanal makineleri klonlayabilir", "Parolasız konsol erişimi yapabilir",
"Sanal makinelerin anlık görüntüsünü alabilir", "Sanal makineleri görebilir"):
self.assertIn(name, page)
self.assertNotIn("Can clone instances", page)
def test_groups_and_permissions_are_saved(self):
group = Group.objects.create(name="uc-group")
self.create(groups=[group.pk], user_permissions=[self.change_password.pk])