fix user permissions

This commit is contained in:
Jonathan Baecker 2024-10-24 13:12:56 +02:00
parent 3cf0d12200
commit 532c4b4615
5 changed files with 13 additions and 8 deletions

View File

@ -467,8 +467,7 @@ async fn get_all_channels(
/// ```
#[patch("/channel/{id}")]
#[protect(
"Role::GlobalAdmin",
"Role::ChannelAdmin",
any("Role::GlobalAdmin", "Role::ChannelAdmin"),
ty = "Role",
expr = "user.channels.contains(&*id) || role.has_authority(&Role::GlobalAdmin)"
)]

View File

@ -15,8 +15,9 @@
v-model="channel.name"
type="text"
placeholder="Type here"
class="input input-bordered w-full"
class="input input-bordered w-full !bg-base-100"
@keyup="isChanged"
:disabled="authStore.role === 'User'"
/>
</label>
@ -27,8 +28,9 @@
<input
v-model="channel.preview_url"
type="text"
class="input input-bordered w-full"
class="input input-bordered w-full !bg-base-100"
@keyup="isChanged"
:disabled="authStore.role === 'User'"
/>
</label>
@ -39,8 +41,10 @@
<input
v-model="channel.extra_extensions"
type="text"
class="input input-bordered w-full"
class="input input-bordered w-full !bg-base-100"
:class="'input-disabled'"
@keyup="isChanged"
:disabled="authStore.role === 'User'"
/>
</label>
@ -88,7 +92,7 @@
</label>
</template>
<div class="my-4 flex gap-1">
<div v-if="authStore.role !== 'User'" class="my-4 flex gap-1">
<button class="btn" :class="saved ? 'btn-primary' : 'btn-error'" @click="addUpdateChannel()">
{{ t('config.save') }}
</button>

View File

@ -149,7 +149,9 @@ const user = ref({
} as User)
onMounted(() => {
getUsers()
if (authStore.role === 'GlobalAdmin') {
getUsers()
}
})
async function getUsers() {

View File

@ -17,6 +17,7 @@
Advanced
</button>
<button
v-if="authStore.role !== 'User'"
class="join-item btn btn-sm btn-primary mt-1 duration-500"
:class="activeConf === 3 && 'btn-secondary'"
@click="activeConf = 3"

View File

@ -19,7 +19,6 @@
{{ t('button.logging') }}
</NuxtLink>
<NuxtLink
v-if="authStore.role.toLowerCase().includes('admin')"
:to="localePath({ name: 'configure' })"
class="btn join-item btn-primary px-2"
>