getWebspaceCollection() 공개 메소드

Returns all the webspaces managed by this specific instance.
public getWebspaceCollection ( ) : WebspaceCollection
리턴 WebspaceCollection
예제 #1
0
 public function initialize(OutputInterface $output, $purge = false)
 {
     $nodeTypeManager = $this->sessionManager->getSession()->getWorkspace()->getNodeTypeManager();
     foreach ([new CustomUrlNodeType(), new CustomUrlRouteNodeType()] as $nodeType) {
         $nodeTypeManager->registerNodeType($nodeType, true);
     }
     /** @var Webspace $webspace */
     foreach ($this->webspaceManager->getWebspaceCollection() as $webspace) {
         $itemsPath = $this->pathBuilder->build(['%base%', $webspace->getKey(), '%custom_urls%', '%custom_urls_items%']);
         $routesPath = $this->pathBuilder->build(['%base%', $webspace->getKey(), '%custom_urls%', '%custom_urls_routes%']);
         $output->writeln(sprintf('  <info>%s</info>:', $webspace->getName()));
         if (true === $this->nodeManager->has($itemsPath)) {
             $output->writeln(sprintf('  [ ] <info>items path:</info>: %s ', $itemsPath));
         } else {
             $output->writeln(sprintf('  [+] <info>items path:</info>: %s ', $itemsPath));
             $this->nodeManager->createPath($itemsPath);
         }
         if (true === $this->nodeManager->has($routesPath)) {
             $output->writeln(sprintf('  [ ] <info>items path:</info>: %s ', $routesPath));
         } else {
             $output->writeln(sprintf('  [+] <info>items path:</info>: %s ', $routesPath));
             $this->nodeManager->createPath($routesPath);
         }
         $this->nodeManager->save();
     }
 }
예제 #2
0
 /**
  * {@inheritdoc}
  */
 public function initialize(OutputInterface $output, $purge = false)
 {
     $webspaces = $this->webspaceManager->getWebspaceCollection();
     foreach ($webspaces as $webspace) {
         $this->initializeWebspace($output, $webspace);
     }
     $this->documentManager->flush();
 }
예제 #3
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     /** @var Webspace $webspace */
     foreach ($this->webspaceManager->getWebspaceCollection() as $webspace) {
         $this->upgradeWebspace($webspace, $output);
     }
     $this->liveSession->save();
 }
예제 #4
0
 /**
  * {@inheritdoc}
  */
 public function getParameters()
 {
     $result = [];
     foreach ($this->webspaceManager->getWebspaceCollection() as $webspace) {
         $result[$webspace->getKey()] = $this->resourceLocatorStrategyPool->getStrategyByWebspaceKey($webspace->getKey())->getInputType();
     }
     return $result;
 }
예제 #5
0
 /**
  * {@inheritdoc}
  */
 public function getSecurityContexts()
 {
     $webspaceContexts = [];
     foreach ($this->webspaceManager->getWebspaceCollection() as $webspace) {
         /* @var Webspace $webspace */
         $webspaceContexts[] = self::SECURITY_CONTEXT_PREFIX . $webspace->getKey();
     }
     return ['Sulu' => ['Webspaces' => $webspaceContexts]];
 }
예제 #6
0
 /**
  * {@inheritDoc}
  */
 public function getSecurityContexts()
 {
     $webspaceContexts = [];
     foreach ($this->webspaceManager->getWebspaceCollection() as $webspace) {
         /* @var Webspace $webspace */
         $webspaceContexts[] = $this->securityContextPrefix . $webspace->getKey();
     }
     return ['Sulu' => ['Webspaces' => $webspaceContexts]];
 }
예제 #7
0
 /**
  * {@inheritdoc}
  */
 public function build()
 {
     $webspaceCollection = $this->webspaceManager->getWebspaceCollection();
     foreach ($webspaceCollection as $webspace) {
         $contentNode = $this->sessionManager->getContentNode($webspace->getKey());
         $this->traverse($contentNode);
         $this->sessionManager->getSession()->save();
     }
 }
예제 #8
0
 /**
  * {@inheritdoc}
  */
 public function getSecurityContexts()
 {
     $webspaceContexts = [];
     /* @var Webspace $webspace */
     foreach ($this->webspaceManager->getWebspaceCollection() as $webspace) {
         $webspaceContexts[self::getCustomUrlSecurityContext($webspace->getKey())] = [PermissionTypes::VIEW, PermissionTypes::ADD, PermissionTypes::EDIT, PermissionTypes::DELETE];
     }
     return ['Sulu' => ['Webspace Settings' => $webspaceContexts]];
 }
예제 #9
0
파일: SnippetAdmin.php 프로젝트: sulu/sulu
 /**
  * {@inheritdoc}
  */
 public function getSecurityContexts()
 {
     $contexts = ['Sulu' => ['Global' => ['sulu.global.snippets' => [PermissionTypes::VIEW, PermissionTypes::ADD, PermissionTypes::EDIT, PermissionTypes::DELETE]]]];
     if ($this->defaultEnabled) {
         $webspaceContexts = [];
         /* @var Webspace $webspace */
         foreach ($this->webspaceManager->getWebspaceCollection() as $webspace) {
             $webspaceContexts[self::getDefaultSnippetsSecurityContext($webspace->getKey())] = [PermissionTypes::VIEW, PermissionTypes::EDIT];
         }
         $contexts['Sulu']['Webspace Settings'] = $webspaceContexts;
     }
     return $contexts;
 }
