return true if the payment method is allowed for the current user.

@return bool
776616
public function IsValidForCurrentUser()
    {
        $bIsValidForUser = false;
        $bIsValidShippingCountry = false;
        $bIsValidBillingCountry = false;

        $oUser = TdbDataExtranetUser::GetInstance();
        $bIsValidGroup = $this->checkUserGroup($oUser);
        if ($bIsValidGroup) {
            $bIsValidForUser = $this->checkUser($oUser);
        }
        if ($bIsValidForUser && $bIsValidGroup) {
            $bIsValidShippingCountry = $this->checkUserShippingCountry($oUser);
        }
        if ($bIsValidForUser && $bIsValidGroup && $bIsValidShippingCountry) {
            $bIsValidBillingCountry = $this->checkUserBillingCountry($oUser);
        }

        return $bIsValidForUser && $bIsValidGroup && $bIsValidShippingCountry && $bIsValidBillingCountry;
    }
498522
public function valid()
  {

    $allowedValues = $this->getAccessLevelAllowableValues();
    if (!in_array($this->container['access_level'], $allowedValues)) {
      return false;
    }
    return true;
  }
1056873
public function isAccessible()
    {
        if ($this->hasAccessRestrictions() === false) {
            return true;
        }

        if ($this->securityContext->canBeInitialized() === false) {
            return true;
        }

        foreach ($this->accessRoles as $roleName) {
            if ($this->securityContext->hasRole($roleName)) {
                return true;
            }
        }

        return false;
    }
153393
protected function userPayment()
    {
        $refId = Input::get('au');

        if ($this->refId() != $refId) {
            $this->transactionFailed();
            $this->newLog(-30, JahanPayException::$errors[-30]);
            throw new JahanPayException(-30);
        }

        return true;
    }
1273752
public function HasAvailablePaymentMethods()
    {
        $bValidMethods = false;
        $oMethods = &$this->GetValidPaymentMethods();
        $bValidMethods = ($oMethods->Length() > 0);

        return $bValidMethods;
    }
515740
public function isGuestAllowed()
    {
        if (null === $user = $this['repo.users']->findByLogin(User::USER_GUEST)) {
            return false;
        }

        return count($this->getAclForUser($user)->get_granted_base()) > 0;
    }
1132943
public function IsValidForCurrentUser()
    {
        $bIsValidForUser = false;
        $bIsValidGroup = false;

        $shippingGroupDataAccess = $this->getShippingGroupDataAccess();
        $aUserGroups = $shippingGroupDataAccess->getPermittedUserGroupIds($this->id);
        if (!is_array($aUserGroups) || count($aUserGroups) < 1) {
            $bIsValidGroup = true;
        } else {
            $oUser = TdbDataExtranetUser::GetInstance();
            $bIsValidGroup = $oUser->InUserGroups($aUserGroups);
        }

        // now check user id
        if ($bIsValidGroup) {
            $aUserList = $shippingGroupDataAccess->getPermittedUserIds($this->id);
            if (!is_array($aUserList) || count($aUserList) < 1) {
                $bIsValidForUser = true;
            } else {
                $oUser = TdbDataExtranetUser::GetInstance();
                $bIsValidForUser = in_array($oUser->id, $aUserList);
            }
        }

        return $bIsValidForUser && $bIsValidGroup;
    }
1045227
public function isExpressCheckoutEnabled()
    {
        if ($this->expressCheckoutEnabled === null) {
            $this->expressCheckoutEnabled = false;
            if ($this->getPayPalConfig()->isExpressCheckoutEnabled()) {
                $user = $this->getUser();
                $validator = $this->getPaymentValidator();
                $validator->setUser($user);
                $validator->setConfig($this->getConfig());
                $validator->setCheckCountry(false);

                $this->expressCheckoutEnabled = $validator->isPaymentValid();
            }
        }

        return $this->expressCheckoutEnabled;
    }
