Bulk action permission constant

This commit is contained in:
Matthew Barbour 2019-07-13 17:39:27 -05:00 committed by matthew
parent cb1e9c0075
commit 45df025e7d
3 changed files with 6 additions and 2 deletions

View file

@ -64,4 +64,6 @@ abstract class Permissions
public const VIEW_TRASH = "view_trash";
public const PERFORM_BULK_ACTIONS = "perform_bulk_actions";
}

View file

@ -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", [

View file

@ -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;
}