1
0
mirror of https://github.com/flarum/core.git synced 2025-10-15 00:44:40 +02:00

Enforce forum.view permission

This commit is contained in:
Toby Zerner
2015-08-05 18:08:31 +09:30
parent 3f0089e8bb
commit ff8dc5ef25
3 changed files with 7 additions and 2 deletions

View File

@@ -14,6 +14,10 @@ trait VisibleScope
*/
public function scopeWhereVisibleTo(Builder $query, User $actor)
{
event(new ScopeModelVisibility($this, $query, $actor));
if (! app('flarum.forum')->can($actor, 'view')) {
$query->whereRaw('FALSE');
} else {
event(new ScopeModelVisibility($this, $query, $actor));
}
}
}