From ac6d9418e1d7c32488d845acdc7108ef786b8d7e Mon Sep 17 00:00:00 2001 From: Toby Zerner Date: Fri, 20 Jul 2018 10:59:54 +0930 Subject: [PATCH] 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. --- extensions/lock/extend.php | 1 - extensions/lock/src/Access/PostPolicy.php | 37 ----------------------- 2 files changed, 38 deletions(-) delete mode 100755 extensions/lock/src/Access/PostPolicy.php diff --git a/extensions/lock/extend.php b/extensions/lock/extend.php index 4cd1b633a..17d18685f 100644 --- a/extensions/lock/extend.php +++ b/extensions/lock/extend.php @@ -29,6 +29,5 @@ return [ $events->subscribe(Listener\SaveLockedToDatabase::class); $events->subscribe(Access\DiscussionPolicy::class); - $events->subscribe(Access\PostPolicy::class); }, ]; diff --git a/extensions/lock/src/Access/PostPolicy.php b/extensions/lock/src/Access/PostPolicy.php deleted file mode 100755 index a73a55dfa..000000000 --- a/extensions/lock/src/Access/PostPolicy.php +++ /dev/null @@ -1,37 +0,0 @@ - - * - * 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; - } - } -}