716741
protected function canAccess()
    {
        if ($this->formRequest->user()->isAdmin() || $this->formRequest->user()->isUser()) {
            return true;
        }

        return $this->formRequest->user()->canDo('message.message.view');
    }
1118535
protected function userPayment()
    {
        $status = Input::get('status');
        $transId = Input::get('transId');
        $this->cardNumber = Input::get('cardNumber');
        $message = Input::get('message');
        if (is_numeric($status) && $status > 0) {
            $this->trackingCode = $transId;
            return true;
        }
        $this->transactionFailed();
        $this->newLog(-5, $message);
        throw new PayirReceiveException(-5);
    }
797174
public function isPayPalOrder()
    {
        $active = false;

        $order = $this->getEditObject();
        if ($order && $order->getFieldData('oxpaymenttype') == 'oxidpaypal') {
            $active = true;
        }

        return $active;
    }
643746
protected function canUpdate() {        
        $user_id = Filter::postInteger('userid', -1) ?: Filter::getInteger('userid', -1);
        return Auth::check() && 
            ( 
                $user_id == Auth::user()->getUserId() ||        // Allow update for yourself
                ($user_id == -1 && Auth::isManager(Globals::getTree()))   // Allow a manager to update the default user
             );
    }
842138
public function GetValidPaymentMethodsSelectableByTheUser()
    {
        $oPaymentMethods = clone $this->GetValidPaymentMethods(true);
        $aInvalidMethods = array();
        $oPaymentMethods->GoToStart();
        while ($oPaymentMethod = $oPaymentMethods->Next()) {
            $oHandler = $oPaymentMethod->GetFieldShopPaymentHandler();
            if ($oHandler && $oHandler->isBlockForUserSelection()) {
                $aInvalidMethods[] = MySqlLegacySupport::getInstance()->real_escape_string($oPaymentMethod->id);
            }
        }
        if (count($aInvalidMethods) > 0) {
            $oPaymentMethods->AddFilterString("`shop_payment_method`.`id` NOT IN ('".implode("','", $aInvalidMethods)."')");
        }
        $oPaymentMethods->GoToStart();

        return $oPaymentMethods;
    }
1145350
public function isStandardCheckoutEnabled()
    {
        if ($this->standardCheckoutEnabled === null) {
            $this->standardCheckoutEnabled = false;
            if ($this->getPayPalConfig()->isStandardCheckoutEnabled()) {
                $user = $this->getUser();
                $validator = $this->getPaymentValidator();
                $validator->setUser($user);
                $validator->setConfig($this->getConfig());

                $this->standardCheckoutEnabled = $validator->isPaymentValid();
            }
        }

        return $this->standardCheckoutEnabled;
    }
393808
protected function isShortcutPayment()
    {
        $trigger = (int) \OxidEsales\Eshop\Core\Registry::getSession()->getVariable(self::OEPAYPAL_TRIGGER_NAME);
        return (bool) ($trigger == self::OEPAYPAL_SHORTCUT);
    }
983293
public function canSwitchUser()
    {
        if ($this->getUser()->isGuest) {
            return false;
        }

        $allowSwitchUser = false;

        $rule = new AccessRule($this->ruleUserSwitch);

        /** @var Controller $userController */
        $userController = null;
        $controller = $this->module->createController('user');
        if (isset($controller[0]) && $controller[0] instanceof UserController) {
            $userController = $controller[0];
        }

        //check by rule
        if ($userController) {
            $action = $userController->createAction('set-identity');
            $user = $this->userSwitch->getMainUser();
            $request = Yii::$app->request;

            $allowSwitchUser = $rule->allows($action, $user, $request) ?: false;
        }

        return $allowSwitchUser;
    }
1035308
protected function hasPermission()
    {
        $request = $this->request;
        $do = $this->getAction('can');

        return ! $this->forbiddenRoute() && $request->user()->can($do);
    }