2014-05-03 20:32:47 +02:00
|
|
|
<?php
|
2014-05-03 22:18:41 +02:00
|
|
|
class GetPostJob extends AbstractPostJob
|
2014-05-03 20:32:47 +02:00
|
|
|
{
|
|
|
|
public function execute()
|
|
|
|
{
|
|
|
|
$post = $this->post;
|
|
|
|
|
|
|
|
//todo: refactor this so that requiresPrivilege can accept multiple privileges
|
2014-05-03 22:14:00 +02:00
|
|
|
if ($post->hidden)
|
2014-05-03 20:32:47 +02:00
|
|
|
Access::assert(Privilege::ViewPost, 'hidden');
|
|
|
|
Access::assert(Privilege::ViewPost);
|
2014-05-03 22:14:00 +02:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|