[JIRA] (JENKINS-58703) creating folder via XML results in double property

0 views
Skip to first unread message

m.winter@sap.com (JIRA)

unread,
Jul 29, 2019, 6:22:02 AM7/29/19
to jenkinsc...@googlegroups.com
Markus Winter created an issue
 
Jenkins / Bug JENKINS-58703
creating folder via XML results in double property
Issue Type: Bug Bug
Assignee: Daniel Beck
Attachments: folder.xml
Components: matrix-auth-plugin
Created: 2019-07-29 10:21
Environment: Jenkins 2.164.3
Priority: Minor Minor
Reporter: Markus Winter

 Create folder by posting attached xml to createItem?name=testFolder

This results in the following config.xml being generated.

  <properties>
    <com.cloudbees.hudson.plugins.folder.properties.AuthorizationMatrixProperty>
      <inheritanceStrategy class="org.jenkinsci.plugins.matrixauth.inheritance.NonInheritingStrategy"/>
      <permission>hudson.model.Item.Read:authenticated</permission>
    </com.cloudbees.hudson.plugins.folder.properties.AuthorizationMatrixProperty>
    <com.cloudbees.hudson.plugins.folder.properties.AuthorizationMatrixProperty reference="../com.cloudbees.hudson.plugins.folder.properties.AuthorizationMatrixProperty"/>

As you can see we have 2 AuthorizationMatrixProperty elements.

The problem is that the ItemListener adds the AuthorizationMatrixProperty even when it already existed (see line 244 code)

 

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

m.winter@sap.com (JIRA)

unread,
Jul 29, 2019, 6:24:02 AM7/29/19
to jenkinsc...@googlegroups.com
Markus Winter updated an issue
Change By: Markus Winter
 Create folder by posting attached xml to createItem?name=testFolder

This results in the following config.xml being generated.
{code:java}
  <
?xml version='1.1' encoding='UTF-8'?>
<com.cloudbees.hudson.plugins.folder.Folder plugin="cloudbees-folder@6.8">
  <description>test</description>  <
properties>

    <com.cloudbees.hudson.plugins.folder.properties.AuthorizationMatrixProperty>
      <inheritanceStrategy class="org.jenkinsci.plugins.matrixauth.inheritance.NonInheritingStrategy"/>
      <permission>hudson.model.Item.Read:authenticated</permission>
    </com.cloudbees.hudson.plugins.folder.properties.AuthorizationMatrixProperty>
    <com.cloudbees.hudson.plugins.folder.properties.AuthorizationMatrixProperty reference="../com.cloudbees.hudson.plugins.folder.properties.AuthorizationMatrixProperty"/>
...
  <icon class="com.cloudbees.hudson.plugins.folder.icons.StockFolderIcon"/>
</com.cloudbees.hudson.plugins.folder.Folder>
{code}

As you can see we have 2 AuthorizationMatrixProperty elements.

The problem is that the ItemListener adds the AuthorizationMatrixProperty even when it already existed (see line 244 [code|https://github.com/jenkinsci/matrix-auth-plugin/blob/8c7b7bcec67a03ab73498486fc2029b2b886541d/src/main/java/com/cloudbees/hudson/plugins/folder/properties/AuthorizationMatrixProperty.java#L244])

 

m.winter@sap.com (JIRA)

unread,
Jul 29, 2019, 6:25:03 AM7/29/19
to jenkinsc...@googlegroups.com
Markus Winter updated an issue
Change By: Markus Winter
Environment: Jenkins 2.164.3
matrix auth plugin 2.4.2

m.winter@sap.com (JIRA)

unread,
Jul 29, 2019, 6:26:02 AM7/29/19
to jenkinsc...@googlegroups.com
Markus Winter updated an issue
 Create folder by posting attached xml to createItem?name=testFolder

This results in the following config.xml being generated.
{code:java}
<?xml version='1.1' encoding='UTF-8'?>
<com.cloudbees.hudson.plugins.folder.Folder plugin="cloudbees-folder@6.8">
  <description>test</description>  <properties>
    <com.cloudbees.hudson.plugins.folder.properties.AuthorizationMatrixProperty>
      <inheritanceStrategy class="org.jenkinsci.plugins.matrixauth.inheritance.NonInheritingStrategy"/>
      <permission>hudson.model.Item.Read:authenticated</permission>
    </com.cloudbees.hudson.plugins.folder.properties.AuthorizationMatrixProperty>
    <com.cloudbees.hudson.plugins.folder.properties.AuthorizationMatrixProperty reference="../com.cloudbees.hudson.plugins.folder.properties.AuthorizationMatrixProperty"/>
...
  <icon class="com.cloudbees.hudson.plugins.folder.icons.StockFolderIcon"/>
</com.cloudbees.hudson.plugins.folder.Folder>
{code}
As you can see we have 2 AuthorizationMatrixProperty elements.

The problem is that the ItemListener adds the AuthorizationMatrixProperty even when it already existed (see line 244 [code|https://github.com/jenkinsci/matrix-auth-plugin/blob/8c7b7bcec67a03ab73498486fc2029b2b886541d/src/main/java/com/cloudbees/hudson/plugins/folder/properties/AuthorizationMatrixProperty.java#L244])

This is not causing issues but is irritating.

Saving via the UI without changing anything resolves the issue.

 

dbeck@cloudbees.com (JIRA)

unread,
Aug 1, 2019, 5:12:02 AM8/1/19
to jenkinsc...@googlegroups.com
Daniel Beck commented on Bug JENKINS-58703
 
Re: creating folder via XML results in double property

This raises an interesting question: What should the behavior be when a user submits a folder configuration with AuthorizationMatrixProperty, but doesn't include themselves in the permissions for Read/Configure? The listener was written for use with the UI (in which the sequence of steps prevents users from granting themselves permission), rather than the API.

I think an argument can be made for both cases, so I plan to only address the specific reported issue here, rather than introduce a larger behavior change.

dbeck@cloudbees.com (JIRA)

unread,
Aug 1, 2019, 5:14:03 AM8/1/19
to jenkinsc...@googlegroups.com
Daniel Beck started work on Bug JENKINS-58703
 
Change By: Daniel Beck
Status: Open In Progress

dbeck@cloudbees.com (JIRA)

unread,
Aug 1, 2019, 5:52:02 AM8/1/19
to jenkinsc...@googlegroups.com

dbeck@cloudbees.com (JIRA)

unread,
Oct 14, 2019, 7:14:05 AM10/14/19
to jenkinsc...@googlegroups.com
Change By: Daniel Beck
Status: In Review Resolved
Resolution: Fixed
Released As: matrix-auth-2.5
This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)
Atlassian logo
Reply all
Reply to author
Forward
0 new messages