Check if a share arrangement is in place.

@return boolean True if no error is reported
767460
private function checkForShare()
    {

        $ok = true;
        $doSaveResourceLink = true;

        $id = $this->resourceLink->primaryResourceLinkId;

        $shareRequest = isset($_POST['custom_share_key']) && !empty($_POST['custom_share_key']);
        if ($shareRequest) {
            if (!$this->allowSharing) {
                $ok = false;
                $this->reason = 'Your sharing request has been refused because sharing is not being permitted.';
            } else {
// Check if this is a new share key
                $shareKey = new ResourceLinkShareKey($this->resourceLink, $_POST['custom_share_key']);
                if (!is_null($shareKey->primaryConsumerKey) && !is_null($shareKey->primaryResourceLinkId)) {
// Update resource link with sharing primary resource link details
                    $key = $shareKey->primaryConsumerKey;
                    $id = $shareKey->primaryResourceLinkId;
                    $ok = ($key !== $this->consumer->getKey()) || ($id != $this->resourceLink->getId());
                    if ($ok) {
                        $this->resourceLink->primaryConsumerKey = $key;
                        $this->resourceLink->primaryResourceLinkId = $id;
                        $this->resourceLink->shareApproved = $shareKey->autoApprove;
                        $ok = $this->resourceLink->save();
                        if ($ok) {
                            $doSaveResourceLink = false;
                            $this->user->getResourceLink()->primaryConsumerKey = $key;
                            $this->user->getResourceLink()->primaryResourceLinkId = $id;
                            $this->user->getResourceLink()->shareApproved = $shareKey->autoApprove;
                            $this->user->getResourceLink()->updated = time();
// Remove share key
                            $shareKey->delete();
                        } else {
                            $this->reason = 'An error occurred initialising your share arrangement.';
                        }
                    } else {
                        $this->reason = 'It is not possible to share your resource link with yourself.';
                    }
                }
                if ($ok) {
                    $ok = !is_null($key);
                    if (!$ok) {
                        $this->reason = 'You have requested to share a resource link but none is available.';
                    } else {
                        $ok = (!is_null($this->user->getResourceLink()->shareApproved) && $this->user->getResourceLink()->shareApproved);
                        if (!$ok) {
                            $this->reason = 'Your share request is waiting to be approved.';
                        }
                    }
                }
            }
        } else {
// Check no share is in place
            $ok = is_null($id);
            if (!$ok) {
                $this->reason = 'You have not requested to share a resource link but an arrangement is currently in place.';
            }
        }

// Look up primary resource link
        if ($ok && !is_null($id)) {
            $consumer = new ToolConsumer($key, $this->dataConnector);
            $ok = !is_null($consumer->created);
            if ($ok) {
                $resourceLink = ResourceLink::fromConsumer($consumer, $id);
                $ok = !is_null($resourceLink->created);
            }
            if ($ok) {
                if ($doSaveResourceLink) {
                    $this->resourceLink->save();
                }
                $this->resourceLink = $resourceLink;
            } else {
                $this->reason = 'Unable to load resource link being shared.';
            }
        }

        return $ok;

    }
547973
public function isDesktop()
    {
        $osShort = $this->getOs('short_name');
        if (empty($osShort) || self::UNKNOWN == $osShort) {
            return false;
        }

        // Check for browsers available for mobile devices only
        if ($this->usesMobileBrowser()) {
            return false;
        }

        $decodedFamily = OperatingSystem::getOsFamily($osShort);

        return in_array($decodedFamily, self::$desktopOsArray);
    }
811102
private function isSkipTable(): bool
    {
        $config = (array)Configure::read('RolesCapabilities.ownerCheck.skipTables.byInstance');
        if (in_array(get_class($this->table), $config)) {
            return true;
        }

        $config = (array)Configure::read('RolesCapabilities.ownerCheck.skipTables.byRegistryAlias');
        if (in_array($this->table->getRegistryAlias(), $config)) {
            return true;
        }

        $config = (array)Configure::read('RolesCapabilities.ownerCheck.skipTables.byTableName');
        if (in_array($this->table->getTable(), $config)) {
            return true;
        }

        return false;
    }
1129306
public static function isEnabled() {
		$enable_cloning = get_site_option( 'pressbooks_sharingandprivacy_options', [] );
		$enable_cloning = isset( $enable_cloning['enable_cloning'] ) ? $enable_cloning['enable_cloning'] : SharingAndPrivacyOptions::getDefaults()['enable_cloning'];
		return (bool) $enable_cloning;
	}
1202369
public function hasSortingFieldsChanged()
    {
        $aSortingFields = \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('aSortCols');
        $aSortingFields = !empty($aSortingFields) ? (array) $aSortingFields : [];
        $blChanged = false;
        foreach ($aSortingFields as $sField) {
            $sParameterName = 'oxarticles__' . $sField;
            $currentValueOfField = $this->$sParameterName instanceof Field ? $this->$sParameterName->value : '';
            $valueOfFieldOnLoad = $this->_aSortingFieldsOnLoad[$sParameterName] ?? null;
            if ($valueOfFieldOnLoad !== $currentValueOfField) {
                $blChanged = true;
                break;
            }
        }

        return $blChanged;
    }
