szurubooru/src/Jobs/GetPostJob.php

35 lines
680 B
PHP
Raw Normal View History

2014-05-03 20:32:47 +02:00
<?php
class GetPostJob extends AbstractPostEditJob
{
public function execute()
{
$post = $this->post;
//todo: refactor this so that requiresPrivilege can accept multiple privileges
if ($post->hidden)
2014-05-03 20:32:47 +02:00
Access::assert(Privilege::ViewPost, 'hidden');
Access::assert(Privilege::ViewPost);
Access::assert(Privilege::ViewPost, PostSafety::toString($post->safety));
2014-05-03 20:32:47 +02:00
CommentModel::preloadCommenters($post->getComments());
return $post;
}
public function requiresPrivilege()
{
//temporarily enforced in execute
return false;
}
public function requiresAuthentication()
{
return false;
}
public function requiresConfirmedEmail()
{
return false;
}
}