I just pushed some changes from localhost to a staging (pre-production) server. I began testing and tried to access a restricted action prior to running the migration to update the rbac tables, so it failed. I have now updated the rbac tables, but I cannot make it pass.
There shouldn’t be anything wrong with the rule as it works fine on localhost. I’m thinking it’s a caching issue. I’m seeing this in the log: yii\rbac\DbManager::checkAccessFromCache
.
But how can I clear the cache if indeed that’s the issue? I’ve tried yii cache-flush-all
from the console, but that doesn’t help. I only have FileCache enabled.
if (!$group->canUpdateOwn()) {
throw new NotFoundHttpException;
}
class MyGroupRule extends Rule
{
public $name = 'isGroupOwner';
public function execute($user, $item, $params)
{
return isset($params['Group']) ? $params['Group']->user_id === $user : false;
}
}