Skip to content

Commit

Permalink
Merge pull request #184 from ezsystems/admin-siteaccess
Browse files Browse the repository at this point in the history
fix: Remove SiteAccess generation and rely on manual configuration
  • Loading branch information
Łukasz Serwatka authored Dec 15, 2017
2 parents f33c57d + 8428df3 commit 0916665
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 66 deletions.
7 changes: 2 additions & 5 deletions src/bundle/EzPlatformAdminUiBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
namespace EzSystems\EzPlatformAdminUiBundle;

use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\EzPublishCoreExtension;
use EzSystems\EzPlatformAdminUi\SiteAccess\AdminFilter;
use EzSystems\EzPlatformAdminUiBundle\DependencyInjection\Compiler\ComponentPass;
use EzSystems\EzPlatformAdminUiBundle\DependencyInjection\Compiler\SystemInfoTabGroupPass;
use EzSystems\EzPlatformAdminUiBundle\DependencyInjection\Compiler\TabPass;
Expand All @@ -18,14 +17,12 @@

class EzPlatformAdminUiBundle extends Bundle
{
const ADMIN_GROUP_NAME = 'admin_group';

public function build(ContainerBuilder $container)
{
/** @var EzPublishCoreExtension $core */
$core = $container->getExtension('ezpublish');
$core->addSiteAccessConfigurationFilter(
new AdminFilter()
);

$core->addConfigParser(new LocationIds());
$core->addDefaultSettings(__DIR__ . '/Resources/config', ['ezplatform_default_settings.yml']);

Expand Down
10 changes: 5 additions & 5 deletions src/bundle/Resources/config/default_parameters.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
parameters:
ezsettings.admin.content_edit.templates.edit: 'EzPlatformAdminUiBundle:content/content_edit:content_edit.html.twig'
ezsettings.admin.content_edit.templates.create: 'EzPlatformAdminUiBundle:content/content_edit:content_create.html.twig'
ezsettings.admin.content_edit.templates.create_draft: 'EzPlatformAdminUiBundle:content/content_edit:content_create_draft.html.twig'
ezsettings.admin.user_edit.templates.update: 'EzPlatformAdminUiBundle:content/content_edit:user_edit.html.twig'
ezsettings.admin.user_edit.templates.create: 'EzPlatformAdminUiBundle:content/content_edit:user_create.html.twig'
ezsettings.admin_group.content_edit.templates.edit: 'EzPlatformAdminUiBundle:content/content_edit:content_edit.html.twig'
ezsettings.admin_group.content_edit.templates.create: 'EzPlatformAdminUiBundle:content/content_edit:content_create.html.twig'
ezsettings.admin_group.content_edit.templates.create_draft: 'EzPlatformAdminUiBundle:content/content_edit:content_create_draft.html.twig'
ezsettings.admin_group.user_edit.templates.update: 'EzPlatformAdminUiBundle:content/content_edit:user_edit.html.twig'
ezsettings.admin_group.user_edit.templates.create: 'EzPlatformAdminUiBundle:content/content_edit:user_create.html.twig'

ezsettings.global.system_info_view:
pjax_tab:
Expand Down
2 changes: 1 addition & 1 deletion src/bundle/Resources/config/views.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
system:
admin:
admin_group:
user:
login_template: "@EzPlatformAdminUi/Security/login.html.twig"
content_view:
Expand Down
4 changes: 2 additions & 2 deletions src/lib/EventListener/RequestAttributesListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
use eZ\Publish\API\Repository\Values\Content\Content;
use eZ\Publish\API\Repository\Values\Content\Location;
use eZ\Publish\Core\MVC\Symfony\View\Event\FilterViewBuilderParametersEvent;
use EzSystems\EzPlatformAdminUi\SiteAccess\AdminFilter;
use EzSystems\EzPlatformAdminUiBundle\EzPlatformAdminUiBundle;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use eZ\Publish\Core\MVC\Symfony\View\ViewEvents;
use Symfony\Component\HttpFoundation\ParameterBag;
Expand Down Expand Up @@ -124,6 +124,6 @@ private function isAdmin(Request $request): bool
{
$siteAccess = $request->attributes->get('siteaccess');

return in_array($siteAccess->name, $this->siteAccessGroups[AdminFilter::ADMIN_GROUP_NAME], true);
return in_array($siteAccess->name, $this->siteAccessGroups[EzPlatformAdminUiBundle::ADMIN_GROUP_NAME], true);
}
}
53 changes: 0 additions & 53 deletions src/lib/SiteAccess/AdminFilter.php

This file was deleted.

0 comments on commit 0916665

Please sign in to comment.