mirror of
https://github.com/retspen/webvirtcloud
synced 2026-11-11 12:46:49 +00:00
feat(accounts): the administrator's view of a user as an identity strip and cards
A superuser's page of a user was a heading, two unlabelled icon buttons and three tabs: the VMs a table of check columns, the SSH keys a table that pushed the page sideways on a phone. Now a card at the top shows the user's name, role, Blocked when they are, username, email, groups, last login and joining date, with Edit user and Email OTP QR code as labelled buttons and links to the sections below with their counts. The VMs card shows each VM with its host and what the user may do beyond power and console as badges in the VM Users tab's words (Change settings, Delete the VM, Change console settings), with Change access and Remove from user in a menu, and Add VM in its header. The SSH keys and the API tokens are cards; the key rows are now one include with the user's own Profile, and both lists say when they are empty. The full key shows over its fingerprint. The tab script had no page left and goes.
This commit is contained in:
parent
3c7346c820
commit
0044359202
7 changed files with 131 additions and 136 deletions
|
|
@ -30,9 +30,29 @@ class AccountPageTests(TestCase):
|
|||
self.assertContains(response, "ap-vm")
|
||||
self.assertNotContains(response, "<td>True</td>", html=True)
|
||||
self.assertNotContains(response, "<td>False</td>", html=True)
|
||||
# what the user may do beyond power and console, in the VM Users tab's words, and the VM's host
|
||||
self.assertContains(response, "Power and console only")
|
||||
self.assertNotContains(response, "Change settings")
|
||||
self.assertContains(response, "Host: ap-host")
|
||||
# the console settings come with the right to change the VM
|
||||
UserInstance.objects.filter(user=self.alice).update(is_change=True)
|
||||
response = self.page()
|
||||
self.assertContains(response, "Change settings")
|
||||
self.assertContains(response, "Change console settings")
|
||||
self.assertNotContains(response, "Power and console only")
|
||||
|
||||
def test_a_user_without_vms_is_told_so(self):
|
||||
self.assertContains(self.page(), "No VMs.")
|
||||
def test_a_blocked_user_is_marked(self):
|
||||
self.assertNotContains(self.page(), "Blocked")
|
||||
self.alice.is_active = False
|
||||
self.alice.save()
|
||||
self.assertContains(self.page(), '<span class="badge text-bg-danger">Blocked</span>', html=True)
|
||||
|
||||
def test_a_user_without_vms_or_tokens_is_told_so(self):
|
||||
response = self.page()
|
||||
self.assertContains(response, "No VMs.")
|
||||
self.assertContains(response, "No API tokens.")
|
||||
# the whole key shows over its fingerprint
|
||||
self.assertContains(response, f'title="{KEY}"')
|
||||
|
||||
def test_a_superuser_deletes_a_users_key(self):
|
||||
url = reverse("accounts:account_ssh_key_delete", args=[self.alice.pk, self.key.pk])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue