From db07a14c4e7bd1f539f520c95d76aeb9de0db014 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Nilsved?= Date: Thu, 4 Oct 2018 16:36:18 +0200 Subject: [PATCH] Hide widgets when not logged in --- src/Widgets/ItemHistoryWidget.php | 4 ++-- src/Widgets/MenuWidget.php | 2 +- src/Widgets/PersonalRecentVisitsWidget.php | 2 +- src/Widgets/TeamRecentVisitsWidget.php | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Widgets/ItemHistoryWidget.php b/src/Widgets/ItemHistoryWidget.php index 4a2e652..c69eb75 100644 --- a/src/Widgets/ItemHistoryWidget.php +++ b/src/Widgets/ItemHistoryWidget.php @@ -32,7 +32,7 @@ public function addEntry(string $action, \DateTime $datetime, AdminUser $user = $this->entries->push(compact('action', 'datetime', 'user')); return $this; } - + public function addCreatedEntry(\DateTime $datetime, AdminUser $user = null): ItemHistoryWidgetContract { return $this->addEntry('created', $datetime, $user); @@ -45,6 +45,6 @@ public function addUpdatedEntry(\DateTime $datetime, AdminUser $user = null): It public function isAuthorized(Authorizable $user = null): bool { - return true; + return (bool) $user; } } diff --git a/src/Widgets/MenuWidget.php b/src/Widgets/MenuWidget.php index 4efaaa3..bdc0ba7 100644 --- a/src/Widgets/MenuWidget.php +++ b/src/Widgets/MenuWidget.php @@ -48,6 +48,6 @@ public function getHeadings(): Collection public function isAuthorized(Authorizable $user = null): bool { - return true; + return (bool) $user; } } diff --git a/src/Widgets/PersonalRecentVisitsWidget.php b/src/Widgets/PersonalRecentVisitsWidget.php index b3c0265..2414f24 100644 --- a/src/Widgets/PersonalRecentVisitsWidget.php +++ b/src/Widgets/PersonalRecentVisitsWidget.php @@ -24,7 +24,7 @@ public function toHtml() public function isAuthorized(Authorizable $user = null): bool { - return true; + return (bool) $user; } private function getVisits() diff --git a/src/Widgets/TeamRecentVisitsWidget.php b/src/Widgets/TeamRecentVisitsWidget.php index a785aa0..8b1858f 100644 --- a/src/Widgets/TeamRecentVisitsWidget.php +++ b/src/Widgets/TeamRecentVisitsWidget.php @@ -24,7 +24,7 @@ public function toHtml() public function isAuthorized(Authorizable $user = null): bool { - return true; + return (bool) $user; } private function getVisits()