From 131159c246ce111fe2ebae930f0a9208db4bdc00 Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Sun, 10 Sep 2017 23:57:18 -0500 Subject: [PATCH] Fix some forgotten logic checks temporarily --- app/Http/Requests/Admin/AdminFormRequest.php | 2 +- app/Models/User.php | 2 +- app/Policies/APIKeyPolicy.php | 2 +- app/Policies/ServerPolicy.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/Http/Requests/Admin/AdminFormRequest.php b/app/Http/Requests/Admin/AdminFormRequest.php index 4399d56c5..a3442a568 100644 --- a/app/Http/Requests/Admin/AdminFormRequest.php +++ b/app/Http/Requests/Admin/AdminFormRequest.php @@ -42,7 +42,7 @@ abstract class AdminFormRequest extends FormRequest return false; } - return $this->user()->isRootAdmin(); + return (bool) $this->user()->root_admin; } /** diff --git a/app/Models/User.php b/app/Models/User.php index a34935223..29941e090 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -202,7 +202,7 @@ class User extends Model implements */ public function isRootAdmin() { - return $this->root_admin === 1; + return $this->root_admin; } /** diff --git a/app/Policies/APIKeyPolicy.php b/app/Policies/APIKeyPolicy.php index 31b888a75..f397d4868 100644 --- a/app/Policies/APIKeyPolicy.php +++ b/app/Policies/APIKeyPolicy.php @@ -43,7 +43,7 @@ class APIKeyPolicy protected function checkPermission(User $user, Key $key, $permission) { // Non-administrative users cannot use administrative routes. - if (! starts_with($key, 'user.') && ! $user->isRootAdmin()) { + if (! starts_with($key, 'user.') && ! $user->root_admin) { return false; } diff --git a/app/Policies/ServerPolicy.php b/app/Policies/ServerPolicy.php index 618deebf3..0b9968f9e 100644 --- a/app/Policies/ServerPolicy.php +++ b/app/Policies/ServerPolicy.php @@ -60,7 +60,7 @@ class ServerPolicy */ public function before(User $user, $ability, Server $server) { - if ($user->isRootAdmin() || $server->owner_id === $user->id) { + if ($user->root_admin || $server->owner_id === $user->id) { return true; }