Skip to content

Commit bf6c733

Browse files
committed
feat: update AbstractAuthFilter
1 parent 10660b6 commit bf6c733

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/Filters/AbstractAuthFilter.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use CodeIgniter\HTTP\RequestInterface;
1010
use CodeIgniter\HTTP\Response;
1111
use CodeIgniter\HTTP\ResponseInterface;
12+
use CodeIgniter\Shield\Config\Auth;
1213

1314
/**
1415
* Group Authorization Filter.
@@ -43,8 +44,15 @@ public function before(RequestInterface $request, $arguments = null)
4344
return;
4445
}
4546

46-
// Otherwise, we'll just send them to the home page.
47-
return redirect()->to('/')->with('error', lang('Auth.notEnoughPrivilege'));
47+
switch ($this->filterName) {
48+
case 'group':
49+
return redirect()->to(config(Auth::class)->afterGroupDeniedRedirect())
50+
->with('error', lang('Auth.notEnoughPrivilege'));
51+
52+
case 'permission':
53+
return redirect()->to(config(Auth::class)->afterPermissionDeniedRedirect())
54+
->with('error', lang('Auth.notEnoughPrivilege'));
55+
}
4856
}
4957

5058
/**

0 commit comments

Comments
 (0)