Added permission check to bans page to only allow it when the user has the EDIT_USERS permission.

This commit is contained in:
Vari
2024-05-20 05:06:46 +02:00
parent 4f865b4d2a
commit a1cd7e3798
3 changed files with 12 additions and 0 deletions

View File

@@ -101,6 +101,9 @@ public function reset(User $user)
public function bans(User $user)
{
if(!Auth::user()->can(Permissions::EDIT_USERS->value))
abort(403, 'You are not allowed to edit Bans of a User.');
$bans = $user->bans;
View::share('title', 'Bans for User: '.$user->id.'('.$user->last_known_username.')');
@@ -128,6 +131,9 @@ public function banPost(User $user, Ban $ban, BanPostRequest $request) {
}
public function createBan(User $user) {
if(!Auth::user()->can(Permissions::EDIT_USERS->value))
abort(403, 'No Permission to create a Ban.');
$newBan = new Ban();
$newBan->ban_reason = 'Placeholder';
$newBan->start_date = Carbon::now()->addWeek();