Example #1
0
 private function assertTrustedResource(Resource $resource, RunConfiguration $runConfiguration, UserConfiguration $userConfiguration)
 {
     if ($resource instanceof LocalResource || $runConfiguration->isTrusted() || in_array($resource->getMetadata()->getOwner(), $userConfiguration->getTrustedUsers()) || in_array($resource->getSignature(), $userConfiguration->getTrustedSignatures())) {
         return;
     }
     throw new TrustException($resource);
 }
Example #2
0
 public function run($resourceName, array $arguments, RunConfiguration $configuration, $cliExecutor)
 {
     $this->garbageCollector->run();
     $resource = $this->createResource($resourceName);
     $script = $this->scriptBuilder->buildScript($resource, $arguments);
     $workingDirectory = $this->wdFactory->createTmpDir($script->getPackages());
     if ($configuration->noCache()) {
         $workingDirectory->clear();
     }
     if ($workingDirectory->isNew()) {
         $workingDirectory->create();
         $process = $this->composer->buildProcess($script->getPackages(), $workingDirectory->getPath(), $configuration->preferSource());
         $cliExecutor($process, true);
         $workingDirectory->lock();
     }
     $process = $this->runner->getProcess($script, $workingDirectory->getPath());
     return $cliExecutor($process, false);
 }