Browse Source

Change UX/security for modifying user permissions

master
Jared 1 year ago
parent
commit
495e81d386
1 changed files with 10 additions and 7 deletions
  1. +10
    -7
      src/views/ModifyUserView.vue

+ 10
- 7
src/views/ModifyUserView.vue View File

@@ -2,19 +2,19 @@
<section class="section">
<table>
<tr>
<th>
<th class="p-2">
Username
</th>
<th>
<th class="p-2">
Password
</th>
<th>
<th class="p-2">
Privileges
</th>
</tr>
<tr v-for="user in users" :key="user.username">
<td>{{ user.username }}</td>
<td>
<td class="p-2">{{ user.username }}</td>
<td class="p-2">
<template v-if="userData.username === user.username || userData.privileges < 2">
<input type="password"
class="input is-small" :aria-label="`${user.username}'s Password`">
@@ -23,7 +23,7 @@
********
</template>
</td>
<td>
<td class="p-2">
<select class="select is-small" name="" id="" aria-label="User Privilege">
<option :value="privilege"
:selected="getPrivilege(user.admin) === privilege"
@@ -63,7 +63,7 @@ const getPrivilege = (privilege: number) => Privileges[privilege];

const getPrivileges = () => Object.fromEntries(
Object.entries(Privileges)
.filter((p) => /^[0-9]+$/.test(p[1].toString()))
.filter((p) => /^[0-9]+$/.test(p[1].toString()) && p[1] >= userData.value.privileges)
.map((p) => p.reverse()),
);

@@ -80,4 +80,7 @@ table th

table td
font-family monospace

table th, td
border 1px solid #aeaeae
</style>

Loading…
Cancel
Save