Why not work RBAC in Yii2?

Actually the question. Create role create permission, attach a permission to the role. Add the role to the user.
But why is a user with this role the access is not receiving.

$auth = \Yii::$app->authManager;

 $admin = $auth->createRole('admin');

 $showFilter = $auth->createPermission('showFilter');
 $showFilter->description = "Show filter";

 $auth->addChild($admin, $showFilter);

 $auth->assign($admin, 76);

But calling
why it returns false. Help to understand why. Did everything according to the documentation. As there is Authorization

If you write
the access is, not running it through the "permission" attached to the role. Even if the role of the role of cabling, access via the child role he gets (
July 9th 19 at 13:55
2 answers
July 9th 19 at 13:57
Maybe you have cache enabled for RBAC, look for the line "'authManager' => [" in the project, if looks like this:
'authManager' => [
 'class' => 'yii\rbac\DbManager',
 'cache' => 'cache'

This means the cache RBAC is enabled, remove the virgin 'cache' => 'cache' , and will be the norm or invaliditatea cache:
Thank you very much. You solved my problem... Cleaned the cache, worked. But after the Yii::$app->authManager->invalidateCache(); does not work if cache is not removed. - Cindy.Oberbrunner32 commented on July 9th 19 at 14:00
There is often a problem with the rights, it all comes down to what is necessary to remove the folder from rb runtime/cache - burnice commented on July 9th 19 at 14:03
Thank You Dmitry. A lot of digging, even in github in Yui is not found. You one helped. I need to write a post. Thanks again - Rodrigo_Mo commented on July 9th 19 at 14:06
July 9th 19 at 13:59
Yii::$app->user->getId() == 76?
Yes, the same. Upon receipt of the roles for a user, he gets the role 'admin' - Cindy.Oberbrunner32 commented on July 9th 19 at 14:02

Find more questions by tags YiiPHP