1 | <?php |
||
2 | |||
3 | namespace common\components; |
||
4 | |||
5 | use Yii; |
||
6 | |||
7 | class AccessControl extends \yii\filters\AccessControl { |
||
8 | /** |
||
9 | * Denies the access of the user. |
||
10 | * The default implementation will redirect the user to the login page if he is a guest; |
||
11 | * if the user is already logged, they are redirected elsewhere |
||
12 | * @param User $user the current user |
||
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
13 | */ |
||
14 | protected function denyAccess($user) |
||
15 | { |
||
16 | if ($user->getIsGuest()) { |
||
17 | $user->loginRequired(); |
||
18 | } else { |
||
19 | // checkin/index is the route that users are redirected to |
||
20 | Yii::$app->getResponse()->redirect(['checkin/index'])->send(); |
||
21 | return; |
||
22 | } |
||
23 | } |
||
24 | } |