Create a per-user admin page to inspect users

Add page to allow admins to inspect all of the details stored on the
server of a user account.  For now this is just the UserDetails, but
in the future this is planned to be expanded to also show sessions
and logs.
This commit is contained in:
Hornwitser 2025-09-06 15:16:02 +02:00
parent 52973ffa9a
commit d006be251c
7 changed files with 176 additions and 26 deletions

View file

@ -17,7 +17,12 @@
<tr v-for="user in usersStore.users.values()">
<td>{{ user.id }}</td>
<td>
{{ user.name }}
<NuxtLink :to="`/admin/users/${user.id}`">
<template v-if="user.name">
{{ user.name }}
</template>
<i v-else>(empty)</i>
</NuxtLink>
</td>
<td>
<select
@ -39,7 +44,7 @@
<button
v-if="user.isModified()"
type="button"
@click="saveUser(user);"
@click="usersStore.saveUser(user);"
>Save</button>
<button
v-if="user.isModified()"
@ -55,18 +60,6 @@
<script lang="ts" setup>
useEventSource();
const usersStore = useUsersStore();
async function saveUser(user: ClientUser) {
try {
await $fetch("/api/admin/user", {
method: "PATCH",
body: user.toApi(),
});
} catch (err: any) {
console.error(err);
alert(err?.data?.message ?? err.message);
}
}
</script>
<style>