Skip to content

Commit db98188

Browse files
committed
fix: 权限不足异常处理
1 parent 812176d commit db98188

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/middleware/PermissionCheck.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,19 @@
44

55
use tadmin\controller\Transfer;
66
use tadmin\service\auth\facade\Auth;
7+
use tadmin\support\controller\Controller;
78
use tauthz\facade\Enforcer;
89
use think\App;
910

10-
class PermissionCheck
11+
class PermissionCheck extends Controller
1112
{
1213
protected $app;
1314

1415
protected $request;
1516

1617
public function __construct(App $app)
1718
{
18-
$this->app = $app;
19+
parent::__construct($app);
1920
}
2021

2122
public function handle($request, \Closure $next)
@@ -33,8 +34,7 @@ public function handle($request, \Closure $next)
3334
$enforcer = $this->app->get('tadmin.enforcer');
3435

3536
if (true !== $enforcer->enforce('adminer.' . $adminer->id, $this->request->method(true), $this->parseCurrentPath())) {
36-
return controller(Transfer::class, '')->message('权限不足');
37-
// throw new \Exception('权限不足');
37+
return $this->error("权限不足");
3838
}
3939

4040
return $next($request);

0 commit comments

Comments
 (0)