[jboss-jira] [JBoss JIRA] (WFCORE-176) role-mapping=x/include=y boot operation is generated with the wrong address

Alexey Loubyansky (JIRA) issues at jboss.org
Thu Oct 16 10:32:35 EDT 2014


    [ https://issues.jboss.org/browse/WFCORE-176?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13012568#comment-13012568 ] 

Alexey Loubyansky commented on WFCORE-176:
------------------------------------------

Possible fix

@@ -3342,13 +3342,11 @@ public class ManagementXml {
             final Element element = Element.forName(reader.getLocalName());
             switch (element) {
                 case INCLUDE: {
-                    ModelNode includeAddr = addr.clone().add(INCLUDE);
-                    parseIncludeExclude(reader, includeAddr, expectedNs, list);
+                    parseIncludeExclude(reader, addr.clone(), INCLUDE, expectedNs, list);
                     break;
                 }
                 case EXCLUDE: {
-                    ModelNode excludeAddr = addr.clone().add(EXCLUDE);
-                    parseIncludeExclude(reader, excludeAddr, expectedNs, list);
+                    parseIncludeExclude(reader, addr.clone(), EXCLUDE, expectedNs, list);
                     break;
                 }
                 default: {
@@ -3358,8 +3356,8 @@ public class ManagementXml {
         }
     }
 
-    private static void parseIncludeExclude(final XMLExtendedStreamReader reader, final ModelNode address, final Namespace expectedNs,
-            final List<ModelNode> list) throws XMLStreamException {
+    private static void parseIncludeExclude(final XMLExtendedStreamReader reader, final ModelNode address, String type,
+            final Namespace expectedNs, final List<ModelNode> list) throws XMLStreamException {
         ParseUtils.requireNoAttributes(reader);
 
         while (reader.hasNext() && reader.nextTag() != END_ELEMENT) {
@@ -3367,11 +3365,11 @@ public class ManagementXml {
             final Element element = Element.forName(reader.getLocalName());
             switch (element) {
                 case GROUP: {
-                    parsePrincipal(reader, address, GROUP, expectedNs, list);
+                    parsePrincipal(reader, address, type, GROUP, expectedNs, list);
                     break;
                 }
                 case USER: {
-                    parsePrincipal(reader, address, USER, expectedNs, list);
+                    parsePrincipal(reader, address, type, USER, expectedNs, list);
                     break;
                 }
                 default: {
@@ -3381,8 +3379,8 @@ public class ManagementXml {
         }
     }
 
-    private static void parsePrincipal(final XMLExtendedStreamReader reader, final ModelNode address, final String type,
-            final Namespace expectedNs, final List<ModelNode> list) throws XMLStreamException {
+    private static void parsePrincipal(final XMLExtendedStreamReader reader, final ModelNode address,
+            final String parentType, final String type, final Namespace expectedNs, final List<ModelNode> list) throws XMLStreamException {
         String alias = null;
         String realm = null;
         String name = null;
@@ -3425,7 +3423,7 @@ public class ManagementXml {
         }
 
         String addrValue = alias == null ? generateAlias(type, name, realm) : alias;
-        ModelNode addAddr = address.clone().add(addrValue);
+        ModelNode addAddr = address.clone().add(parentType, addrValue);
         addOp.get(OP_ADDR).set(addAddr);
         list.add(addOp);

> role-mapping=x/include=y boot operation is generated with the wrong address
> ---------------------------------------------------------------------------
>
>                 Key: WFCORE-176
>                 URL: https://issues.jboss.org/browse/WFCORE-176
>             Project: WildFly Core
>          Issue Type: Bug
>          Components: Domain Management
>            Reporter: Alexey Loubyansky
>            Assignee: Darran Lofthouse
>
> This is the request which is generated by the xml parser
> {"operation" => "add",
> "type" => "user",
> "name" => "$local",
> "address" => [
> ("core-service" => "management"),
> ("access" => "authorization"),
> ("role-mapping" => "SuperUser"),
> "include",
> "user-$local"
> ]
> include and user-$local are added separately, not as a pair.
> ManagementXml.parseRole(...) line 3345 adds include
> then parsePrincipal(...) line 3428 adds the alias.



--
This message was sent by Atlassian JIRA
(v6.3.1#6329)


More information about the jboss-jira mailing list