Browse Source

定价权限

liuzejian 1 year ago
parent
commit
57b5e5efdb

+ 0 - 1
modules/ContentManage/Middlewares/ContentManageGate.php

@@ -20,7 +20,6 @@ class ContentManageGate
         if (! $user->can()) {
             throw new PermissionForbidden();
         }
-
         return $next($request);
     }
 }

+ 0 - 1
modules/Permissions/Middlewares/PermissionGate.php

@@ -20,7 +20,6 @@ class PermissionGate
         if (! $user->can()) {
             throw new PermissionForbidden();
         }
-
         return $next($request);
     }
 }

+ 2 - 2
modules/Video/Http/Controllers/VideoController.php

@@ -69,8 +69,8 @@ class VideoController extends CatchController
             'chargeSequence' => 'required|integer|min:1|max:30'
         ]);
         $userContext = $this->getUserContext($request->input('operateUserId'));
-        if(!(1 == $userContext['loginUser']->id ||
-            $userContext['loginUserRoles']->diff(['administrator', 'optimizer'])->isNotEmpty())) {
+        if(!(1 == $userContext['loginUser']->id || $userContext['loginUserRoles']->contains('administrator') ||
+            $userContext['loginUserRoles']->contains('optimizer'))) {
             CommonBusinessException::throwError(Errors::NO_OPERATE_PERMISSION);
         }
         $now = date('Y-m-d H:i:s');

+ 2 - 4
tests/UsedTestCase.php

@@ -14,12 +14,10 @@ abstract class UsedTestCase extends BaseTestCase
         parent::setUp(); // TODO: Change the autogenerated stub
         $tokenInfo = $this->post('http://localhost/api/login', [
 //            'email' => 'catch@admin.com',
-//            'password' => 'catchadmin',
             'remember' => false,
-            'email' => 'xiaoli@qq.com',
+//            'email' => 'xiaoli@qq.com',
             'password' => 'catchadmin',
-//        'email' => 'aa4@test.com',
-//            'password' => '123',
+        'email' => 'aa@test.com',
         ])->json();
         $this->token = $tokenInfo['data']['token'];
     }

+ 1 - 1
tests/Video/Http/Controllers/EpisodeControllerTest.php

@@ -13,7 +13,7 @@ class EpisodeControllerTest extends UsedTestCase
     {
         $res = $this->withHeaders([
             'Authorization' => 'Bearer '. $this->token,
-        ])->json('get','http://localhost/api/videoStock/episode/list', [
+        ])->json('get','http://localhost/api/videoStock/episode/downloadList', [
             'video_id' => 3
         ]);
         $this->dumpJson($res);