Registered users can mass tag their own posts

This commit is contained in:
Marcin Kurczewski 2014-02-20 18:44:51 +01:00
parent 4420fa588d
commit 28037af029
3 changed files with 12 additions and 4 deletions

View file

@ -88,6 +88,8 @@ editPostRelations.own=registered
editPostRelations.all=moderator
editPostFile.all=moderator
editPostFile.own=moderator
massTag.own=registered
massTag.all=power-user
hidePost.own=moderator
hidePost.all=moderator
deletePost.own=moderator
@ -125,7 +127,6 @@ editComment.all=admin
listTags=anonymous
mergeTags=moderator
renameTags=moderator
massTag=moderator
listLogs=moderator
viewLog=moderator

View file

@ -73,6 +73,9 @@ class PostController
PrivilegesHelper::confirmWithException(Privilege::MassTag);
$this->context->massTagTag = $additionalInfo;
$this->context->massTagQuery = $query;
if (!PrivilegesHelper::confirm(Privilege::MassTag, 'all'))
$query = trim($query . ' submit:' . $this->context->user->name);
}
$posts = PostSearchService::getEntities($query, $postsPerPage, $page);
@ -104,7 +107,7 @@ class PostController
if (InputHelper::get('submit'))
{
PrivilegesHelper::confirmWithException(Privilege::MassTag);
PrivilegesHelper::confirmWithException(Privilege::MassTag, PrivilegesHelper::getIdentitySubPrivilege($post->getUploader()));
$tags = $post->getTags();

View file

@ -17,6 +17,12 @@ class PrivilegesHelper
$minAccessRank = TextHelper::resolveConstant($minAccessRankName, 'AccessRank');
self::$privileges[$key] = $minAccessRank;
if (!isset(self::$privileges[$privilegeName]) or
self::$privileges[$privilegeName] > $minAccessRank)
{
self::$privileges[$privilegeName] = $minAccessRank;
}
}
}
@ -48,10 +54,8 @@ class PrivilegesHelper
public static function confirmWithException($privilege, $subPrivilege = null)
{
if (!self::confirm($privilege, $subPrivilege))
{
throw new SimpleException('Insufficient privileges');
}
}
public static function getIdentitySubPrivilege($user)
{