Skip to content

Commit

Permalink
fix login embed and validate webspace in community admin
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-schranz committed Mar 5, 2018
1 parent 6c40150 commit 3561ad9
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 3 deletions.
30 changes: 28 additions & 2 deletions Admin/CommunityAdmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,35 @@ public function getSecurityContexts()
{
$systems = [];

$webspaceCollection = $this->webspaceManager->getWebspaceCollection();

$webspaceKeys = array_keys($webspaceCollection->getWebspaces());

foreach ($this->webspacesConfiguration as $webspaceKey => $webspaceConfig) {
$webspace = $this->webspaceManager->getWebspaceCollection()->getWebspace($webspaceKey);
$system = $webspace->getSecurity()->getSystem();
$webspace = $webspaceCollection->getWebspace($webspaceKey);

if (!$webspace) {
throw new \InvalidArgumentException(
sprintf(
'Webspace "%s" not found for "sulu_community" expected one of %s.',
$webspaceKey,
'"' . implode('", "', $webspaceKeys) . '"'
)
);
}

$security = $webspace->getSecurity();

if (!$security) {
throw new \InvalidArgumentException(
sprintf(
'Missing "<security><system>Website</system><security>" configuration in webspace "%s" for "sulu_community".',
$webspaceKey
)
);
}

$system = $security->getSystem();
$systems[$system] = [];
}

Expand Down
2 changes: 1 addition & 1 deletion Resources/views/Login/login-embed.html.twig
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{% if maintenanceMode %}
{% if maintenanceMode %}
{# Show nothing in maintenance mode #}
{% else %}
{% if app.user %}
Expand Down

0 comments on commit 3561ad9

Please sign in to comment.