Skip to content

Instantly share code, notes, and snippets.

@aertmann
aertmann / Policy.yaml
Last active August 28, 2018 13:13
Multi-site access restriction with Neos CMS
privilegeTargets:
'Neos\Flow\Security\Authorization\Privilege\Entity\Doctrine\EntityPrivilege':
'Acme.Package:Site.Alpha':
matcher: 'isType("Neos\Neos\Domain\Model\Site") && property("nodeName") == "alpha"'
'Acme.Package:Site.Beta':
matcher: 'isType("Neos\Neos\Domain\Model\Site") && property("nodeName") == "beta"'
'Neos\Neos\Security\Authorization\Privilege\NodeTreePrivilege':
@aertmann
aertmann / Policy.yaml
Last active October 17, 2017 14:15
Multi-site access restriction with Neos CMS
privilegeTargets:
'Wwwision\AssetConstraints\Security\Authorization\Privilege\ReadAssetPrivilege':
'Acme.Package:Assets.Alpha':
matcher: 'isInCollection("Alpha")'
'Acme.Package:Assets.Beta':
matcher: 'isInCollection("Beta")'
'Wwwision\AssetConstraints\Security\Authorization\Privilege\ReadAssetCollectionPrivilege':
@aertmann
aertmann / Policy.yaml
Last active October 17, 2017 14:17
Multi-site access restriction with Neos CMS
privilegeTargets:
'Neos\Flow\Security\Authorization\Privilege\Entity\Doctrine\EntityPrivilege':
'Acme.Package:NotUsersSite':
matcher: 'isType("Neos\Neos\Domain\Model\Site") && property("nodeName") != "context.userInformationContext.account.accountIdentifier"'
'Wwwision\AssetConstraints\Security\Authorization\Privilege\ReadAssetPrivilege':
'Acme.Package:NotUsersAssets':
matcher: '!(isInCollection("context.userInformationContext.site.propertyName") || isWithoutCollection())'
@aertmann
aertmann / Policy.yaml
Last active October 17, 2017 14:14
Multi-site access restriction with Neos CMS
roles:
'Neos.Flow:Anonymous':
privileges:
-
privilegeTarget: 'Acme.Package:Site.Alpha'
permission: GRANT
-
privilegeTarget: 'Acme.Package:Site.Beta'
permission: GRANT
@aertmann
aertmann / Policy.yaml
Last active October 17, 2017 14:14
Multi-site access restriction with Neos CMS
privilegeTargets:
'Neos\Flow\Security\Authorization\Privilege\Entity\Doctrine\EntityPrivilege':
'Acme.Package:Site.Alpha':
matcher: 'isType("Neos\Neos\Domain\Model\Site") && property("nodeName") == "alpha"'
'Acme.Package:Site.Beta':
matcher: 'isType("Neos\Neos\Domain\Model\Site") && property("nodeName") == "beta"'
@aertmann
aertmann / Policy.yaml
Last active October 17, 2017 14:14
Multi-site access restriction with Neos CMS
roles:
'Acme.Package:Alpha':
privileges:
-
privilegeTarget: 'Acme.Package:Nodes.Alpha'
permission: GRANT
'Acme.Package:Beta':
privileges:
-
@aertmann
aertmann / Policy.yaml
Last active October 17, 2017 14:13
Multi-site access restriction with Neos CMS
privilegeTargets:
'Neos\Neos\Security\Authorization\Privilege\NodeTreePrivilege':
'Acme.Package:Nodes.Alpha':
matcher: 'isDescendantNodeOf("/sites/alpha")'
'Acme.Package:Nodes.Beta':
matcher: 'isDescendantNodeOf("/sites/beta")'
@aertmann
aertmann / Settings.yaml
Last active August 28, 2018 13:13
Multi-site access restriction with Neos CMS
Neos:
Flow:
security:
authentication:
providers:
NeosBackendProvider:
provider: 'Acme\Package\Security\Authentication\Provider\SiteAwarePersistedUsernamePasswordProvider'
root.footer {
@position = 'before default'
condition = ${request.parentRequest.uri.path == '/footer.html'}
renderPath = '/footer'
}
footer < page.footer # reference to footer TypoScript path
@aertmann
aertmann / Package.php
Last active December 4, 2015 04:42
Auto create content inside main collection for new pages in Neos CMS
<?php
namespace Acme\Demo;
use TYPO3\Flow\Package\Package as BasePackage;
use TYPO3\TYPO3CR\Domain\Model\NodeInterface;
class Package extends BasePackage {
/**
* @var \TYPO3\TYPO3CR\Domain\Service\NodeTypeManager nodeTypeManager