928659
public function isAccountingSetup()
  {
    $Setting = $this->Setting->byOrganization($this->AuthenticationManager->getCurrentUserOrganization('id'))->first();

    if(empty($Setting->is_configured))
    {
      return false;
    }
    else
    {
      return true;
    }
  }
605894
public function isShared($abstract)
    {
        return isset($this->instances[$abstract]) ||
               (isset($this->bindings[$abstract]['shared']) &&
               $this->bindings[$abstract]['shared'] === true);
    }
273374
private function hasRole()
    {
        return isset($this->config['role'])
            && \is_string($this->config['role'])
            && 0 === strpos($this->config['role'], 'ROLE_');
    }
363540
public function hasGroupAction()
	{
		$condition = $this->datagrid->getRowCondition('group_action');

		return $condition ? $condition($this->item) : true;
	}
1329638
public function isSet() : bool
    {
        if (count($this->objects) < 2)
        {
            throw new Exception("XORGroup contains too few objects");
        }

        return $this->objects[0]->isSet() xor $this->objects[1]->isSet();
    }
638077
public function isDirty()
    {
        return true === $this->attributes->areDirty()
            || true === $this->hasOneEmbeds->areDirty()
            || true === $this->hasManyEmbeds->areDirty()
        ;
    }
1036721
protected function _isSortEnabled()
    {
        if (!isset($this->controller->sortFields)) {
            return false;
        }

        foreach ($this->controller->sortFields as $field) {
            if (isset($field['actions']) &&
                is_array($field['actions']) &&
                in_array($this->action, $field['actions'])
            ) {
                return true;
            }
        }

        return false;
    }
434466
public function check(): bool
    {
        return $this->installable = $this->items->filter(function ($specification) {
            return $specification->check() === false && $specification->optional() === false;
        })->isEmpty();
    }
819557
protected function isProperlyConfigured()
    {
        if (isset($this->isProperlyConfigured)) {
            return $this->isProperlyConfigured;
        }

        return $this->isProperlyConfigured = $this->checkConfiguration();
    }
1272333
public function checkAccessRights()
    {
        $myConfig = \OxidEsales\Eshop\Core\Registry::getConfig();

        $blIsAuth = false;

        $sUserID = \OxidEsales\Eshop\Core\Registry::getSession()->getVariable("auth");

        // deleting admin marker
        \OxidEsales\Eshop\Core\Registry::getSession()->setVariable("malladmin", 0);
        \OxidEsales\Eshop\Core\Registry::getSession()->setVariable("blIsAdmin", 0);
        \OxidEsales\Eshop\Core\Registry::getSession()->deleteVariable("blIsAdmin");
        $myConfig->setConfigParam('blMallAdmin', false);
        //#1552T
        $myConfig->setConfigParam('blAllowInheritedEdit', false);

        if ($sUserID) {
            // escaping
            $sRights = $this->fetchRightsForUser($sUserID);

            if ($sRights != "user") {
                // malladmin ?
                if ($sRights == "malladmin") {
                    \OxidEsales\Eshop\Core\Registry::getSession()->setVariable("malladmin", 1);
                    $myConfig->setConfigParam('blMallAdmin', true);

                    //#1552T
                    //So far this blAllowSharedEdit is Equal to blMallAdmin but in future to be solved over rights and roles
                    $myConfig->setConfigParam('blAllowSharedEdit', true);

                    $sShop = \OxidEsales\Eshop\Core\Registry::getSession()->getVariable("actshop");
                    if (!isset($sShop)) {
                        \OxidEsales\Eshop\Core\Registry::getSession()->setVariable("actshop", $myConfig->getBaseShopId());
                    }
                    $blIsAuth = true;
                } else {
                    // Shopadmin... check if this shop is valid and exists
                    $sShopID = $this->fetchShopAdminById($sRights);
                    if (isset($sShopID) && $sShopID) {
                        // success, this shop exists

                        \OxidEsales\Eshop\Core\Registry::getSession()->setVariable("actshop", $sRights);
                        \OxidEsales\Eshop\Core\Registry::getSession()->setVariable("currentadminshop", $sRights);
                        \OxidEsales\Eshop\Core\Registry::getSession()->setVariable("shp", $sRights);

                        // check if this subshop admin is evil.
                        if ('chshp' == \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('fnc')) {
                            // dont allow this call
                            $blIsAuth = false;
                        } else {
                            $blIsAuth = true;

                            $aShopIdVars = ['actshop', 'shp', 'currentadminshop'];
                            foreach ($aShopIdVars as $sShopIdVar) {
                                if ($sGotShop = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter($sShopIdVar)) {
                                    if ($sGotShop != $sRights) {
                                        $blIsAuth = false;
                                        break;
                                    }
                                }
                            }
                        }
                    }
                }
                // marking user as admin
                \OxidEsales\Eshop\Core\Registry::getSession()->setVariable("blIsAdmin", 1);
            }
        }

        return $blIsAuth;
    }
398312
public function isConfigured()
    {
        if (!empty($this->urlParts) && isset($this->solrMap[$this->className])) {
            return true;
        }
        return false;
    }
1221922
protected function checkConfiguration()
    {
        return $this->getTagSource()
            && $this->getValueColumn()
            && $this->getAliasColumn()
            && $this->getIdColumn()
            && $this->getSortingColumn();
    }