diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e43b0f9 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.DS_Store diff --git a/Configuration/NodeTypes.Mixin.Privilege.CreateNode.yaml b/Configuration/NodeTypes.Mixin.Privilege.CreateNode.yaml new file mode 100644 index 0000000..9620684 --- /dev/null +++ b/Configuration/NodeTypes.Mixin.Privilege.CreateNode.yaml @@ -0,0 +1,2 @@ +'Tms.Policy:Mixin.Privilege.CreateNode': + abstract: true diff --git a/Configuration/NodeTypes.Mixin.Privilege.EditNode.yaml b/Configuration/NodeTypes.Mixin.Privilege.EditNode.yaml new file mode 100644 index 0000000..a26198a --- /dev/null +++ b/Configuration/NodeTypes.Mixin.Privilege.EditNode.yaml @@ -0,0 +1,2 @@ +'Tms.Policy:Mixin.Privilege.EditNode': + abstract: true diff --git a/Configuration/NodeTypes.Mixin.Privilege.RemoveNode.yaml b/Configuration/NodeTypes.Mixin.Privilege.RemoveNode.yaml new file mode 100644 index 0000000..5554b34 --- /dev/null +++ b/Configuration/NodeTypes.Mixin.Privilege.RemoveNode.yaml @@ -0,0 +1,2 @@ +'Tms.Policy:Mixin.Privilege.RemoveNode': + abstract: true diff --git a/Configuration/Policy.yaml b/Configuration/Policy.yaml new file mode 100644 index 0000000..b55c8a8 --- /dev/null +++ b/Configuration/Policy.yaml @@ -0,0 +1,22 @@ +privilegeTargets: + Neos\ContentRepository\Security\Authorization\Privilege\Node\CreateNodePrivilege: + 'Tms.Policy:Mixin.Privilege.CreateNode': + matcher: 'createdNodeIsOfType("Tms.Policy:Mixin.Privilege.CreateNode")' + + Neos\ContentRepository\Security\Authorization\Privilege\Node\EditNodePrivilege: + 'Tms.Policy:Mixin.Privilege.EditNode': + matcher: 'nodeIsOfType("Tms.Policy:Mixin.Privilege.EditNode")' + + Neos\ContentRepository\Security\Authorization\Privilege\Node\RemoveNodePrivilege: + 'Tms.Policy:Mixin.Privilege.RemoveNode': + matcher: 'nodeIsOfType("Tms.Policy:Mixin.Privilege.RemoveNode")' + +roles: + 'Neos.Neos:Administrator': + privileges: + - privilegeTarget: 'Tms.Policy:Mixin.Privilege.CreateNode' + permission: GRANT + - privilegeTarget: 'Tms.Policy:Mixin.Privilege.EditNode' + permission: GRANT + - privilegeTarget: 'Tms.Policy:Mixin.Privilege.RemoveNode' + permission: GRANT diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..333a6a1 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 tms.development + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..5662126 --- /dev/null +++ b/README.md @@ -0,0 +1,26 @@ +# Tms.Policy + +Nodetype mixins for common privilege tasks in your Neos CMS setup. + +**Why would I need mixins for that?** Keeping the number of privilege targets as low as possible can boost your Neos backend performance. + +## Install + +```bash +composer require tms/policy +``` + +## Usage + +```yaml +'Your.Package:Type': + superTypes: + 'Tms.Policy:Mixin.Privilege.CreateNode': true + 'Tms.Policy:Mixin.Privilege.RemoveNode': true +``` + +This configuration allows only `Administrator` roles to create and/or remove node of type `Your.Package:Type`. Feel free to adjust the policy settings to your needs. + +## Acknowledgments + +Development sponsored by [tms.development - Online Marketing and Neos CMS Agency](https://www.tms-development.de/) diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..f3e0147 --- /dev/null +++ b/composer.json @@ -0,0 +1,88 @@ +{ + "name": "tms/policy", + "type": "neos-tms", + "description": "Nodetype mixins for common privilege tasks in your Neos CMS setup.", + "require": { + "neos/neos": "*" + }, + "autoload": { + "psr-4": { + "Tms\\Policy\\": "Classes" + } + }, + "extra": { + "applied-flow-migrations": [ + "TYPO3.FLOW3-201201261636", + "TYPO3.Fluid-201205031303", + "TYPO3.FLOW3-201205292145", + "TYPO3.FLOW3-201206271128", + "TYPO3.FLOW3-201209201112", + "TYPO3.Flow-201209251426", + "TYPO3.Flow-201211151101", + "TYPO3.Flow-201212051340", + "TYPO3.TypoScript-130516234520", + "TYPO3.TypoScript-130516235550", + "TYPO3.TYPO3CR-130523180140", + "TYPO3.Flow-201310031523", + "TYPO3.Flow-201405111147", + "TYPO3.Neos-201407061038", + "TYPO3.Neos-201409071922", + "TYPO3.TYPO3CR-140911160326", + "TYPO3.Neos-201410010000", + "TYPO3.TYPO3CR-141101082142", + "TYPO3.Neos-20141113115300", + "TYPO3.Fluid-20141113120800", + "TYPO3.Flow-20141113121400", + "TYPO3.Fluid-20141121091700", + "TYPO3.Neos-20141218134700", + "TYPO3.Fluid-20150214130800", + "TYPO3.Neos-20150303231600", + "TYPO3.TYPO3CR-20150510103823", + "TYPO3.Flow-20151113161300", + "TYPO3.Form-20160601101500", + "TYPO3.Flow-20161115140400", + "TYPO3.Flow-20161115140430", + "Neos.Flow-20161124204700", + "Neos.Flow-20161124204701", + "Neos.Twitter.Bootstrap-20161124204912", + "Neos.Form-20161124205254", + "Neos.Flow-20161124224015", + "Neos.Party-20161124225257", + "Neos.Eel-20161124230101", + "Neos.Setup-20161124230842", + "Neos.Imagine-20161124231742", + "Neos.Media-20161124233100", + "Neos.Neos-20161125002322", + "Neos.ContentRepository-20161125012000", + "Neos.Fusion-20161125013710", + "Neos.Setup-20161125014759", + "Neos.Fusion-20161125104701", + "Neos.Neos-20161125104802", + "Neos.Neos-20161125122412", + "Neos.Flow-20161125124112", + "Neos.SwiftMailer-20161130105617", + "TYPO3.FluidAdaptor-20161130112935", + "Neos.Fusion-20161201202543", + "Neos.Neos-20161201222211", + "Neos.Fusion-20161202215034", + "Neos.ContentRepository.Search-20161210231100", + "Neos.Fusion-20161219092345", + "Neos.ContentRepository-20161219093512", + "Neos.Media-20161219094126", + "Neos.Neos-20161219094403", + "Neos.Neos-20161219122512", + "Neos.Fusion-20161219130100", + "Neos.Neos-20161220163741", + "Neos.Neos-20170115114620", + "Neos.Fusion-20170120013047", + "Neos.Flow-20170125103800", + "Neos.Seo-20170127154600", + "Neos.Flow-20170127183102", + "Neos.Fusion-20180211175500", + "Neos.Fusion-20180211184832", + "Neos.Flow-20180415105700", + "Neos.Neos-20180907103800", + "Neos.Neos.Ui-20190319094900" + ] + } +}