File tree Expand file tree Collapse file tree 11 files changed +245
-12
lines changed
src/com/magento/idea/magento2plugin
actions/generation/generator
actions/generation/generator/AclXmlGenerator
generateAclXmlFileForNonExistedParent
getAclXmlFileAndGenerateNewAcl
project/magento2/vendor/magento
tests/com/magento/idea/magento2plugin/actions/generation/generator Expand file tree Collapse file tree 11 files changed +245
-12
lines changed Original file line number Diff line number Diff line change @@ -91,17 +91,20 @@ public PsiFile generate(final String actionName) {
9191 aclXmlData .getParentResourceId ()
9292 );
9393 XmlTag parent = resourcesTag ;
94- for (final AclXmlData resourceTagData : tree ) {
95- if (resourceTagData .getParentResourceId () != null ) {
96- parent = resourcesTag .createChildTag (
97- ModuleAclXml .XML_TAG_RESOURCE ,
98- null ,
99- "" ,
100- false
101- );
102- parent .setAttribute (ModuleAclXml .XML_ATTR_ID , resourceTagData .getResourceId ());
94+
95+ if (tree != null ) {
96+ for (final AclXmlData resourceTagData : tree ) {
97+ if (resourceTagData .getParentResourceId () != null ) {
98+ parent = resourcesTag .createChildTag (
99+ ModuleAclXml .XML_TAG_RESOURCE ,
100+ null ,
101+ "" ,
102+ false
103+ );
104+ parent .setAttribute (ModuleAclXml .XML_ATTR_ID , resourceTagData .getResourceId ());
105+ }
106+ parent = createOrGetResourceTag (parent , resourceTagData .getResourceId ());
103107 }
104- parent = createOrGetResourceTag (parent , resourceTagData .getResourceId ());
105108 }
106109 final XmlTag targetTag = parent .createChildTag (
107110 ModuleAclXml .XML_TAG_RESOURCE ,
Original file line number Diff line number Diff line change @@ -40,11 +40,12 @@ public static List<AclXmlData> execute(
4040 targetAclResourceId ,
4141 GlobalSearchScope .allScope (project )
4242 );
43- final VirtualFile virtualFile = virtualFiles .iterator ().next ();
4443
45- if (virtualFile == null ) {
44+ if (virtualFiles . isEmpty () ) {
4645 return null ;
4746 }
47+ final VirtualFile virtualFile = virtualFiles .iterator ().next ();
48+
4849 final XmlFile aclXml = (XmlFile ) PsiManager .getInstance (project ).findFile (virtualFile );
4950 final XmlTag rootTag = aclXml .getRootTag ();
5051 final List <AclXmlData > aclXmlDataList = new LinkedList <>();
Original file line number Diff line number Diff line change 1+ <?xml version =" 1.0" ?>
2+ <config xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
3+ xsi : noNamespaceSchemaLocation =" urn:magento:framework:Acl/etc/acl.xsd" >
4+ <acl >
5+ <resources >
6+ <resource id =" Magento_Backend::admin" >
7+ <resource id =" Magento_Backend::stores" >
8+ <resource id =" Magento_Backend::stores_settings" >
9+ <resource id =" Magento_Config::config" >
10+ <resource id =" Foo_Bar::manage" title =" Bar Management" />
11+ </resource >
12+ </resource >
13+ </resource >
14+ </resource >
15+ </resources >
16+ </acl >
17+ </config >
Original file line number Diff line number Diff line change 1+ <?xml version =" 1.0" ?>
2+ <config xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
3+ xsi : noNamespaceSchemaLocation =" urn:magento:framework:Acl/etc/acl.xsd" >
4+ <acl >
5+ <resources >
6+ <resource id =" Foo_Bar::test" title =" Non Existed Test" />
7+ </resources >
8+ </acl >
9+ </config >
Original file line number Diff line number Diff line change 1+ <?xml version =" 1.0" ?>
2+ <config xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
3+ xsi : noNamespaceSchemaLocation =" urn:magento:framework:Acl/etc/acl.xsd" >
4+ <acl >
5+ <resources >
6+ <resource id =" Magento_Backend::admin" >
7+ <resource id =" Magento_Backend::stores" >
8+ <resource id =" Magento_Backend::stores_settings" >
9+ <resource id =" Magento_Config::config" >
10+ <resource id =" Foo_Bar::manage" title =" Bar Management" >
11+ <resource id =" Foo_Bar::manage_save" title =" Save" />
12+ </resource >
13+ </resource >
14+ </resource >
15+ </resource >
16+ </resource >
17+ </resources >
18+ </acl >
19+ </config >
Original file line number Diff line number Diff line change 1+ <?xml version =" 1.0" ?>
2+ <!--
3+ /**
4+ * Copyright © Magento, Inc. All rights reserved.
5+ * See COPYING.txt for license details.
6+ */
7+ -->
8+ <config xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
9+ xsi : noNamespaceSchemaLocation =" urn:magento:framework:Acl/etc/acl.xsd" >
10+ <acl >
11+ <resources >
12+ <resource id =" Magento_Backend::all" title =" Allow everything" translate =" title" sortOrder =" 10" />
13+ <resource id =" Magento_Backend::admin" title =" Magento Admin" translate =" title" sortOrder =" 20" >
14+ <resource id =" Magento_Backend::dashboard" title =" Dashboard" translate =" title" sortOrder =" 0" />
15+ <resource id =" Magento_Backend::stores" title =" Stores" translate =" title" sortOrder =" 80" >
16+ <resource id =" Magento_Backend::stores_settings" title =" Settings" translate =" title" sortOrder =" 10" >
17+ <resource id =" Magento_Backend::store" title =" All Stores" translate =" title" sortOrder =" 10" />
18+ </resource >
19+ </resource >
20+ </resource >
21+ </resources >
22+ </acl >
23+ </config >
Original file line number Diff line number Diff line change 1+ {
2+ "name" : " magento/module-config" ,
3+ "description" : " N/A" ,
4+ "config" : {
5+ "sort-packages" : true
6+ },
7+ "require" : {
8+ "php" : " ~7.1.3||~7.2.0||~7.3.0" ,
9+ "magento/framework" : " 102.0.*" ,
10+ "magento/module-backend" : " 101.0.*"
11+ },
12+ "type" : " magento2-module" ,
13+ "license" : [
14+ " OSL-3.0" ,
15+ " AFL-3.0"
16+ ],
17+ "autoload" : {
18+ "files" : [
19+ " registration.php"
20+ ],
21+ "psr-4" : {
22+ "Magento\\ Config\\ " : " "
23+ }
24+ },
25+ "version" : " 101.1.5"
26+ }
Original file line number Diff line number Diff line change 1+ <?xml version =" 1.0" ?>
2+ <!--
3+ /**
4+ * Copyright © Magento, Inc. All rights reserved.
5+ * See COPYING.txt for license details.
6+ */
7+ -->
8+ <config xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
9+ xsi : noNamespaceSchemaLocation =" urn:magento:framework:Acl/etc/acl.xsd" >
10+ <acl >
11+ <resources >
12+ <resource id =" Magento_Backend::admin" >
13+ <resource id =" Magento_Backend::stores" >
14+ <resource id =" Magento_Backend::stores_settings" >
15+ <resource id =" Magento_Config::config" title =" Configuration" translate =" title" sortOrder =" 20" >
16+ <resource id =" Magento_Config::advanced" title =" Advanced Section" translate =" title" sortOrder =" 90" disabled =" true" />
17+ <resource id =" Magento_Config::config_admin" title =" Advanced Admin Section" translate =" title" sortOrder =" 100" />
18+ <resource id =" Magento_Config::config_design" title =" Design Section" translate =" title" sortOrder =" 40" />
19+ <resource id =" Magento_Config::config_general" title =" General Section" translate =" title" sortOrder =" 20" />
20+ <resource id =" Magento_Config::config_system" title =" System Section" translate =" title" sortOrder =" 80" />
21+ </resource >
22+ </resource >
23+ </resource >
24+ </resource >
25+ </resources >
26+ </acl >
27+ </config >
Original file line number Diff line number Diff line change 1+ <?xml version =" 1.0" ?>
2+ <!--
3+ /**
4+ * Copyright © Magento, Inc. All rights reserved.
5+ * See COPYING.txt for license details.
6+ */
7+ -->
8+ <config xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
9+ xsi : noNamespaceSchemaLocation =" urn:magento:framework:Module/etc/module.xsd" >
10+ <module name =" Magento_Config" />
11+ </config >
Original file line number Diff line number Diff line change 1+ <?php
2+ /**
3+ * Copyright © Magento, Inc. All rights reserved.
4+ * See COPYING.txt for license details.
5+ */
6+
7+ use \Magento \Framework \Component \ComponentRegistrar ;
8+
9+ ComponentRegistrar::register (ComponentRegistrar::MODULE , 'Magento_Config ' , __DIR__ );
You can’t perform that action at this time.
0 commit comments