1
0
mirror of https://github.com/flarum/core.git synced 2025-08-05 16:07:34 +02:00

Remove obsolete permission logic

flarum/core#1513 changes the post.edit permission so that it is only
granted if the user also has permission to reply to the discussion. This
means that explicitly revoking the edit permission is no longer
necessary, as it will never be granted in the first place.
This commit is contained in:
Toby Zerner
2018-07-20 10:59:54 +09:30
parent 4aa0729d67
commit ac6d9418e1
2 changed files with 0 additions and 38 deletions

View File

@@ -29,6 +29,5 @@ return [
$events->subscribe(Listener\SaveLockedToDatabase::class); $events->subscribe(Listener\SaveLockedToDatabase::class);
$events->subscribe(Access\DiscussionPolicy::class); $events->subscribe(Access\DiscussionPolicy::class);
$events->subscribe(Access\PostPolicy::class);
}, },
]; ];

View File

@@ -1,37 +0,0 @@
<?php
/*
* This file is part of Flarum.
*
* (c) Toby Zerner <toby.zerner@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Flarum\Lock\Access;
use Flarum\Post\Post;
use Flarum\User\AbstractPolicy;
use Flarum\User\User;
class PostPolicy extends AbstractPolicy
{
/**
* {@inheritdoc}
*/
protected $model = Post::class;
/**
* @param User $actor
* @param Post $post
* @return bool
*/
public function edit(User $actor, Post $post)
{
$discussion = $post->discussion;
if ($discussion->is_locked && $actor->cannot('lock', $discussion)) {
return false;
}
}
}