Discussion on the separation of Yii2 and fore-aft station

Source: Internet
Author: User
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?

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.