瀏覽代碼

Delete canViewIP from User\Model

Visman 5 年之前
父節點
當前提交
b4ba1eed6e
共有 5 個文件被更改,包括 6 次插入17 次删除
  1. 1 1
      app/Controllers/Routing.php
  2. 1 1
      app/Models/Rules/Profile.php
  3. 1 1
      app/Models/Rules/Users.php
  4. 1 11
      app/Models/User/Model.php
  5. 2 3
      app/config/main.dist.php

+ 1 - 1
app/Controllers/Routing.php

@@ -135,7 +135,7 @@ class Routing
             $r->add(self::GET, '/admin/', 'AdminIndex:index', 'Admin');
             $r->add(self::GET, '/admin/statistics', 'AdminStatistics:statistics', 'AdminStatistics');
 
-            if ($user->canViewIP) {
+            if ($this->c->userRules->viewIP) {
                 $r->add(self::GET, '/admin/get/host/{ip:[0-9a-fA-F:.]+}', 'AdminHost:view', 'AdminHost');
                 $r->add(self::GET, '/admin/users/user/{id:[2-9]|[1-9]\d+}[/{page:[1-9]\d*}]', 'AdminUsersStat:view', 'AdminUserStat');
             }

+ 1 - 1
app/Models/Rules/Profile.php

@@ -92,7 +92,7 @@ class Profile extends Rules
 
     protected function getviewIP(): bool
     {
-        return $this->user->canViewIP;
+        return $this->user->isAdmin;;
     }
 
     protected function getuseAvatar(): bool

+ 1 - 1
app/Models/Rules/Users.php

@@ -27,7 +27,7 @@ class Users extends Rules
 
     protected function getviewIP(): bool
     {
-        return $this->user->canViewIP;
+        return $this->user->isAdmin;
     }
 
     protected function getdeleteUsers(): bool

+ 1 - 11
app/Models/User/Model.php

@@ -27,7 +27,7 @@ class Model extends DataModel
         parent::__construct($container);
 
         $this->zDepend = [
-            'group_id' => ['isUnverified', 'isGuest', 'isAdmin', 'isAdmMod', 'link', 'viewUsers', 'canViewIP', 'showPostCount', 'searchUsers'],
+            'group_id' => ['isUnverified', 'isGuest', 'isAdmin', 'isAdmMod', 'link', 'viewUsers', 'showPostCount', 'searchUsers'],
             'id' => ['isGuest', 'link', 'avatar', 'online'],
             'logged' => ['isLogged'],
             'show_sig' => ['showSignature'],
@@ -351,16 +351,6 @@ class Model extends DataModel
         return (int) $attr;
     }
 
-    /**
-     * Статус показа ip пользователей
-     *
-     * @return bool
-     */
-    protected function getcanViewIP(): bool
-    {
-        return $this->isAdmin;
-    }
-
     /**
      * Ссылка для продвижения пользователя из указанного сообщения
      *

+ 2 - 3
app/config/main.dist.php

@@ -132,6 +132,8 @@ return [
         'VLusername' => \ForkBB\Models\Validators\Username::class,
         'VLemail'    => \ForkBB\Models\Validators\Email::class,
 
+        'ProfileRules' => \ForkBB\Models\Rules\Profile::class,
+        'UsersRules'   => \ForkBB\Models\Rules\Users::class,
     ],
     'multiple'  => [
         'CtrlPrimary' => \ForkBB\Controllers\Primary::class,
@@ -276,8 +278,5 @@ return [
         'SearchModelTruncateIndex'   => \ForkBB\Models\Search\TruncateIndex::class,
         'SearchModelPrepare' => \ForkBB\Models\Search\Prepare::class,
         'SearchModelExecute' => \ForkBB\Models\Search\Execute::class,
-
-        'ProfileRules' => \ForkBB\Models\Rules\Profile::class,
-        'UsersRules'   => \ForkBB\Models\Rules\Users::class,
     ],
 ];