Closed derekisbusy closed 2 years ago
You should use: Yii::$app->user->isGuest
in C:\www\testapp\app\vendor\yiisoft\yii2\db\BaseActiveRecord.php at line 296– [yii\base\Component::__get](http://www.yiiframework.com/doc-2.0/yii-base-component.html#__get()-detail)('isGuest')
3. in C:\www\testapp\app\vendor\yiisoft\yii2-debug\src\panels\UserPanel.php at line 83– [yii\db\BaseActiveRecord::__get](http://www.yiiframework.com/doc-2.0/yii-db-baseactiverecord.html#__get()-detail)('isGuest')
/**
* {@inheritdoc}
* @throws InvalidConfigException
*/
public function init()
{
if (!$this->isEnabled() || $this->getUser()->isGuest) {
return;
}
$this->userSwitch = new UserSwitch(['userComponent' => $this->userComponent]);
$this->addAccessRules();
4. in C:\www\testapp\app\vendor\yiisoft\yii2\base\BaseObject.php at line 109– [yii\debug\panels\UserPanel::init](http://www.yiiframework.com/doc-2.0/yii-debug-panels-userpanel.html#init()-detail)()
its being called from the debug panel in Yii2. It should work out the box. I see isGuest is something thats not implemented in the User class of Usario... is this something I have to extend and implement myself? Where is it supposed to be implemented?
It's implemented in Yii's User.php
, but at the moment I cannot figure out the inheritance on how it reaches Usuario's user model, anyway we regularly use it in our apps
I fixed it. Forgot how but it was due to an RBAC extension not Usario.
I fixed it. Forgot how but it was due to an RBAC extension not Usario.
Nice! Can't You please remember how exactly? A'm in the same trouble just now (
isGuest property is not implemented in the User model? Do I have to add this myself?