From 45df025e7d8ea32ed466a6a257e9350b39acdc4e Mon Sep 17 00:00:00 2001 From: Matthew Barbour Date: Sat, 13 Jul 2019 17:39:27 -0500 Subject: [PATCH] Bulk action permission constant --- core/permissions.php | 2 ++ core/userclass.php | 4 +++- ext/bulk_actions/main.php | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/core/permissions.php b/core/permissions.php index f3ab7c6b..a78af388 100644 --- a/core/permissions.php +++ b/core/permissions.php @@ -64,4 +64,6 @@ abstract class Permissions public const VIEW_TRASH = "view_trash"; + public const PERFORM_BULK_ACTIONS = "perform_bulk_actions"; + } \ No newline at end of file diff --git a/core/userclass.php b/core/userclass.php index 4ae2511b..d2d06c0a 100644 --- a/core/userclass.php +++ b/core/userclass.php @@ -133,6 +133,8 @@ new UserClass("base", null, [ Permissions::BULK_EDIT_IMAGE_RATING => false, Permissions::VIEW_TRASH => false, + + Permissions::PERFORM_BULK_ACTIONS => false, ]); new UserClass("anonymous", "base", [ @@ -194,7 +196,7 @@ new UserClass("admin", "base", [ Permissions::EDIT_IMAGE_RATING => true, Permissions::BULK_EDIT_IMAGE_RATING => true, Permissions::VIEW_TRASH => true, - + Permissions::PERFORM_BULK_ACTIONS => true, ]); new UserClass("hellbanned", "user", [ diff --git a/ext/bulk_actions/main.php b/ext/bulk_actions/main.php index 67f652e2..0bfaf1da 100644 --- a/ext/bulk_actions/main.php +++ b/ext/bulk_actions/main.php @@ -147,7 +147,7 @@ class BulkActions extends Extension public function onPageRequest(PageRequestEvent $event) { global $page, $user; - if ($event->page_matches("bulk_action") && $user->can("perform_bulk_actions")) { + if ($event->page_matches("bulk_action") && $user->can(Permissions::PERFORM_BULK_ACTIONS)) { if (!isset($_POST['bulk_action'])) { return; }