Selaa lähdekoodia

Fix for checking expired bans for the admin

Visman 5 vuotta sitten
vanhempi
commit
484a507b3e
2 muutettua tiedostoa jossa 6 lisäystä ja 9 poistoa
  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;
         }
 
-        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);
         }
 

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

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