Reduced boilerplate by using default privileges

This commit is contained in:
Marcin Kurczewski 2014-05-04 10:24:59 +02:00
parent 588efcb908
commit f74213bafb
28 changed files with 14 additions and 263 deletions

View file

@ -21,9 +21,20 @@ abstract class AbstractJob
public abstract function execute();
public abstract function requiresAuthentication();
public abstract function requiresConfirmedEmail();
public abstract function requiresPrivilege();
public function requiresAuthentication()
{
return false;
}
public function requiresConfirmedEmail()
{
return false;
}
public function requiresPrivilege()
{
return false;
}
public function getArgument($key)
{

View file

@ -58,11 +58,6 @@ class AddPostJob extends AbstractJob
return Privilege::UploadPost;
}
public function requiresAuthentication()
{
return false;
}
public function requiresConfirmedEmail()
{
return getConfig()->registration->needEmailForUploading;

View file

@ -26,14 +26,4 @@ class EditPostContentJob extends AbstractPostJob
Access::getIdentity($this->post->getUploader())
];
}
public function requiresAuthentication()
{
return false;
}
public function requiresConfirmedEmail()
{
return false;
}
}

View file

@ -31,19 +31,4 @@ class EditPostJob extends AbstractPostJob
return $post;
}
public function requiresPrivilege()
{
return false;
}
public function requiresAuthentication()
{
return false;
}
public function requiresConfirmedEmail()
{
return false;
}
}

View file

@ -41,14 +41,4 @@ class EditPostRelationsJob extends AbstractPostJob
Access::getIdentity($this->post->getUploader())
];
}
public function requiresAuthentication()
{
return false;
}
public function requiresConfirmedEmail()
{
return false;
}
}

View file

@ -32,14 +32,4 @@ class EditPostSafetyJob extends AbstractPostJob
Access::getIdentity($this->post->getUploader())
];
}
public function requiresAuthentication()
{
return false;
}
public function requiresConfirmedEmail()
{
return false;
}
}

View file

@ -32,14 +32,4 @@ class EditPostSourceJob extends AbstractPostJob
Access::getIdentity($this->post->getUploader())
];
}
public function requiresAuthentication()
{
return false;
}
public function requiresConfirmedEmail()
{
return false;
}
}

View file

@ -40,14 +40,4 @@ class EditPostTagsJob extends AbstractPostJob
Access::getIdentity($this->post->getUploader())
];
}
public function requiresAuthentication()
{
return false;
}
public function requiresConfirmedEmail()
{
return false;
}
}

View file

@ -27,14 +27,4 @@ class EditPostThumbJob extends AbstractPostJob
Access::getIdentity($this->post->getUploader())
];
}
public function requiresAuthentication()
{
return false;
}
public function requiresConfirmedEmail()
{
return false;
}
}

View file

@ -27,14 +27,4 @@ class EditPostUrlJob extends AbstractPostJob
Access::getIdentity($this->post->getUploader())
];
}
public function requiresAuthentication()
{
return false;
}
public function requiresConfirmedEmail()
{
return false;
}
}

View file

@ -29,9 +29,4 @@ class FeaturePostJob extends AbstractPostJob
{
return true;
}
public function requiresConfirmedEmail()
{
return false;
}
}

View file

@ -27,14 +27,4 @@ class FlagPostJob extends AbstractPostJob
Access::getIdentity($this->post->getUploader())
];
}
public function requiresAuthentication()
{
return false;
}
public function requiresConfirmedEmail()
{
return false;
}
}

View file

@ -27,14 +27,4 @@ class FlagUserJob extends AbstractUserJob
Access::getIdentity($this->user)
];
}
public function requiresAuthentication()
{
return false;
}
public function requiresConfirmedEmail()
{
return false;
}
}

View file

@ -43,14 +43,4 @@ class GetLogJob extends AbstractPageJob
{
return Privilege::ViewLog;
}
public function requiresAuthentication()
{
return false;
}
public function requiresConfirmedEmail()
{
return false;
}
}

View file

@ -35,14 +35,4 @@ class GetPostContentJob extends AbstractJob
//temporarily enforced in execute
return false;
}
public function requiresAuthentication()
{
return false;
}
public function requiresConfirmedEmail()
{
return false;
}
}

View file

@ -21,14 +21,4 @@ class GetPostJob extends AbstractPostJob
//temporarily enforced in execute
return false;
}
public function requiresAuthentication()
{
return false;
}
public function requiresConfirmedEmail()
{
return false;
}
}

View file

@ -44,14 +44,4 @@ class GetPostThumbJob extends AbstractJob
//manually enforced in execute when post is retrieved
return false;
}
public function requiresAuthentication()
{
return false;
}
public function requiresConfirmedEmail()
{
return false;
}
}

View file

@ -29,14 +29,4 @@ class ListCommentsJob extends AbstractPageJob
{
return Privilege::ListComments;
}
public function requiresAuthentication()
{
return false;
}
public function requiresConfirmedEmail()
{
return false;
}
}

View file

@ -21,14 +21,4 @@ class ListLogsJob extends AbstractJob
{
return Privilege::ListLogs;
}
public function requiresAuthentication()
{
return false;
}
public function requiresConfirmedEmail()
{
return false;
}
}

View file

@ -24,14 +24,4 @@ class ListPostsJob extends AbstractPageJob
{
return Privilege::ListPosts;
}
public function requiresAuthentication()
{
return false;
}
public function requiresConfirmedEmail()
{
return false;
}
}

View file

@ -22,14 +22,4 @@ class ListTagsJob extends AbstractPageJob
{
return Privilege::ListTags;
}
public function requiresAuthentication()
{
return false;
}
public function requiresConfirmedEmail()
{
return false;
}
}

View file

@ -22,14 +22,4 @@ class MergeTagsJob extends AbstractJob
{
return Privilege::MergeTags;
}
public function requiresAuthentication()
{
return false;
}
public function requiresConfirmedEmail()
{
return false;
}
}

View file

@ -22,14 +22,4 @@ class RenameTagsJob extends AbstractJob
{
return Privilege::RenameTags;
}
public function requiresAuthentication()
{
return false;
}
public function requiresConfirmedEmail()
{
return false;
}
}

View file

@ -19,14 +19,4 @@ class ScorePostJob extends AbstractPostJob
Access::getIdentity($this->post->getUploader())
];
}
public function requiresAuthentication()
{
return true;
}
public function requiresConfirmedEmail()
{
return false;
}
}

View file

@ -32,9 +32,4 @@ class TogglePostFavoriteJob extends AbstractPostJob
{
return true;
}
public function requiresConfirmedEmail()
{
return false;
}
}

View file

@ -58,14 +58,4 @@ class TogglePostTagJob extends AbstractPostJob
Access::getIdentity($this->post->getUploader())
];
}
public function requiresAuthentication()
{
return false;
}
public function requiresConfirmedEmail()
{
return false;
}
}

View file

@ -27,14 +27,4 @@ class TogglePostVisibilityJob extends AbstractPostJob
Access::getIdentity($this->post->getUploader())
];
}
public function requiresAuthentication()
{
return true;
}
public function requiresConfirmedEmail()
{
return false;
}
}

View file

@ -25,14 +25,4 @@ class ToggleUserBanJob extends AbstractUserJob
Access::getIdentity($this->user)
];
}
public function requiresAuthentication()
{
return false;
}
public function requiresConfirmedEmail()
{
return false;
}
}