From 179ebaebc36b6dc470dacad5a9020e4d6bf9921a Mon Sep 17 00:00:00 2001 From: Syndamia Date: Sun, 2 Feb 2025 15:30:53 +0200 Subject: feat: Allow admins to delete lists --- controllers/list.php | 2 +- views/list/delete/index.php | 4 ++-- views/list/index.php | 20 ++++++++++++-------- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/controllers/list.php b/controllers/list.php index e608136..7056088 100644 --- a/controllers/list.php +++ b/controllers/list.php @@ -102,7 +102,7 @@ function on_delete() { try { $user = Database\Cookie::fromDB($TOKEN); $author = Database\User::fromDBuid($list->AuthorUID); - if ($author->UID !== $user->UID) { + if ($author->UID !== $user->UID && $user->Role !== 'Admin') { $list_status = "You're not the owner of this list! You have no permission to delete it!"; return; } diff --git a/views/list/delete/index.php b/views/list/delete/index.php index 02eb37d..19c3b4f 100644 --- a/views/list/delete/index.php +++ b/views/list/delete/index.php @@ -10,9 +10,9 @@ catch(Exception $e) {} ?> -UID === $author->UID): ?> +UID === $author->UID || $user->Role === 'Admin')): ?> -

Are you sure you want to delete Username ?>'s "Name ?>"?

+

Are you sure you want to delete Username ?>'s "Name ?>"?

diff --git a/views/list/index.php b/views/list/index.php index 759ab04..98c2eb4 100644 --- a/views/list/index.php +++ b/views/list/index.php @@ -22,14 +22,18 @@

Description ?>