Merge pull request #921 from luanalatte/approval-bypass
Approval bypass
This commit is contained in:
commit
a03840c60e
3 changed files with 11 additions and 0 deletions
|
@ -120,6 +120,7 @@ abstract class Permissions
|
|||
public const CRON_ADMIN = "cron_admin";
|
||||
public const APPROVE_IMAGE = "approve_image";
|
||||
public const APPROVE_COMMENT = "approve_comment";
|
||||
public const BYPASS_IMAGE_APPROVAL = "bypass_image_approval";
|
||||
|
||||
public const SET_PRIVATE_IMAGE = "set_private_image";
|
||||
public const SET_OTHERS_PRIVATE_IMAGES = "set_others_private_images";
|
||||
|
|
|
@ -217,6 +217,7 @@ new UserClass("admin", "base", [
|
|||
|
||||
Permissions::APPROVE_IMAGE => true,
|
||||
Permissions::APPROVE_COMMENT => true,
|
||||
Permissions::BYPASS_IMAGE_APPROVAL => true,
|
||||
|
||||
Permissions::CRON_RUN =>true,
|
||||
|
||||
|
|
|
@ -26,6 +26,15 @@ class Approval extends Extension
|
|||
Image::$bool_props[] = "approved";
|
||||
}
|
||||
|
||||
public function onImageAddition(ImageAdditionEvent $event)
|
||||
{
|
||||
global $user, $config;
|
||||
|
||||
if ($config->get_bool(ApprovalConfig::IMAGES) && $user->can(Permissions::BYPASS_IMAGE_APPROVAL)) {
|
||||
self::approve_image($event->image->id);
|
||||
}
|
||||
}
|
||||
|
||||
public function onPageRequest(PageRequestEvent $event)
|
||||
{
|
||||
global $page, $user;
|
||||
|
|
Reference in a new issue