Check if guest checkout is allowed

@return bool
489700
public function isCheckoutAllowed()
    {
        return $this->customerSession->isLoggedIn() || $this->checkoutHelper->isAllowedGuestCheckout($this->checkoutSession->getQuote());
    }
601803
public static function accept() {
        global $USER, $DB;
        if (!isloggedin()) {
            return false;
        }
        if ($USER->policyagreed || !static::is_defined(isguestuser())) {
            return false;
        }

        if (!isguestuser()) {
            // For the guests agreement in stored in session only, for other users - in DB.
            $DB->set_field('user', 'policyagreed', 1, array('id' => $USER->id));
        }
        $USER->policyagreed = 1;
        return true;
    }
805223
public function AllowDiscountForNonUsers()
    {
        $bIsValid = true;
        $aExtranetGroup = $this->GetFieldDataExtranetGroupWithInverseEmptySelectionLogicIdList();
        if (null === $aExtranetGroup || count($aExtranetGroup) > 0) {
            $bIsValid = false;
        }

        if ($bIsValid) {
            $aExtranetUser = $this->GetFieldDataExtranetUserWithInverseEmptySelectionLogicIdList();
            if (null === $aExtranetUser || count($aExtranetUser) > 0) {
                $bIsValid = false;
            }
        }
        if ($bIsValid) {
            $aExtranetUserCountry = $this->GetMLTIdList('data_country_mlt');
            if (count($aExtranetUserCountry) > 0) {
                $bIsValid = false;
            }
        }

        return $bIsValid;
    }
275862
public static function check() {
		if (R::count("permission") < 1) {
			$role       = R::dispense("permission");
			$role->name = "guest";
			R::store($role);
		}
	}
1208041
protected function _checkPermissions()
    {
        if($this->_allowedHostnames === NULL)
            return;

        if(key_exists('REMOTE_HOST', $_SERVER))
            $host = $_SERVER['REMOTE_HOST'];
        else
            $host = $_SERVER['REMOTE_ADDR'];

        if(!in_array($host, $this->_allowedHostnames))
            throw new Exception("Requests from hostname ($host) are not allowed");
    }
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;
    }
812850
public function onboardingEnabled() {
    // Check if tour is enabled by SM setting.
    if ($this->configFactory->get('social_tour_enabled') == FALSE) {
      return FALSE;
    }

    // Check permissions.
    if (!$this->currentUser->hasPermission('access tour')) {
      return FALSE;
    }

    // Check if current disabled it.
    if ($this->userData->get('social_tour', $this->currentUser->id(), 'onboarding_disabled') == TRUE) {
      return FALSE;
    }
    return TRUE;
  }
522909
protected function defaultChecker(){
            $allowed = $this->getAlloweds();
            $useragent = $this->getValue();
            if('*' === $allowed){
                return true;
            }

            $allowed = (array) $allowed;
            if (is_array($allowed)) {
                foreach($allowed as $allow)
                {
                    if (strstr($useragent, $allow)) {
                        return true;
                    }
                }
            }

            return false;
        }
935834
protected function isAcceptable()
    {
        $manifest = $this->getManifest();

        $res = $this->checkPackageType();

        //check php version
        if (isset($manifest['php'])) {
            $res &= $this->checkVersions($manifest['php'], System::getPhpVersion(), 'Your PHP version does not support this installation package.');
        }

        //check acceptableVersions
        if (isset($manifest['acceptableVersions'])) {
            $res &= $this->checkVersions($manifest['acceptableVersions'], $this->getConfig()->get('version'), 'Your EspoCRM version doesn\'t match for this installation package.');
        }

        //check dependencies
        if (!empty($manifest['dependencies'])) {
            $res &= $this->checkDependencies($manifest['dependencies']);
        }

        return (bool) $res;
    }
743724
public function IsValidForCurrentUser()
    {
        $bValidForUser = parent::IsValidForCurrentUser();
        if (false === $bValidForUser) {
            return $bValidForUser;
        }

        if (false === $this->fieldPkgDhlPackstationAllowForPackstation) {
            $oUser = TdbDataExtranetUser::GetInstance();
            $oShipping = $oUser->GetShippingAddress();
            if ($oShipping && $oShipping->fieldIsDhlPackstation) {
                $bValidForUser = false;
            }
        }

        return $bValidForUser;
    }
853766
public function isAdmin(): bool
    {
        return $this->isLoggedIn()
            && isset($this->session->get('user')['admin'])
            && $this->session->get('user')['admin'] === true;
    }
481358
protected function validateOrderCheckout()
    {
        if ($this->same_payment_address) {
            $this->unsetSubmitted('address.payment');
        }

        $this->setSubmitted('update', array());
        $this->setSubmitted('store_id', $this->store_id);
        $this->setSubmitted('user_id', $this->order_user_id);
        $this->setSubmitted('creator', $this->admin_user_id);

        if ($this->admin) {
            $this->setSubmitted('status', $this->order->getStatusInitial());
        }

        return $this->validateComponent('order');
    }
1008934
public static function accept() {
        global $USER, $DB;

        if (!isloggedin()) {
            return false;
        }

        if ($USER->policyagreed) {
            return false;
        }

        if (isguestuser()) {
            // For guests, agreement is stored in the session only.
            $USER->policyagreed = 1;
            return true;
        }

        // Find all compulsory policies and mark them as accepted.
        $compulsory = [];
        foreach (api::list_current_versions(policy_version::AUDIENCE_LOGGEDIN) as $policyversion) {
            if ($policyversion->optional == policy_version::AGREEMENT_COMPULSORY) {
                $compulsory[] = $policyversion->id;
            }
        }

        if ($compulsory) {
            api::accept_policies($compulsory);
        }

        // Mark policies as agreed.
        $DB->set_field('user', 'policyagreed', 1, array('id' => $USER->id));
        $USER->policyagreed = 1;

        return true;
    }
1216936
public function isValid()
  {
    return ($this->checkUser() && $this->checkPass() && $this->checkHost() && $this->checkPort() && $this->checkPath() && $this->checkQuery() && $this->checkFragment());
  }
1036469
public function isAccessible()
    {
        $loop = $this;
        $access = true;

        while ($loop->getReply() != null) {
            $loop = $loop->getReply();

            if ($loop->getSpam() == 1 || $loop->getActive() == 0 || $loop->isEmailValid() == 0) {
                $access = false;
            }
        }

        return $access;
    }
249158
public function isPayPalCheckValid()
    {
        $newBasketAmount = $this->getNewBasketAmount();
        $prevBasketAmount = $this->getOldBasketAmount();
        // check only if new price is different and bigger than old price
        if ($newBasketAmount > $prevBasketAmount) {
            return false;
        }

        return true;
    }
926071
public function isAllowed()
    {
		//jeśli brak dostępu do aktualnej kategorii
		if (!$this->_checkAccess($this->_category->id)) {
			return false;
		}
		//jeśli brak dostępu do któregoś rodzica
		if (!$this->_checkParents()) {
			return false;
		}
        return true;
    }