浏览代码

Change UX/security for modifying user permissions

master
Jared 1年前
父节点
当前提交
495e81d386
共有 1 个文件被更改,包括 10 次插入7 次删除
  1. +10
    -7
      src/views/ModifyUserView.vue

+ 10
- 7
src/views/ModifyUserView.vue 查看文件

@@ -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>

正在加载...
取消
保存