mirror of https://github.com/MarceauKa/shaark.git
🐛 Global privacy and api
This commit is contained in:
parent
3b85083794
commit
72997fd3b5
|
@ -14,11 +14,15 @@ class CheckForGlobalPrivacy
|
|||
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
if (
|
||||
$request->user()
|
||||
|| false === $this->globalPrivacyEnabled()
|
||||
|| $this->inExceptArray($request)
|
||||
) {
|
||||
$user = null;
|
||||
|
||||
foreach (['web', 'api'] as $guard) {
|
||||
if (! $user) {
|
||||
$user = auth($guard)->user();
|
||||
}
|
||||
}
|
||||
|
||||
if ($user || false === $this->globalPrivacyEnabled() || $this->inExceptArray($request)) {
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue