Add user roles system
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
<div class="mb-4 rounded-lg bg-success-400 px-6 py-5 text-base text-success-800 mt-5" role="alert">
|
||||
{{ $alert->text }}
|
||||
@auth
|
||||
@if(Auth::user()->is_admin)
|
||||
@if(Auth::user()->hasRole(\App\Enums\UserRole::ADMINISTRATOR))
|
||||
<form method="POST" action="{{ route('admin.alert.delete', $alert->id) }}" class="float-right hover:text-success-900">
|
||||
@csrf
|
||||
@method('delete')
|
||||
@@ -21,7 +21,7 @@
|
||||
<div class="mb-4 rounded-lg bg-danger-400 px-6 py-5 text-base text-danger-800 mt-5" role="alert">
|
||||
{{ $alert->text }}
|
||||
@auth
|
||||
@if(Auth::user()->is_admin)
|
||||
@if(Auth::user()->hasRole(\App\Enums\UserRole::ADMINISTRATOR))
|
||||
<form method="POST" action="{{ route('admin.alert.delete', $alert->id) }}" class="float-right hover:text-danger-900">
|
||||
@csrf
|
||||
@method('delete')
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
@auth
|
||||
@if(Auth::user()->is_admin)
|
||||
@if(Auth::user()->hasRole(\App\Enums\UserRole::ADMINISTRATOR))
|
||||
<div class="relative p-5 bg-white dark:bg-neutral-700/40 rounded-lg overflow-hidden z-10">
|
||||
<div class="float-left">
|
||||
<a data-te-toggle="modal" data-te-target="#modalUploadEpisode" class="text-xl text-gray-800 dark:text-gray-200 leading-tight cursor-pointer whitespace-nowrap">
|
||||
|
||||
@@ -163,7 +163,7 @@
|
||||
<i class="fa-solid fa-gear"></i> {{ __('nav.settings') }}
|
||||
</x-dropdown-link>
|
||||
|
||||
@if (Auth::user()->is_admin)
|
||||
@if (Auth::user()->hasRole(\App\Enums\UserRole::ADMINISTRATOR))
|
||||
<x-dropdown-link href="{{ route('admin.upload.index') }}">
|
||||
<i class="fa-solid fa-user-tie"></i> Admin
|
||||
</x-dropdown-link>
|
||||
|
||||
@@ -6,12 +6,16 @@
|
||||
<thead class="text-xs text-gray-700 uppercase bg-gray-50 dark:bg-pink-700 dark:text-neutral-200 ">
|
||||
<tr>
|
||||
<th scope="col" class="px-6 py-3">
|
||||
Discord-ID
|
||||
ID
|
||||
</th>
|
||||
<th scope="col" class="px-6 py-3">
|
||||
Discord ID
|
||||
<input
|
||||
class="w-4 h-4 ml-2 text-rose-600 bg-gray-100 border-gray-300 rounded focus:ring-rose-500 dark:focus:ring-rose-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600"
|
||||
type="checkbox"
|
||||
wire:model.live="filtered"
|
||||
value="true"
|
||||
wire:model.live.debounce.600ms="discordId"
|
||||
type="search"
|
||||
id="discord-search"
|
||||
class="ml-2 w-32 h-7 text-sm text-gray-900 border border-gray-300 rounded-lg bg-gray-50 focus:ring-rose-800 focus:border-rose-900 dark:bg-neutral-900 dark:border-neutral-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-rose-800 dark:focus:border-rose-900"
|
||||
placeholder="Search..."
|
||||
>
|
||||
</th>
|
||||
<th scope="col" class="px-6 py-3">
|
||||
@@ -59,14 +63,17 @@
|
||||
<th scope="row" class="px-6 py-4 font-medium text-gray-900 whitespace-nowrap dark:text-white">
|
||||
{{ $user->id }}
|
||||
</th>
|
||||
<td class="px-6 py-4">
|
||||
{{ $user->discord_id ?? 'n/a' }}
|
||||
</td>
|
||||
<td class="px-6 py-4">
|
||||
{{ $user->name }}
|
||||
</td>
|
||||
<td class="px-6 py-4">
|
||||
{{ $user->is_patreon ? 'Yes' : 'No' }}
|
||||
{{ $user->hasRole(\App\Enums\UserRole::SUPPORTER) ? 'Yes' : 'No' }}
|
||||
</td>
|
||||
<td class="px-6 py-4">
|
||||
{{ $user->is_banned ? 'Yes' : 'No' }}
|
||||
{{ $user->hasRole(\App\Enums\UserRole::BANNED) ? 'Yes' : 'No' }}
|
||||
</td>
|
||||
<td class="px-6 py-4">
|
||||
{{ $user->created_at->format('Y-m-d') }}
|
||||
@@ -78,9 +85,9 @@
|
||||
<form method="POST" action="{{ route('admin.user.update') }}">
|
||||
@csrf
|
||||
<input type="hidden" value="{{ $user->id }}" name="id">
|
||||
<input type="hidden" value="{{ $user->is_banned ? 'unban' : 'ban' }}" name="action">
|
||||
<input type="hidden" value="{{ $user->hasRole(\App\Enums\UserRole::BANNED) ? 'unban' : 'ban' }}" name="action">
|
||||
<button type="submit" class="inline-block w-full rounded bg-rose-600 pl-[4px] pr-[4px] p-[1px] text-xs font-medium uppercase leading-normal text-white transition duration-150 ease-in-out hover:bg-rose-700 focus:bg-rose-600">
|
||||
{{ $user->is_banned ? 'Unban' : 'Ban' }}
|
||||
{{ $user->hasRole(\App\Enums\UserRole::BANNED) ? 'Unban' : 'Ban' }}
|
||||
</button>
|
||||
</form>
|
||||
<button wire:click="deleteUserComments('{{ $user->id }}')" class="inline-block w-full rounded bg-red-600 pl-[4px] pr-[4px] p-[1px] text-xs font-medium uppercase leading-normal text-white transition duration-150 ease-in-out hover:bg-rose-700 focus:bg-rose-600">
|
||||
|
||||
@@ -6,10 +6,10 @@
|
||||
<div class="flex-grow">
|
||||
<div class="flex gap-2">
|
||||
<p class="font-medium text-gray-900 dark:text-gray-100">{{ $comment->user->name }}</p>
|
||||
@if($comment->user->is_admin)
|
||||
@if($comment->user->hasRole(\App\Enums\UserRole::ADMINISTRATOR))
|
||||
<a data-te-toggle="tooltip" title="Admin"><i class="fa-solid fa-crown text-yellow-600"></i></a>
|
||||
@endif
|
||||
@if($comment->user->is_patreon)
|
||||
@if($comment->user->hasRole(\App\Enums\UserRole::SUPPORTER))
|
||||
<a data-te-toggle="tooltip" title="Badge of appreciation for the horny people supporting us! :3"><i class="fa-solid fa-hand-holding-heart text-rose-600"></i></a>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
<br>
|
||||
@php $download = $episode->getDownloadByType('UHD'); @endphp
|
||||
@isset($download)
|
||||
@if (!Auth::user()->is_patreon)
|
||||
@if (!Auth::user()->hasRole(\App\Enums\UserRole::SUPPORTER))
|
||||
@if (config('hstream.free_downloads'))
|
||||
<p class="font-bold text-gray-800 dark:text-gray-200">
|
||||
<i class="fa-solid fa-lock-open pr-[4px] text-yellow-600"></i> 4k
|
||||
@@ -91,7 +91,7 @@
|
||||
|
||||
<br>
|
||||
@if ($episode->interpolated_uhd)
|
||||
@if (!Auth::user()->is_patreon)
|
||||
@if (!Auth::user()->hasRole(\App\Enums\UserRole::SUPPORTER))
|
||||
@if (config('hstream.free_downloads'))
|
||||
<p class="font-bold text-gray-800 dark:text-gray-200">
|
||||
<i class="fa-solid fa-lock-open pr-[4px] text-yellow-600"></i> 4k 48fps
|
||||
|
||||
@@ -6,10 +6,10 @@
|
||||
<div class="flex-grow">
|
||||
<div class="flex gap-2">
|
||||
<p class="font-medium text-gray-900 dark:text-gray-100">{{ $comment->user->name }}</p>
|
||||
@if($comment->user->is_admin)
|
||||
@if($comment->user->hasRole(\App\Enums\UserRole::ADMINISTRATOR))
|
||||
<a data-te-toggle="tooltip" title="Admin"><i class="fa-solid fa-crown text-yellow-600"></i></a>
|
||||
@endif
|
||||
@if($comment->user->is_patreon)
|
||||
@if($comment->user->hasRole(\App\Enums\UserRole::SUPPORTER))
|
||||
<a data-te-toggle="tooltip" title="Badge of appreciation for the horny people supporting us! :3"><i class="fa-solid fa-hand-holding-heart text-rose-600"></i></a>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
@include('modals.share')
|
||||
|
||||
@auth
|
||||
@if(Auth::user()->is_admin)
|
||||
@if(Auth::user()->hasRole(\App\Enums\UserRole::ADMINISTRATOR))
|
||||
@include('admin.modals.upload-episode')
|
||||
@include('admin.modals.add-subtitles')
|
||||
@include('admin.modals.edit-episode')
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<div class="flex flex-col py-5 pl-24">
|
||||
<strong class="text-slate-900 text-xl font-bold dark:text-slate-200">
|
||||
{{ $user->name }}
|
||||
@if ($user->is_patreon)
|
||||
@if ($user->hasRole(\App\Enums\UserRole::SUPPORTER))
|
||||
<a data-te-toggle="tooltip" title="Badge of appreciation for the horny people supporting us! :3"><i
|
||||
class="fa-solid fa-hand-holding-heart text-rose-600 animate-pulse"></i></a>
|
||||
@endif
|
||||
|
||||
Reference in New Issue
Block a user