]> BookStack Code Mirror - bookstack/blobdiff - app/Http/Controllers/Controller.php
Add git to the apt-get install packages.
[bookstack] / app / Http / Controllers / Controller.php
index e34cb7e5941a137a11bbc6d20d73f97ef1af4a75..034c852de8ae83bb7da82c31fc821dca4524c5c4 100644 (file)
@@ -2,7 +2,6 @@
 
 namespace BookStack\Http\Controllers;
 
-use BookStack\Auth\User;
 use BookStack\Ownable;
 use Illuminate\Foundation\Bus\DispatchesJobs;
 use Illuminate\Foundation\Validation\ValidatesRequests;
@@ -15,22 +14,19 @@ abstract class Controller extends BaseController
     use DispatchesJobs, ValidatesRequests;
 
     /**
-     * @var User static
-     */
-    protected $currentUser;
-
-    /**
-     * @var bool
+     * Controller constructor.
      */
-    protected $signedIn;
+    public function __construct()
+    {
+        //
+    }
 
     /**
-     * Controller constructor.
+     * Check if the current user is signed in.
      */
-    public function __construct()
+    protected function isSignedIn(): bool
     {
-        $this->currentUser = user();
-        $this->signedIn = auth()->check();
+        return auth()->check();
     }
 
     /**
@@ -121,7 +117,7 @@ abstract class Controller extends BaseController
     protected function checkPermissionOrCurrentUser(string $permissionName, int $userId)
     {
         return $this->checkPermissionOr($permissionName, function () use ($userId) {
-            return $userId === $this->currentUser->id;
+            return $userId === user()->id;
         });
     }