Skip to content

Instantly share code, notes, and snippets.

Avatar

Aske Ertmann aertmann

View GitHub Profile
@aertmann
aertmann / Policy.yaml
Last active Aug 28, 2018
Multi-site access restriction with Neos CMS
View Policy.yaml
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 Oct 17, 2017
Multi-site access restriction with Neos CMS
View Policy.yaml
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 Oct 17, 2017
Multi-site access restriction with Neos CMS
View Policy.yaml
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 Oct 17, 2017
Multi-site access restriction with Neos CMS
View Policy.yaml
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 Oct 17, 2017
Multi-site access restriction with Neos CMS
View Policy.yaml
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 Oct 17, 2017
Multi-site access restriction with Neos CMS
View Policy.yaml
roles:
'Acme.Package:Alpha':
privileges:
-
privilegeTarget: 'Acme.Package:Nodes.Alpha'
permission: GRANT
'Acme.Package:Beta':
privileges:
-
@aertmann
aertmann / Policy.yaml
Last active Oct 17, 2017
Multi-site access restriction with Neos CMS
View Policy.yaml
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 Aug 28, 2018
Multi-site access restriction with Neos CMS
View Settings.yaml
Neos:
Flow:
security:
authentication:
providers:
NeosBackendProvider:
provider: 'Acme\Package\Security\Authentication\Provider\SiteAwarePersistedUsernamePasswordProvider'
View gist:eac0e00c8194d5ffede5
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 Dec 4, 2015
Auto create content inside main collection for new pages in Neos CMS
View Package.php
<?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