浏览代码

Fix for checking expired bans for the admin

Visman 5 年之前
父节点
当前提交
484a507b3e
共有 2 个文件被更改,包括 6 次插入9 次删除
  1. 1 4
      app/Controllers/Primary.php
  2. 5 5
      app/Models/BanList/Check.php

+ 1 - 4
app/Controllers/Primary.php

@@ -58,10 +58,7 @@ class Primary
             return null;
             return null;
         }
         }
 
 
-        if (
-            ! $this->c->user->isAdmin
-            && $this->c->bans->check($this->c->user)
-        ) {
+        if ($this->c->bans->check($this->c->user)) {
             return $this->c->Ban->ban($this->c->user);
             return $this->c->Ban->ban($this->c->user);
         }
         }
 
 

+ 5 - 5
app/Models/BanList/Check.php

@@ -17,11 +17,6 @@ class Check extends Method
      */
      */
     public function check(User $user): bool
     public function check(User $user): bool
     {
     {
-        // админ
-        if ($user->isAdmin) {
-            return false;
-        }
-
         // удаление просроченных банов
         // удаление просроченных банов
         if (! empty($this->model->banList)) { // ???? зачем при каждом запуске проверять просроченность?
         if (! empty($this->model->banList)) { // ???? зачем при каждом запуске проверять просроченность?
             $ids = [];
             $ids = [];
@@ -41,6 +36,11 @@ class Check extends Method
             }
             }
         }
         }
 
 
+        // админ
+        if ($user->isAdmin) {
+            return false;
+        }
+
         // проверка гостя
         // проверка гостя
         if ($user->isGuest) {
         if ($user->isGuest) {
             if (! empty($this->model->ipList)) {
             if (! empty($this->model->ipList)) {