public function can($permissionName, $params = [], $allowCaching = true)
{
// check for auth manager rbac
// copied from \yii\web\User
$auth = Yii::$app->getAuthManager();
if ($auth) {
if ($allowCaching && empty($params) && isset($this->permissionCache[$permissionName])) {
return $this->permissionCache[$permissionName];
}
$access = $auth->checkAccess($this->getId(), $permissionName, $params);
if ($allowCaching && empty($params)) {
$this->permissionCache[$permissionName] = $access;
}
return $access;
}
// otherwise use our own custom permission (via the role table)
return $this->role->checkPermission($permissionName);
}