Skip to content
This repository has been archived by the owner on Dec 3, 2018. It is now read-only.

User::can working wrong when authManager is external (default yii2) component #115

Open
eLFuvo opened this issue May 26, 2017 · 0 comments
Assignees
Labels
Milestone

Comments

@eLFuvo
Copy link

eLFuvo commented May 26, 2017

I have configure external (default yii2) authManager component for podium forum as:

'modules' => [
        'podium' =>
            [
                'class' => 'bizley\podium\Podium',
                'userComponent' => 'user',
                'adminId' => 1,
                'rbacComponent' => 'authManager',                
            ],
    ],

I already have existing users, so I just added roles from the podium forum to them.

bizley\podium\models\User::can function is working wrong.

 public static function can($permissionName, $params = [], $allowCaching = true)
    {
        if (Podium::getInstance()->userComponent === true) {
            return Podium::getInstance()->user->can($permissionName, $params, $allowCaching);
        }
        if (!Podium::getInstance()->user->isGuest) {
            $user = static::findMe();
            if (empty($user)) {
                return false;
            }
            if ($allowCaching && empty($params) && isset($user->_access[$permissionName])) {
                return $user->_access[$permissionName];
            }
// in this place we must check access by inherited_id
->            $access = Podium::getInstance()->rbac->checkAccess($user->id, $permissionName, $params);
            if ($allowCaching && empty($params)) {
                $user->_access[$permissionName] = $access;
            }
            return $access;
        }
        return false;
    }
@eLFuvo eLFuvo changed the title User::can working wrong when authManager is external (yii2) component User::can working wrong when authManager is external (default yii2) component May 26, 2017
@bizley bizley self-assigned this May 26, 2017
@bizley bizley added the bug label May 26, 2017
@bizley bizley added this to the 0.8 milestone May 26, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants