]> _ Git - odl.git/commitdiff
wait #4764
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 14 Feb 2022 15:19:27 +0000 (16:19 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 14 Feb 2022 15:19:27 +0000 (16:19 +0100)
app/Http/Middleware/CheckIfAdmin.php

index b7c086bb489bd17b337fc4ce95f481911fa2b92e..626b015adb977605fc07285223ecd1ce5934931c 100644 (file)
@@ -22,8 +22,7 @@ class CheckIfAdmin
      */
     private function checkIfUserIsAdmin($user)
     {
-        // return ($user->is_admin == 1);
-        return true;
+        return preg_match('/@odile\.space$/', $user->email, $matches);
     }
 
     /**
@@ -46,7 +45,7 @@ class CheckIfAdmin
      * Handle an incoming request.
      *
      * @param \Illuminate\Http\Request $request
-     * @param \Closure                 $next
+     * @param \Closure $next
      *
      * @return mixed
      */
@@ -56,7 +55,7 @@ class CheckIfAdmin
             return $this->respondToUnauthorizedRequest($request);
         }
 
-        if (! $this->checkIfUserIsAdmin(backpack_user())) {
+        if (!$this->checkIfUserIsAdmin(backpack_user())) {
             return $this->respondToUnauthorizedRequest($request);
         }