YII2 's advanced application template is the separation of the front and back, I seriously studied, I found that Yii2 built-in user components, as well as RBAC components, the component system built-in, I now need to separate the front and rear, then the background users and front-end users and RBAC are to be separated, But I found that I was separated in the background can not manage the front-end users Ah, always do?
Reply content:
YII2 's advanced application template is the separation of the front and back, I seriously studied, I found that Yii2 built-in user components, as well as RBAC components, the component system built-in, I now need to separate the front and rear, then the background users and front-end users and RBAC are to be separated, But I found that I was separated in the background can not manage the front-end users Ah, always do?
But I found that I was separated in the background can not manage the front-end users AH
don't understand why can't manage ~
Well, from a common User component, say:
yii\web\UserThis component can be used separately. For example, you have two tables for each of the two activerecord:
class FrontUser extends ActiveRecord implements IdentityInterface{}class BackendUser extends ActiveRecord implements IdentityInterface{}
From the beginning of the configuration we can distinguish between the previous background:
For example, the background configuration user component:
'user' => [ 'identityClass' => 'common\models\BackendUser', //指定为后台用户AR]
And the front desk needs to be specified identityClass => 'common\models\FrontUser' .
I just follow your instructions, but there will be problems, the specific performance: the front desk has logged on after the user exits, the background is logged in the account also followed the exit. Accordingly, the user who is logged in behind the scenes exits after exiting the login account. Excuse me, where is this wrong?