diff --git a/admin/templates/admin/group_form.html b/admin/templates/admin/group_form.html index 8a008c93..cbc0be4c 100644 --- a/admin/templates/admin/group_form.html +++ b/admin/templates/admin/group_form.html @@ -10,6 +10,7 @@ {% block content %}
{% csrf_token %} + {% if seen %}{% endif %} {% bootstrap_form_errors form type="non_fields" %}
diff --git a/admin/templates/admin/user_form.html b/admin/templates/admin/user_form.html index e934ce4e..1cc1f80c 100644 --- a/admin/templates/admin/user_form.html +++ b/admin/templates/admin/user_form.html @@ -11,6 +11,7 @@ {# who the user is, what they manage, what they may use, then what more they may do #} {% csrf_token %} + {% if seen %}{% endif %} {% bootstrap_form_errors user_form type="non_fields" %}
diff --git a/admin/tests/edits.py b/admin/tests/edits.py new file mode 100644 index 00000000..5e3c36f9 --- /dev/null +++ b/admin/tests/edits.py @@ -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)) diff --git a/admin/tests/test_audit_rows.py b/admin/tests/test_audit_rows.py index 203ec222..190d704a 100644 --- a/admin/tests/test_audit_rows.py +++ b/admin/tests/test_audit_rows.py @@ -5,6 +5,7 @@ from django.test import TestCase from django.urls import reverse from logs.models import Logs +from admin.tests.edits import group_seen, user_seen ATTRIBUTES = {"role": "user", "max_instances": 2, "max_cpus": 2, "max_memory": 2, "max_disk_size": 20} @@ -26,7 +27,7 @@ class UserRowTests(TestCase): def edit(self, user, **changes): data = {"username": user.username, "email": user.email, "is_active": "on", **ATTRIBUTES, "user_permissions": [p.pk for p in user.user_permissions.all()], - "groups": [g.pk for g in user.groups.all()], **changes} + "groups": [g.pk for g in user.groups.all()], "seen": user_seen(user), **changes} return self.client.post(reverse("admin:user_update", args=[user.pk]), data) def test_user_add_change_delete(self): @@ -96,9 +97,10 @@ class GroupAndRemovedVMRowTests(TestCase): self.client.post(reverse("admin:group_create"), {"name": "ops"}) group = Group.objects.get(name="ops") url = reverse("admin:group_update", args=[group.pk]) - self.client.post(url, {"name": "ops", "users": [member.pk]}) - self.client.post(url, {"name": "ops", "users": [member.pk], "permissions": [permission.pk]}) - self.client.post(url, {"name": "ops", "users": [member.pk], "permissions": [permission.pk]}) # no change + self.client.post(url, {"name": "ops", "users": [member.pk], "seen": group_seen(group)}) + self.client.post(url, {"name": "ops", "users": [member.pk], "permissions": [permission.pk], "seen": group_seen(group)}) + # no change + self.client.post(url, {"name": "ops", "users": [member.pk], "permissions": [permission.pk], "seen": group_seen(group)}) self.client.post(reverse("admin:group_delete", args=[group.pk])) self.assertEqual(rows(), [ ("Group ops: add", True), diff --git a/admin/tests/test_user_pages.py b/admin/tests/test_user_pages.py index d87c78a0..f08fd064 100644 --- a/admin/tests/test_user_pages.py +++ b/admin/tests/test_user_pages.py @@ -8,6 +8,7 @@ from django.contrib.messages import get_messages from django.test import TestCase from django.urls import reverse from lxml import html +from admin.tests.edits import user_seen class UserPagesTests(TestCase): @@ -23,7 +24,8 @@ class UserPagesTests(TestCase): def form_data(self, user, **changes): data = {"username": user.username, "is_active": "on", "role": "superuser" if user.is_superuser else "user", - "max_instances": "2", "max_cpus": "2", "max_memory": "2", "max_disk_size": "20", **changes} + "max_instances": "2", "max_cpus": "2", "max_memory": "2", "max_disk_size": "20", "seen": user_seen(user), + **changes} return {key: value for key, value in data.items() if value != ""} def test_an_administrator_cannot_block_delete_or_demote_themselves(self): @@ -71,10 +73,23 @@ class UserPagesTests(TestCase): def test_a_refused_choice_is_said_beside_its_field(self): url = reverse("admin:user_update", args=[self.alice.pk]) response = self.client.post(url, {"username": "up-alice", "is_active": "on", "groups": "99999", "user_permissions": "99999", - "role": "user", "max_instances": 1, "max_cpus": 1, "max_memory": 1, "max_disk_size": 1}) + "role": "user", "max_instances": 1, "max_cpus": 1, "max_memory": 1, "max_disk_size": 1, + "seen": user_seen(self.alice)}) page = html.fromstring(response.content) self.assertEqual(len(page.xpath("//fieldset//div[contains(@class, 'invalid-feedback')]")), 2) + def test_a_form_opened_before_another_change_is_refused(self): + # another administrator blocked alice meanwhile: the form's ticked Active would undo it + url = reverse("admin:user_update", args=[self.alice.pk]) + stale = self.form_data(self.alice, email="alice@example.com") + type(self.alice).objects.filter(pk=self.alice.pk).update(is_active=False) + response = self.client.post(url, stale) + self.assertRedirects(response, url, fetch_redirect_response=False) + self.assertIn("up-alice was changed meanwhile", self.messages(response)[0]) + self.alice.refresh_from_db() + self.assertFalse(self.alice.is_active) + self.assertEqual(self.alice.email, "") + def test_the_quota_shows_no_limit_and_memory_in_gib(self): UserAttributes.objects.filter(user=self.alice).update(max_instances=-1, max_cpus=1, max_memory=1536, max_disk_size=-1) page = html.fromstring(self.client.get(reverse("admin:user_update", args=[self.alice.pk])).content) diff --git a/admin/tests/test_user_update_next.py b/admin/tests/test_user_update_next.py index 1a24c093..d6d25033 100644 --- a/admin/tests/test_user_update_next.py +++ b/admin/tests/test_user_update_next.py @@ -3,6 +3,7 @@ from django.contrib.auth.models import User from django.test import TestCase from django.urls import reverse +from admin.tests.edits import user_seen LIMITS = {"role": "user", "max_instances": 1, "max_cpus": 1, "max_memory": 1, "max_disk_size": 4} @@ -14,7 +15,7 @@ class UserUpdateNextTests(TestCase): def save(self, next_url): url = reverse("admin:user_update", args=[self.user.id]) + "?next=" + next_url - return self.client.post(url, {"username": "un-user", "is_active": "on", **LIMITS}) + return self.client.post(url, {"username": "un-user", "is_active": "on", "seen": user_seen(self.user), **LIMITS}) def test_a_page_of_this_site(self): account = reverse("accounts:account", args=[self.user.id]) diff --git a/admin/tests/test_views.py b/admin/tests/test_views.py index 9d0db069..4fdec63f 100644 --- a/admin/tests/test_views.py +++ b/admin/tests/test_views.py @@ -9,6 +9,7 @@ from lxml import html from accounts.models import ApiToken, UserAttributes from logs.models import Logs +from admin.tests.edits import group_seen, user_seen class AdminTestCase(TestCase): @@ -37,7 +38,8 @@ class AdminTestCase(TestCase): self.assertEqual(response.status_code, 200) response = self.client.post( - reverse("admin:group_update", args=[group_id]), {"name": "Updated Group Test"} + reverse("admin:group_update", args=[group_id]), + {"name": "Updated Group Test", "seen": group_seen(Group.objects.get(pk=group_id))} ) self.assertRedirects(response, reverse("admin:group_list")) @@ -104,7 +106,7 @@ class AdminTestCase(TestCase): for block in (lambda: self.client.post(reverse("admin:user_block", args=[user.id])), lambda: self.client.post(reverse("admin:user_update", args=[user.id]), {"username": "taken", "role": "user", "max_instances": 1, "max_cpus": 1, - "max_memory": 1, "max_disk_size": 1})): + "max_memory": 1, "max_disk_size": 1, "seen": user_seen(user)})): _, token = ApiToken.objects.create(user) self.assertEqual(block().status_code, 302) self.client.post(reverse("admin:user_unblock", args=[user.id])) @@ -145,6 +147,7 @@ class AdminTestCase(TestCase): response = self.client.post( reverse("admin:user_update", args=[user_id]), { + "seen": user_seen(User.objects.get(pk=user_id)), "username": "utest", "role": "user", "max_instances": 2, @@ -221,3 +224,14 @@ class AdminTestCase(TestCase): response = self.client.get(reverse("admin:logs"), {"page": "999"}) self.assertEqual(response.status_code, 200) self.assertEqual(response.context["logs"].number, response.context["logs"].paginator.num_pages) + + def test_a_group_form_opened_before_another_change_is_refused(self): + # another administrator added a member meanwhile: the old form would take it out + group = Group.objects.create(name="stale-group") + seen = group_seen(group) + member = User.objects.create_user("stale-member") + group.user_set.add(member) + url = reverse("admin:group_update", args=[group.pk]) + response = self.client.post(url, {"name": "stale-group", "seen": seen}) + self.assertRedirects(response, url, fetch_redirect_response=False) + self.assertEqual(list(group.user_set.all()), [member]) diff --git a/admin/views.py b/admin/views.py index 2ca9cf44..405a5da7 100644 --- a/admin/views.py +++ b/admin/views.py @@ -21,11 +21,24 @@ from instances.models import InstanceTombstone from instances.report import workbook from logs.audit import audit, changed_fields, snapshot from logs.models import Logs +from vrtManager import util from . import forms from .decorators import superuser_only +def form_seen(*snapshots): + """The fingerprint of what an edit form shows (snapshot()s), which it sends + back: a form opened before another administrator's change would undo it. + A password or a login of the user is no change of the form.""" + shown = [sorted((key, sorted(value) if isinstance(value, frozenset) else value) + for key, value in snap.items() if key not in ("password", "last_login")) for snap in snapshots] + return util.digest(repr(shown)) + + +STALE = _("%(name)s was changed meanwhile: here it is as it is now; make your change again") + + def group_snapshot(group): """snapshot() of a group with its members, which are a reverse relation snapshot() does not see.""" return snapshot(group) | {"users": frozenset(group.user_set.values_list("pk", flat=True))} @@ -65,6 +78,10 @@ def group_create(request): def group_update(request, pk): group = get_object_or_404(Group, pk=pk) subject, before = f"Group {group.name}", group_snapshot(group) + seen = form_seen(before) + if request.method == "POST" and request.POST.get("seen") != seen: + messages.error(request, STALE % {"name": group.name}) + return redirect(request.get_full_path()) form = forms.GroupForm(request.POST or None, instance=group) if form.is_valid(): with audit(request, None, subject, "change") as entry: @@ -80,6 +97,7 @@ def group_update(request, pk): { "form": form, "group": group, + "seen": seen, "title": _("Update Group"), }, ) @@ -165,6 +183,10 @@ def user_update(request, pk): attributes, attributes_created = UserAttributes.objects.get_or_create(user=user) subject = f"User {user.username}" before, before_attributes = snapshot(user), snapshot(attributes) + seen = form_seen(before, before_attributes) + if request.method == "POST" and request.POST.get("seen") != seen: + messages.error(request, STALE % {"name": user.username}) + return redirect(request.get_full_path()) user_form = forms.UserForm(request.POST or None, instance=user) attributes_form = forms.UserAttributesForm( request.POST or None, instance=attributes @@ -197,6 +219,7 @@ def user_update(request, pk): "user_form": user_form, "attributes_form": attributes_form, "edited_user": user, + "seen": seen, "title": _("Update User"), }, ) diff --git a/locale/tr/LC_MESSAGES/django.mo b/locale/tr/LC_MESSAGES/django.mo index 7770d904..eb3120bf 100644 Binary files a/locale/tr/LC_MESSAGES/django.mo and b/locale/tr/LC_MESSAGES/django.mo differ diff --git a/locale/tr/LC_MESSAGES/django.po b/locale/tr/LC_MESSAGES/django.po index d389cb2e..384b966f 100644 --- a/locale/tr/LC_MESSAGES/django.po +++ b/locale/tr/LC_MESSAGES/django.po @@ -11,7 +11,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-11-13 11:27+0000\n" +"POT-Creation-Date: 2026-11-13 11:29+0000\n" "PO-Revision-Date: 2020-11-04 12:00+0000\n" "Last-Translator: catborise , 2020\n" "Language-Team: Turkish (https://www.transifex.com/catborise/teams/110663/tr/)\n" @@ -99,7 +99,7 @@ msgstr "bir yıl içinde" #: accounts/forms.py:98 accounts/templates/account.html:29 #: accounts/templates/api_token_list.html:19 #: accounts/templates/api_token_list.html:20 accounts/templates/profile.html:25 -#: admin/templates/admin/user_form.html:21 +#: admin/templates/admin/user_form.html:22 #: admin/templates/admin/user_list.html:56 #: operations/templates/operations/jobs.html:15 #: operations/templatetags/operations.py:91 @@ -179,7 +179,7 @@ msgid "Blocked" msgstr "Engelli" #: accounts/templates/account.html:29 accounts/templates/profile.html:25 -#: admin/templates/admin/user_form.html:21 +#: admin/templates/admin/user_form.html:22 #: admin/templates/admin/user_list.html:56 msgid "Last login" msgstr "Son oturum" @@ -285,8 +285,8 @@ msgstr "Burada oturumunuz açık kalır; diğer oturumlarınız kapanır." #: accounts/templates/accounts/change_password_form.html:35 #: accounts/templates/accounts/email_otp_form.html:25 -#: admin/templates/admin/group_form.html:72 -#: admin/templates/admin/user_form.html:159 +#: admin/templates/admin/group_form.html:73 +#: admin/templates/admin/user_form.html:160 #: admin/templates/admin/user_password_form.html:48 #: computes/templates/computes/form.html:45 #: console/templates/console-vnc.html:86 @@ -321,7 +321,7 @@ msgid "Cancel" msgstr "İptal" #: accounts/templates/accounts/change_password_form.html:36 -#: admin/templates/admin/user_form.html:34 +#: admin/templates/admin/user_form.html:35 #: admin/templates/admin/user_password_form.html:49 msgid "Change password" msgstr "Parolayı değiştir" @@ -367,7 +367,7 @@ msgid "Enter username" msgstr "Kullanıcı adını girin" #: accounts/templates/accounts/otp_login.html:37 -#: accounts/templates/login.html:36 admin/templates/admin/user_form.html:31 +#: accounts/templates/login.html:36 admin/templates/admin/user_form.html:32 #: console/templates/console-vnc.html:82 instances/forms.py:27 #: instances/templates/instances/access_tab.html:53 msgid "Password" @@ -731,14 +731,14 @@ msgstr "Listelerde tüm sanal makineleri ve sunucuları salt okunur görme" msgid "User" msgstr "Kullanıcı" -#: admin/forms.py:96 admin/templates/admin/group_form.html:30 +#: admin/forms.py:96 admin/templates/admin/group_form.html:31 msgid "Permissions" msgstr "İzinler" #: admin/forms.py:103 admin/templates/admin/group_list.html:6 #: admin/templates/admin/group_list.html:8 #: admin/templates/admin/group_list.html:24 -#: admin/templates/admin/user_form.html:123 templates/navbar.html:33 +#: admin/templates/admin/user_form.html:124 templates/navbar.html:33 msgid "Groups" msgstr "Gruplar" @@ -809,30 +809,30 @@ msgstr "Parolasız" msgid "A user without a password cannot be made to change it" msgstr "Parolası olmayan bir kullanıcıya parola değiştirme zorunluluğu konamaz" -#: admin/templates/admin/group_form.html:18 +#: admin/templates/admin/group_form.html:19 msgid "Group" msgstr "Grup" -#: admin/templates/admin/group_form.html:19 +#: admin/templates/admin/group_form.html:20 msgid "Users who share a set of permissions." msgstr "Aynı izinleri paylaşan kullanıcılar." -#: admin/templates/admin/group_form.html:31 +#: admin/templates/admin/group_form.html:32 msgid "Each member has these permissions besides their own." msgstr "Her üye kendi izinlerine ek olarak bu izinlere sahiptir." -#: admin/templates/admin/group_form.html:54 -#: admin/templates/admin/group_form.html:58 +#: admin/templates/admin/group_form.html:55 +#: admin/templates/admin/group_form.html:59 #: interfaces/templates/interface.html:113 #: interfaces/templates/interfaces.html:52 msgid "Members" msgstr "Üyeler" -#: admin/templates/admin/group_form.html:55 +#: admin/templates/admin/group_form.html:56 msgid "Who gets these permissions." msgstr "Bu izinleri kimlerin alacağı." -#: admin/templates/admin/group_form.html:59 +#: admin/templates/admin/group_form.html:60 #: admin/templates/admin/group_list.html:25 admin/templates/admin/logs.html:20 #: admin/templates/admin/logs.html:26 #: admin/templates/admin/tombstone_list.html:20 @@ -843,22 +843,22 @@ msgstr "Bu izinleri kimlerin alacağı." msgid "Search" msgstr "Ara" -#: admin/templates/admin/group_form.html:59 +#: admin/templates/admin/group_form.html:60 #: admin/templates/admin/user_list.html:20 msgid "Search users" msgstr "Kullanıcı ara" -#: admin/templates/admin/group_form.html:65 +#: admin/templates/admin/group_form.html:66 #: admin/templates/admin/user_list.html:86 msgid "No user matches the search." msgstr "Aramayla eşleşen kullanıcı yok." -#: admin/templates/admin/group_form.html:73 -#: admin/templates/admin/user_form.html:160 +#: admin/templates/admin/group_form.html:74 +#: admin/templates/admin/user_form.html:161 msgid "Save changes" msgstr "Değişiklikleri kaydet" -#: admin/templates/admin/group_form.html:73 +#: admin/templates/admin/group_form.html:74 msgid "Create group" msgstr "Grup oluştur" @@ -867,7 +867,7 @@ msgid "New group" msgstr "Yeni grup" #: admin/templates/admin/group_list.html:19 -#: admin/templates/admin/user_form.html:131 +#: admin/templates/admin/user_form.html:132 msgid "There are no groups yet." msgstr "Henüz grup yok." @@ -961,16 +961,16 @@ msgstr "Sonuç" msgid "IP" msgstr "IP" -#: admin/templates/admin/logs.html:56 admin/views.py:299 instances/states.py:19 +#: admin/templates/admin/logs.html:56 admin/views.py:322 instances/states.py:19 #: instances/views.py:441 logs/views.py:18 msgid "Unknown" msgstr "Bilinmeyen" -#: admin/templates/admin/logs.html:56 admin/views.py:299 logs/views.py:18 +#: admin/templates/admin/logs.html:56 admin/views.py:322 logs/views.py:18 msgid "Done" msgstr "Tamamlandı" -#: admin/templates/admin/logs.html:56 admin/views.py:299 logs/views.py:18 +#: admin/templates/admin/logs.html:56 admin/views.py:322 logs/views.py:18 #: operations/templates/operations/job.html:107 msgid "Failed" msgstr "Başarısız" @@ -1022,84 +1022,84 @@ msgstr "sona erer" msgid "No removed VM matches the search." msgstr "Aramayla eşleşen kaldırılmış sanal makine yok." -#: admin/templates/admin/user_form.html:19 +#: admin/templates/admin/user_form.html:20 msgid "Account" msgstr "Hesap" -#: admin/templates/admin/user_form.html:23 +#: admin/templates/admin/user_form.html:24 msgid "What the user signs in with." msgstr "Kullanıcının oturum açtığı bilgiler." -#: admin/templates/admin/user_form.html:33 +#: admin/templates/admin/user_form.html:34 msgid "Set" msgstr "Ayarla" -#: admin/templates/admin/user_form.html:33 +#: admin/templates/admin/user_form.html:34 msgid "Not set" msgstr "Ayarlanmadı" -#: admin/templates/admin/user_form.html:47 +#: admin/templates/admin/user_form.html:48 msgid "May sign in" msgstr "Oturum açabilir" -#: admin/templates/admin/user_form.html:48 +#: admin/templates/admin/user_form.html:49 msgid "Turn off to block the user while keeping the account." msgstr "Hesabı koruyarak kullanıcıyı engellemek için kapatın." -#: admin/templates/admin/user_form.html:57 +#: admin/templates/admin/user_form.html:58 msgid "Role" msgstr "Rol" -#: admin/templates/admin/user_form.html:58 +#: admin/templates/admin/user_form.html:59 msgid "What the user manages." msgstr "Kullanıcının neyi yönettiği." -#: admin/templates/admin/user_form.html:61 +#: admin/templates/admin/user_form.html:62 msgid "Uses the VMs given to them, within their quota." msgstr "Kotası dahilinde kendisine verilen sanal makineleri kullanır." -#: admin/templates/admin/user_form.html:62 +#: admin/templates/admin/user_form.html:63 msgid "May change and delete the template VMs given to them." msgstr "Kendisine verilen şablon sanal makineleri değiştirebilir ve silebilir." -#: admin/templates/admin/user_form.html:63 +#: admin/templates/admin/user_form.html:64 msgid "Manages the panel: every permission, no quota." msgstr "Paneli yönetir: tüm izinler, kota yok." -#: admin/templates/admin/user_form.html:83 +#: admin/templates/admin/user_form.html:84 msgid "" "A superuser has every permission and no quota: there is nothing more to set." msgstr "" "Süperkullanıcının tüm izinleri vardır ve kotası yoktur: ayarlanacak başka bir" " şey yok." -#: admin/templates/admin/user_form.html:89 +#: admin/templates/admin/user_form.html:90 msgid "Quota" msgstr "Kota" -#: admin/templates/admin/user_form.html:90 +#: admin/templates/admin/user_form.html:91 msgid "The most the user's VMs may have in total." msgstr "Kullanıcının sanal makinelerinin toplamda alabileceği en fazla kaynak." -#: admin/templates/admin/user_form.html:118 +#: admin/templates/admin/user_form.html:119 msgid "Groups and permissions" msgstr "Gruplar ve izinler" -#: admin/templates/admin/user_form.html:119 +#: admin/templates/admin/user_form.html:120 msgid "The permissions of the user's groups apply too." msgstr "Kullanıcının gruplarının izinleri de geçerlidir." -#: admin/templates/admin/user_form.html:137 +#: admin/templates/admin/user_form.html:138 msgid "Own permissions" msgstr "Kendi izinleri" -#: admin/templates/admin/user_form.html:138 +#: admin/templates/admin/user_form.html:139 msgid "Off grants nothing here; it takes away nothing a group grants." msgstr "" "Kapalı olması burada hiçbir şey vermez; bir grubun verdiği hiçbir şeyi de " "geri almaz." -#: admin/templates/admin/user_form.html:160 +#: admin/templates/admin/user_form.html:161 msgid "Create user" msgstr "Kullanıcı oluştur" @@ -1107,7 +1107,7 @@ msgstr "Kullanıcı oluştur" msgid "New user" msgstr "Yeni kullanıcı" -#: admin/templates/admin/user_list.html:19 admin/views.py:124 +#: admin/templates/admin/user_list.html:19 admin/views.py:142 #: instances/templates/instances/settings_tab.html:79 templates/navbar.html:32 msgid "Users" msgstr "Kullanıcılar" @@ -1166,51 +1166,59 @@ msgstr "Burada belirlenen parolayla oturum açar." msgid "Signs in another way, such as LDAP. The current password is removed." msgstr "LDAP gibi başka bir yolla oturum açar. Mevcut parola kaldırılır." -#: admin/views.py:59 +#: admin/views.py:39 +#, python-format +msgid "" +"%(name)s was changed meanwhile: here it is as it is now; make your change " +"again" +msgstr "" +"%(name)s bu arada değişti: güncel hâli aşağıda; değişikliğinizi yeniden yapın" + +#: admin/views.py:72 msgid "Create Group" msgstr "Grup Oluştur" -#: admin/views.py:83 +#: admin/views.py:101 msgid "Update Group" msgstr "Grubu Güncelle" -#: admin/views.py:99 +#: admin/views.py:117 msgid "Its members stay but lose the permissions it gave them." msgstr "Üyeleri kalır ancak grubun onlara verdiği izinleri kaybeder." -#: admin/views.py:105 +#: admin/views.py:123 msgid "You cannot block, delete or demote your own account" msgstr "Kendi hesabınızı engelleyemez, silemez veya yetkisini düşüremezsiniz" -#: admin/views.py:156 +#: admin/views.py:174 msgid "Create User" msgstr "Kullanıcı Oluştur" -#: admin/views.py:200 +#: admin/views.py:223 msgid "Update User" msgstr "Kullanıcı Güncelle" -#: admin/views.py:224 +#: admin/views.py:247 #, python-format msgid "Password changed for %(user)s" msgstr "%(user)s parolası değiştirildi" -#: admin/views.py:248 +#: admin/views.py:271 msgid "Their access to VMs, SSH keys and settings go; the VMs themselves stay." msgstr "" "Sanal makinelere erişimi, SSH anahtarları ve ayarları silinir; sanal " "makinelerin kendisi kalır." -#: admin/views.py:348 +#: admin/views.py:371 msgid "deleted user" msgstr "silinmiş kullanıcı" -#: admin/views.py:360 +#: admin/views.py:383 #, python-format msgid "Removed VM %(name)s deleted" msgstr "Kaldırılan sanal makine %(name)s silindi" -#: admin/views.py:367 +#: admin/views.py:390 msgid "Its owners no longer get the VM back if its UUID shows up again." msgstr "" "UUID'si yeniden görünse bile sahipleri sanal makineyi artık geri almaz." diff --git a/locale/zh/LC_MESSAGES/django.mo b/locale/zh/LC_MESSAGES/django.mo index 8d8d6be5..00dcc009 100644 Binary files a/locale/zh/LC_MESSAGES/django.mo and b/locale/zh/LC_MESSAGES/django.mo differ diff --git a/locale/zh/LC_MESSAGES/django.po b/locale/zh/LC_MESSAGES/django.po index 5a3ca63d..15a9b3ba 100644 --- a/locale/zh/LC_MESSAGES/django.po +++ b/locale/zh/LC_MESSAGES/django.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-11-13 11:27+0000\n" +"POT-Creation-Date: 2026-11-13 11:29+0000\n" "PO-Revision-Date: \n" "Last-Translator: \n" "Language-Team: \n" @@ -96,7 +96,7 @@ msgstr "一年后" #: accounts/forms.py:98 accounts/templates/account.html:29 #: accounts/templates/api_token_list.html:19 #: accounts/templates/api_token_list.html:20 accounts/templates/profile.html:25 -#: admin/templates/admin/user_form.html:21 +#: admin/templates/admin/user_form.html:22 #: admin/templates/admin/user_list.html:56 #: operations/templates/operations/jobs.html:15 #: operations/templatetags/operations.py:91 @@ -176,7 +176,7 @@ msgid "Blocked" msgstr "已禁用" #: accounts/templates/account.html:29 accounts/templates/profile.html:25 -#: admin/templates/admin/user_form.html:21 +#: admin/templates/admin/user_form.html:22 #: admin/templates/admin/user_list.html:56 msgid "Last login" msgstr "上次登录" @@ -280,8 +280,8 @@ msgstr "您在此处保持登录;您的其他会话将结束。" #: accounts/templates/accounts/change_password_form.html:35 #: accounts/templates/accounts/email_otp_form.html:25 -#: admin/templates/admin/group_form.html:72 -#: admin/templates/admin/user_form.html:159 +#: admin/templates/admin/group_form.html:73 +#: admin/templates/admin/user_form.html:160 #: admin/templates/admin/user_password_form.html:48 #: computes/templates/computes/form.html:45 #: console/templates/console-vnc.html:86 @@ -316,7 +316,7 @@ msgid "Cancel" msgstr "取消" #: accounts/templates/accounts/change_password_form.html:36 -#: admin/templates/admin/user_form.html:34 +#: admin/templates/admin/user_form.html:35 #: admin/templates/admin/user_password_form.html:49 msgid "Change password" msgstr "修改密码" @@ -362,7 +362,7 @@ msgid "Enter username" msgstr "输入用户名" #: accounts/templates/accounts/otp_login.html:37 -#: accounts/templates/login.html:36 admin/templates/admin/user_form.html:31 +#: accounts/templates/login.html:36 admin/templates/admin/user_form.html:32 #: console/templates/console-vnc.html:82 instances/forms.py:27 #: instances/templates/instances/access_tab.html:53 msgid "Password" @@ -711,14 +711,14 @@ msgstr "在列表中查看所有虚拟机和主机(只读)" msgid "User" msgstr "用户" -#: admin/forms.py:96 admin/templates/admin/group_form.html:30 +#: admin/forms.py:96 admin/templates/admin/group_form.html:31 msgid "Permissions" msgstr "权限" #: admin/forms.py:103 admin/templates/admin/group_list.html:6 #: admin/templates/admin/group_list.html:8 #: admin/templates/admin/group_list.html:24 -#: admin/templates/admin/user_form.html:123 templates/navbar.html:33 +#: admin/templates/admin/user_form.html:124 templates/navbar.html:33 msgid "Groups" msgstr "用户组" @@ -786,30 +786,30 @@ msgstr "不使用密码" msgid "A user without a password cannot be made to change it" msgstr "没有密码的用户无法被要求修改密码" -#: admin/templates/admin/group_form.html:18 +#: admin/templates/admin/group_form.html:19 msgid "Group" msgstr "用户组" -#: admin/templates/admin/group_form.html:19 +#: admin/templates/admin/group_form.html:20 msgid "Users who share a set of permissions." msgstr "共享同一组权限的用户。" -#: admin/templates/admin/group_form.html:31 +#: admin/templates/admin/group_form.html:32 msgid "Each member has these permissions besides their own." msgstr "每个成员除自身权限外还拥有这些权限。" -#: admin/templates/admin/group_form.html:54 -#: admin/templates/admin/group_form.html:58 +#: admin/templates/admin/group_form.html:55 +#: admin/templates/admin/group_form.html:59 #: interfaces/templates/interface.html:113 #: interfaces/templates/interfaces.html:52 msgid "Members" msgstr "成员" -#: admin/templates/admin/group_form.html:55 +#: admin/templates/admin/group_form.html:56 msgid "Who gets these permissions." msgstr "获得这些权限的用户。" -#: admin/templates/admin/group_form.html:59 +#: admin/templates/admin/group_form.html:60 #: admin/templates/admin/group_list.html:25 admin/templates/admin/logs.html:20 #: admin/templates/admin/logs.html:26 #: admin/templates/admin/tombstone_list.html:20 @@ -820,22 +820,22 @@ msgstr "获得这些权限的用户。" msgid "Search" msgstr "搜索" -#: admin/templates/admin/group_form.html:59 +#: admin/templates/admin/group_form.html:60 #: admin/templates/admin/user_list.html:20 msgid "Search users" msgstr "搜索用户" -#: admin/templates/admin/group_form.html:65 +#: admin/templates/admin/group_form.html:66 #: admin/templates/admin/user_list.html:86 msgid "No user matches the search." msgstr "没有与搜索匹配的用户。" -#: admin/templates/admin/group_form.html:73 -#: admin/templates/admin/user_form.html:160 +#: admin/templates/admin/group_form.html:74 +#: admin/templates/admin/user_form.html:161 msgid "Save changes" msgstr "保存更改" -#: admin/templates/admin/group_form.html:73 +#: admin/templates/admin/group_form.html:74 msgid "Create group" msgstr "创建用户组" @@ -844,7 +844,7 @@ msgid "New group" msgstr "新建用户组" #: admin/templates/admin/group_list.html:19 -#: admin/templates/admin/user_form.html:131 +#: admin/templates/admin/user_form.html:132 msgid "There are no groups yet." msgstr "还没有用户组。" @@ -936,16 +936,16 @@ msgstr "结果" msgid "IP" msgstr "IP" -#: admin/templates/admin/logs.html:56 admin/views.py:299 instances/states.py:19 +#: admin/templates/admin/logs.html:56 admin/views.py:322 instances/states.py:19 #: instances/views.py:441 logs/views.py:18 msgid "Unknown" msgstr "未知" -#: admin/templates/admin/logs.html:56 admin/views.py:299 logs/views.py:18 +#: admin/templates/admin/logs.html:56 admin/views.py:322 logs/views.py:18 msgid "Done" msgstr "完成" -#: admin/templates/admin/logs.html:56 admin/views.py:299 logs/views.py:18 +#: admin/templates/admin/logs.html:56 admin/views.py:322 logs/views.py:18 #: operations/templates/operations/job.html:107 msgid "Failed" msgstr "失败" @@ -995,80 +995,80 @@ msgstr "过期" msgid "No removed VM matches the search." msgstr "没有与搜索匹配的已移除虚拟机。" -#: admin/templates/admin/user_form.html:19 +#: admin/templates/admin/user_form.html:20 msgid "Account" msgstr "账户" -#: admin/templates/admin/user_form.html:23 +#: admin/templates/admin/user_form.html:24 msgid "What the user signs in with." msgstr "用户登录所用的信息。" -#: admin/templates/admin/user_form.html:33 +#: admin/templates/admin/user_form.html:34 msgid "Set" msgstr "已设置" -#: admin/templates/admin/user_form.html:33 +#: admin/templates/admin/user_form.html:34 msgid "Not set" msgstr "未设置" -#: admin/templates/admin/user_form.html:47 +#: admin/templates/admin/user_form.html:48 msgid "May sign in" msgstr "可以登录" -#: admin/templates/admin/user_form.html:48 +#: admin/templates/admin/user_form.html:49 msgid "Turn off to block the user while keeping the account." msgstr "关闭后将禁用该用户,但保留账户。" -#: admin/templates/admin/user_form.html:57 +#: admin/templates/admin/user_form.html:58 msgid "Role" msgstr "角色" -#: admin/templates/admin/user_form.html:58 +#: admin/templates/admin/user_form.html:59 msgid "What the user manages." msgstr "用户可以管理的内容。" -#: admin/templates/admin/user_form.html:61 +#: admin/templates/admin/user_form.html:62 msgid "Uses the VMs given to them, within their quota." msgstr "在配额范围内使用分配给其的虚拟机。" -#: admin/templates/admin/user_form.html:62 +#: admin/templates/admin/user_form.html:63 msgid "May change and delete the template VMs given to them." msgstr "可修改和删除分配给他们的模板虚拟机。" -#: admin/templates/admin/user_form.html:63 +#: admin/templates/admin/user_form.html:64 msgid "Manages the panel: every permission, no quota." msgstr "管理面板:拥有所有权限,不受配额限制。" -#: admin/templates/admin/user_form.html:83 +#: admin/templates/admin/user_form.html:84 msgid "" "A superuser has every permission and no quota: there is nothing more to set." msgstr "超级用户拥有所有权限且不受配额限制:无需再设置其他内容。" -#: admin/templates/admin/user_form.html:89 +#: admin/templates/admin/user_form.html:90 msgid "Quota" msgstr "配额" -#: admin/templates/admin/user_form.html:90 +#: admin/templates/admin/user_form.html:91 msgid "The most the user's VMs may have in total." msgstr "用户的虚拟机总共可使用的最大资源。" -#: admin/templates/admin/user_form.html:118 +#: admin/templates/admin/user_form.html:119 msgid "Groups and permissions" msgstr "用户组和权限" -#: admin/templates/admin/user_form.html:119 +#: admin/templates/admin/user_form.html:120 msgid "The permissions of the user's groups apply too." msgstr "用户所在用户组的权限同样适用。" -#: admin/templates/admin/user_form.html:137 +#: admin/templates/admin/user_form.html:138 msgid "Own permissions" msgstr "自身权限" -#: admin/templates/admin/user_form.html:138 +#: admin/templates/admin/user_form.html:139 msgid "Off grants nothing here; it takes away nothing a group grants." msgstr "关闭不会在此授予任何权限,也不会撤销用户组授予的权限。" -#: admin/templates/admin/user_form.html:160 +#: admin/templates/admin/user_form.html:161 msgid "Create user" msgstr "创建用户" @@ -1076,7 +1076,7 @@ msgstr "创建用户" msgid "New user" msgstr "新建用户" -#: admin/templates/admin/user_list.html:19 admin/views.py:124 +#: admin/templates/admin/user_list.html:19 admin/views.py:142 #: instances/templates/instances/settings_tab.html:79 templates/navbar.html:32 msgid "Users" msgstr "用户" @@ -1134,49 +1134,56 @@ msgstr "使用此处设置的密码登录。" msgid "Signs in another way, such as LDAP. The current password is removed." msgstr "通过其他方式(如 LDAP)登录。当前密码将被移除。" -#: admin/views.py:59 +#: admin/views.py:39 +#, python-format +msgid "" +"%(name)s was changed meanwhile: here it is as it is now; make your change " +"again" +msgstr "%(name)s 在此期间已更改:以下是其当前状态;请重新进行更改" + +#: admin/views.py:72 msgid "Create Group" msgstr "创建用户组" -#: admin/views.py:83 +#: admin/views.py:101 msgid "Update Group" msgstr "更新用户组" -#: admin/views.py:99 +#: admin/views.py:117 msgid "Its members stay but lose the permissions it gave them." msgstr "其成员仍保留,但会失去该用户组授予的权限。" -#: admin/views.py:105 +#: admin/views.py:123 msgid "You cannot block, delete or demote your own account" msgstr "不能禁用、删除或降级你自己的账户" -#: admin/views.py:156 +#: admin/views.py:174 msgid "Create User" msgstr "创建用户" -#: admin/views.py:200 +#: admin/views.py:223 msgid "Update User" msgstr "更新用户" -#: admin/views.py:224 +#: admin/views.py:247 #, python-format msgid "Password changed for %(user)s" msgstr "已为 %(user)s 修改密码" -#: admin/views.py:248 +#: admin/views.py:271 msgid "Their access to VMs, SSH keys and settings go; the VMs themselves stay." msgstr "其对虚拟机、SSH 密钥和设置的访问将被移除;虚拟机本身保留。" -#: admin/views.py:348 +#: admin/views.py:371 msgid "deleted user" msgstr "已删除的用户" -#: admin/views.py:360 +#: admin/views.py:383 #, python-format msgid "Removed VM %(name)s deleted" msgstr "已删除已移除的虚拟机 %(name)s" -#: admin/views.py:367 +#: admin/views.py:390 msgid "Its owners no longer get the VM back if its UUID shows up again." msgstr "若其 UUID 再次出现,其所有者将不再恢复对该虚拟机的所有权。"