Returns all the webspaces managed by this specific instance.
public getWebspaceCollection ( ) : |
||
return |
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(); } }
/** * {@inheritdoc} */ public function initialize(OutputInterface $output, $purge = false) { $webspaces = $this->webspaceManager->getWebspaceCollection(); foreach ($webspaces as $webspace) { $this->initializeWebspace($output, $webspace); } $this->documentManager->flush(); }
protected function execute(InputInterface $input, OutputInterface $output) { /** @var Webspace $webspace */ foreach ($this->webspaceManager->getWebspaceCollection() as $webspace) { $this->upgradeWebspace($webspace, $output); } $this->liveSession->save(); }
/** * {@inheritdoc} */ public function getParameters() { $result = []; foreach ($this->webspaceManager->getWebspaceCollection() as $webspace) { $result[$webspace->getKey()] = $this->resourceLocatorStrategyPool->getStrategyByWebspaceKey($webspace->getKey())->getInputType(); } return $result; }
/** * {@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]]; }
/** * {@inheritDoc} */ public function getSecurityContexts() { $webspaceContexts = []; foreach ($this->webspaceManager->getWebspaceCollection() as $webspace) { /* @var Webspace $webspace */ $webspaceContexts[] = $this->securityContextPrefix . $webspace->getKey(); } return ['Sulu' => ['Webspaces' => $webspaceContexts]]; }
/** * {@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(); } }
/** * {@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]]; }
/** * {@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; }
/** * {@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(); }
/** * {@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]]; }
/** * {@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; }
/** * {@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); } }
/** * 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; }
/** * {@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; }