mirror of
https://github.com/flarum/framework.git
synced 2025-01-22 19:33:01 +08:00
Merge pull request #15 from flarum/tz/1419-restrict-own-permissions
Remove obsolete permission logic
This commit is contained in:
commit
c66897fd92
|
@ -29,6 +29,5 @@ return [
|
|||
$events->subscribe(Listener\SaveLockedToDatabase::class);
|
||||
|
||||
$events->subscribe(Access\DiscussionPolicy::class);
|
||||
$events->subscribe(Access\PostPolicy::class);
|
||||
},
|
||||
];
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user