mirror of
https://github.com/flarum/framework.git
synced 2025-04-25 06:04:04 +08:00
Check permission through the gate rather than directly on the actor
This commit is contained in:
parent
dfc0cf53b0
commit
be013c6db0
@ -69,7 +69,7 @@ class DiscussionPolicy extends AbstractPolicy
|
||||
*/
|
||||
public function find(User $actor, Builder $query)
|
||||
{
|
||||
if (! $actor->hasPermission('viewDiscussions')) {
|
||||
if ($actor->cannot('viewDiscussions')) {
|
||||
$query->whereRaw('FALSE');
|
||||
} elseif (! $actor->hasPermission('discussion.hide')) {
|
||||
$query->where(function ($query) use ($actor) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user