amnah\yii2\user\components\User::can PHP Method

can() public method

If "authManager" component is set, this will simply use the default functionality. Otherwise, it will use our custom permission system
public can ( string $permissionName, array $params = [], boolean $allowCaching = true ) : boolean
$permissionName string
$params array
$allowCaching boolean
return boolean
    public function can($permissionName, $params = [], $allowCaching = true)
    {
        // check for auth manager to call parent
        $auth = Yii::$app->getAuthManager();
        if ($auth) {
            return parent::can($permissionName, $params, $allowCaching);
        }
        // otherwise use our own custom permission (via the role table)
        /** @var \amnah\yii2\user\models\User $user */
        $user = $this->getIdentity();
        return $user ? $user->can($permissionName) : false;
    }