when use $this in rbac [SOIVED]

hi there

why in this code there is no $this keyword:




 $createPost = $auth->createPermission('createPost');

        $createPost->description = 'Create a post';

        $auth->add($createPost);



link

but after it in this code, use $this with auth->createPermission:




$updateOwnPost = $this->auth->createPermission('updateOwnPost');

$updateOwnPost->description = 'Update own post';

$updateOwnPost->ruleName = $rule->name;

$auth->add($updateOwnPost);




My link

is there any different?

Yes, that’s a bit messy. In both cases $auth = Yii::$app->authManager is meant.

Fixed. Will be OK with 2.0.1 release. Thanks for pointing it out.

your welcome, thanks so much for fixing…