Added protection against admins deleting their own accounts

Admins cannot un-verify, block or delete admin accounts. This includes their own and other accounts.
This commit is contained in:
Julian Prieber 2022-07-11 18:00:22 +02:00
parent 6fa31bad06
commit 5f58a1f4ad
1 changed files with 7 additions and 3 deletions

View File

@ -40,9 +40,13 @@
<td>{{ $user->role }}</td> <td>{{ $user->role }}</td>
<td><a href="{{ route('editUser', $user->id ) }}">Edit</a></td> <td><a href="{{ route('editUser', $user->id ) }}">Edit</a></td>
<td><a href="{{ route('showLinksUser', $user->id ) }}" class="text-primary">View</a></td> <td><a href="{{ route('showLinksUser', $user->id ) }}" class="text-primary">View</a></td>
@if(env('REGISTER_AUTH') !== 'auth')<td><a href="{{ route('verifyUser', ['verify' => '-' . $user->email_verified_at, 'id' => $user->id] ) }}" class="text-danger">@if($user->email_verified_at == '')<span>no</span>@else<span style="color:#228B22">yes</span>@endif</a></td>@endif @if(env('REGISTER_AUTH') !== 'auth')
<td><a href="{{ route('blockUser', ['block' => $user->block, 'id' => $user->id] ) }}" class="text-danger">{{ $user->block }}</a></td> <td>@if($user->find($user->id)->role == 'admin' and $user->email_verified_at != '')yes @else
<td><center><a href="{{ route('deleteUser', ['id' => $user->id] ) }}" class="confirmation delete"><i class="bi bi-trash-fill del-icon"></i><span class="hide-mobile-del"> Delete</span></a></center></td> <a href="{{ route('verifyUser', ['verify' => '-' . $user->email_verified_at, 'id' => $user->id] ) }}" class="text-danger">@if($user->email_verified_at == '')<span>no</span>@else<span style="color:#228B22">yes</span></a>@endif</td>
@endif
@endif
<td>@if($user->find($user->id)->role == 'admin')-@else<a href="{{ route('blockUser', ['block' => $user->block, 'id' => $user->id] ) }}" class="text-danger">{{ $user->block }}</a>@endif</td>
<td>@if($user->find($user->id)->role == 'admin')<center>-</center>@else<center><a href="{{ route('deleteUser', ['id' => $user->id] ) }}" class="confirmation delete"><i class="bi bi-trash-fill del-icon"></i><span class="hide-mobile-del"> Delete</span></a></center>@endif</td>
</tr> </tr>
@endforeach @endforeach
</tbody> </tbody>