function SandboxManagerBase::checkOwnership

Validates the ownership of stage directory.

The stage is considered under valid ownership if it was created by current user or session, using the current class.

Throws

\LogicException If ::claim() has not been previously called.

\Drupal\package_manager\Exception\SandboxOwnershipException If the current user or session does not own the stage directory, or it was created by a different class.

6 calls to SandboxManagerBase::checkOwnership()
SandboxManagerBase::apply in core/modules/package_manager/src/SandboxManagerBase.php
Applies staged changes to the active directory.
SandboxManagerBase::destroy in core/modules/package_manager/src/SandboxManagerBase.php
Deletes the stage directory.
SandboxManagerBase::getMetadata in core/modules/package_manager/src/SandboxManagerBase.php
Returns a specific piece of metadata associated with this stage.
SandboxManagerBase::postApply in core/modules/package_manager/src/SandboxManagerBase.php
Performs post-apply tasks.
SandboxManagerBase::require in core/modules/package_manager/src/SandboxManagerBase.php
Adds or updates packages in the stage directory.

... See full list

File

core/modules/package_manager/src/SandboxManagerBase.php, line 705

Class

SandboxManagerBase
Creates and manages a stage directory in which to install or update code.

Namespace

Drupal\package_manager

Code

protected final function checkOwnership() : void {
    if (empty($this->lock)) {
        throw new \LogicException('Stage must be claimed before performing any operations on it.');
    }
    $stored_lock = $this->tempStore
        ->getIfOwner(static::TEMPSTORE_LOCK_KEY);
    if ($stored_lock !== $this->lock) {
        throw new SandboxOwnershipException($this, 'Stage is not owned by the current user or session.');
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.