예제 #10
0
 /**
  * {@inheritdoc}
  */
 public function build()
 {
     foreach ($this->webspaceManager->getWebspaceCollection() as $webspace) {
         $contentPath = $this->sessionManager->getContentPath($webspace->getKey());
         $this->context->getOutput()->writeln('Default workspace');
         $this->traverse($this->defaultSession->getNode($contentPath));
         $this->context->getOutput()->writeln('');
         $this->context->getOutput()->writeln('Live workspace');
         $this->traverse($this->liveSession->getNode($contentPath));
     }
     $this->defaultSession->save();
     $this->liveSession->save();
 }
예제 #11
0
파일: ContentAdmin.php 프로젝트: sulu/sulu
 /**
  * {@inheritdoc}
  */
 public function getSecurityContexts()
 {
     $webspaceContexts = [];
     foreach ($this->webspaceManager->getWebspaceCollection() as $webspace) {
         /* @var Webspace $webspace */
         $webspaceContexts[self::SECURITY_CONTEXT_PREFIX . $webspace->getKey()] = [PermissionTypes::VIEW, PermissionTypes::ADD, PermissionTypes::EDIT, PermissionTypes::DELETE, PermissionTypes::LIVE, PermissionTypes::SECURITY];
     }
     return ['Sulu' => ['Webspaces' => $webspaceContexts]];
 }
예제 #12
0
 /**
  * {@inheritdoc}
  */
 public function isDefault($uuid)
 {
     foreach ($this->webspaceManager->getWebspaceCollection() as $webspace) {
         $settings = $this->settingsManager->loadStringByWildcard($webspace->getKey(), 'snippets-*');
         if (in_array($uuid, $settings)) {
             return true;
         }
     }
     return false;
 }
예제 #13
0
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->output = $output;
     $this->sitemapDumper = $this->getContainer()->get('sulu_website.sitemap.xml_dumper');
     $this->webspaceManager = $this->getContainer()->get('sulu_core.webspace.webspace_manager');
     $this->filesystem = new Filesystem();
     $this->environment = $this->getContainer()->getParameter('kernel.environment');
     $this->baseDirectory = $this->getContainer()->getParameter('sulu_website.sitemap.dump_dir');
     if ($input->getOption('https')) {
         $this->scheme = 'https';
     }
     if ($input->getOption('clear')) {
         $this->filesystem->remove(rtrim($this->baseDirectory, '/') . '/' . $this->scheme);
     }
     $output->writeln('Start dumping "sitemap.xml" files:');
     foreach ($this->webspaceManager->getWebspaceCollection()->getWebspaces() as $webspace) {
         $this->dumpWebspace($webspace);
     }
 }
예제 #14
0
파일: WebsiteAdmin.php 프로젝트: sulu/sulu
 /**
  * Check the permissions for all webspaces.
  * Returns true if the user has live permission in all webspaces.
  *
  * @return bool
  */
 private function checkLivePermissionForAllWebspaces()
 {
     foreach ($this->webspaceManager->getWebspaceCollection() as $webspace) {
         $context = ContentAdmin::SECURITY_CONTEXT_PREFIX . $webspace->getKey();
         if (!$this->securityChecker->hasPermission($context, PermissionTypes::LIVE)) {
             return false;
         }
     }
     return true;
 }
예제 #15
0
 /**
  * {@inheritdoc}
  */
 public function getNodesTree($uuid, $webspaceKey, $languageCode, $excludeGhosts = false, $appendWebspaceNode = false)
 {
     $nodes = $this->loadNodeAndAncestors($uuid, $webspaceKey, $languageCode, $excludeGhosts, true);
     if ($appendWebspaceNode) {
         $webspace = $this->webspaceManager->getWebspaceCollection()->getWebspace($webspaceKey);
         $result = ['_embedded' => ['nodes' => [['id' => $this->sessionManager->getContentNode($webspace->getKey())->getIdentifier(), 'path' => '/', 'title' => $webspace->getName(), 'publishedState' => true, 'hasSub' => true, '_embedded' => ['nodes' => $nodes], '_links' => ['children' => ['href' => $this->apiBasePath . '?depth=1&webspace=' . $webspaceKey . '&language=' . $languageCode . ($excludeGhosts === true ? '&exclude-ghosts=true' : '')]]]]]];
     } else {
         $result = ['_embedded' => ['nodes' => $nodes]];
     }
     // add api links
     $result['_links'] = ['self' => ['href' => $this->apiBasePath . '/tree?uuid=' . $uuid . '&webspace=' . $webspaceKey . '&language=' . $languageCode . ($excludeGhosts === true ? '&exclude-ghosts=true' : '') . ($appendWebspaceNode === true ? '&webspace-node=true' : '')]];
     return $result;
 }