Added moderator impersonation
This commit is contained in:
@@ -100,6 +100,15 @@
|
||||
Settings
|
||||
</NuxtLink>
|
||||
|
||||
<NuxtLink :to="{ name: 'settings-admin' }" v-if="user.moderator"
|
||||
class="block block px-4 py-2 text-md text-gray-700 hover:bg-gray-100 hover:text-gray-900 dark:text-gray-100 dark:hover:text-white dark:hover:bg-gray-600 flex items-center"
|
||||
>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-4 h-4 mr-2">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M9 12.75 11.25 15 15 9.75m-3-7.036A11.959 11.959 0 0 1 3.598 6 11.99 11.99 0 0 0 3 9.749c0 5.592 3.824 10.29 9 11.623 5.176-1.332 9-6.03 9-11.622 0-1.31-.21-2.571-.598-3.751h-.152c-3.196 0-6.1-1.248-8.25-3.285Z" />
|
||||
</svg>
|
||||
Admin
|
||||
</NuxtLink>
|
||||
|
||||
<a href="#"
|
||||
class="block block px-4 py-2 text-md text-gray-700 dark:text-white hover:bg-gray-100 hover:text-gray-900 dark:text-gray-100 dark:hover:text-white dark:hover:bg-gray-600 flex items-center"
|
||||
@click.prevent="logout"
|
||||
|
||||
1
client/middleware/admin.js
vendored
1
client/middleware/admin.js
vendored
@@ -1,7 +1,6 @@
|
||||
export default defineNuxtRouteMiddleware((to, from) => {
|
||||
const authStore = useAuthStore()
|
||||
if (authStore.check && !authStore.user?.admin) {
|
||||
console.log('redirecting to home')
|
||||
return navigateTo({ name: 'home' })
|
||||
}
|
||||
})
|
||||
|
||||
6
client/middleware/moderator.js
vendored
Normal file
6
client/middleware/moderator.js
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
export default defineNuxtRouteMiddleware((to, from) => {
|
||||
const authStore = useAuthStore()
|
||||
if (authStore.check && !authStore.user?.moderator) {
|
||||
return navigateTo({ name: 'home' })
|
||||
}
|
||||
})
|
||||
@@ -40,7 +40,7 @@ import {opnFetch} from "~/composables/useOpnApi.js";
|
||||
import {fetchAllWorkspaces} from "~/stores/workspaces.js";
|
||||
|
||||
definePageMeta({
|
||||
middleware: "admin"
|
||||
middleware: "moderator"
|
||||
})
|
||||
|
||||
useOpnSeoMeta({
|
||||
|
||||
Reference in New Issue
Block a user