Bulk action permission constant
This commit is contained in:
parent
cb1e9c0075
commit
45df025e7d
3 changed files with 6 additions and 2 deletions
|
@ -64,4 +64,6 @@ abstract class Permissions
|
|||
|
||||
public const VIEW_TRASH = "view_trash";
|
||||
|
||||
public const PERFORM_BULK_ACTIONS = "perform_bulk_actions";
|
||||
|
||||
}
|
|
@ -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", [
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Reference in a new issue