简体   繁体   中英

How do I get Yii2 RBAC via DbManager use Joomla "user" table and userid from Joomla session?

I have Joomla running to control the placement of content and to manage user registration/login. Also I have Yii2 running which I integrated by following these instructions: http://www.yiiframework.com/doc-2.0/guide-tutorial-yii-integration.html

I want a user to be able to login through Joomla's login system, and then use Yii2's built-in RBAC support via DbManager ( http://www.yiiframework.com/doc-2.0/guide-security-authorization.html#rbac ) to verify the logged in user's permissions in the auth_assignment table before running a particular Yii2 function.

I'm not sure what I have to do to tell Yii2 to use the "user" table used by Joomla and also to check this table for the userid when performing RBAC permission checks such as the following example:

if (Yii::$app->user->can('some-auth-item')) 
    { 
        return $this->render('some-page'); 
    }

I think this link could be usefule http://www.yiiframework.com/forum/index.php/topic/67481-integrating-yii2-into-joomla-and-using-joomlas-user-table/

Mainly You need change the user table

class User extends ActiveRecord implements IdentityInterface
{

  public static function tableName()
  {
     return 'fm3lk_user';
  }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM