Uploaded image for project: 'Jackrabbit FileVault'
  1. Jackrabbit FileVault
  2. JCRVLT-98

Multivalued properties of users are saved as single valued properties

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.1.18
    • 3.1.24
    • Packaging
    • None

    Description

      Installing a package with an user that has a multivalue property with just one value causes the type of the property to be switched from String[] to String.

      Attachments

        1. JCRVLT-98.patch
          6 kB
          Marius Petria
        2. JCRVLT-98.test.patch
          4 kB
          Marius Petria
        3. test-mv-prop-user.zip
          6 kB
          Marius Petria

        Issue Links

          Activity

            mpetria Marius Petria added a comment -

            I attached the test-mv-prop-user.zip that illustrates the error. In the package serialization the mvprop appears as an array (mvprop="[first]") but the installed type is String.

            mpetria Marius Petria added a comment - I attached the test-mv-prop-user.zip that illustrates the error. In the package serialization the mvprop appears as an array (mvprop=" [first] ") but the installed type is String.
            mpetria Marius Petria added a comment -

            I attached also a test that fails for mv properties.

            mpetria Marius Petria added a comment - I attached also a test that fails for mv properties.
            mpetria Marius Petria added a comment - - edited

            I attached a patch that explicitly sets multiple flag for multiple valued properties in JcrSysViewTransformer. tripod can you please have a look at it?

            mpetria Marius Petria added a comment - - edited I attached a patch that explicitly sets multiple flag for multiple valued properties in JcrSysViewTransformer. tripod can you please have a look at it?

            thanks mpetria, the patch looks good.

            tripod Tobias Bocanegra added a comment - thanks mpetria , the patch looks good.

            I've tested and I can reproduce it too with the following test and a test package having a property mvProp = [foo] in the user's profile node:

            @Test
                public void installUserWithSingleValuedMVProp() throws Exception {
            
                    UserManager mgr = ((JackrabbitSession) admin).getUserManager();
                    assertNull("test-user-a must not exist", mgr.getAuthorizable(ID_TEST_USER_A));
            
                    User u = mgr.createUser(ID_TEST_USER_A, "nonce");
                    final String authPath = u.getPath();
            
                    // create test property and node
                    u.setProperty(NAME_USER_PROPERTY, admin.getValueFactory().createValue("initial"));
                    admin.getNode(u.getPath()).addNode(NAME_PROFILE_PRIVATE_NODE, NodeType.NT_UNSTRUCTURED);
            
                    admin.save();
            
                    JcrPackage pack = packMgr.upload(getStream("testpackages/test_user_a_mv.zip"), false);
                    assertNotNull(pack);
                    ImportOptions opts = getDefaultOptions();
                    pack.install(opts);
            
                    // check if user exists
                    User userA = (User) mgr.getAuthorizable(ID_TEST_USER_A);
                    assertNotNull(ID_TEST_USER_A + " must exist", userA);
            
                    Node profile = admin.getNode(userA.getPath() + "/profile");
                    assertTrue(profile.hasProperty("mvProp"));
                    assertTrue(profile.getProperty("mvProp").isMultiple());
            
                }
            
            teofili Tommaso Teofili added a comment - I've tested and I can reproduce it too with the following test and a test package having a property mvProp = [foo] in the user's profile node: @Test public void installUserWithSingleValuedMVProp() throws Exception { UserManager mgr = ((JackrabbitSession) admin).getUserManager(); assertNull( "test-user-a must not exist" , mgr.getAuthorizable(ID_TEST_USER_A)); User u = mgr.createUser(ID_TEST_USER_A, "nonce" ); final String authPath = u.getPath(); // create test property and node u.setProperty(NAME_USER_PROPERTY, admin.getValueFactory().createValue( "initial" )); admin.getNode(u.getPath()).addNode(NAME_PROFILE_PRIVATE_NODE, NodeType.NT_UNSTRUCTURED); admin.save(); JcrPackage pack = packMgr.upload(getStream( "testpackages/test_user_a_mv.zip" ), false ); assertNotNull(pack); ImportOptions opts = getDefaultOptions(); pack.install(opts); // check if user exists User userA = (User) mgr.getAuthorizable(ID_TEST_USER_A); assertNotNull(ID_TEST_USER_A + " must exist" , userA); Node profile = admin.getNode(userA.getPath() + "/profile" ); assertTrue(profile.hasProperty( "mvProp" )); assertTrue(profile.getProperty( "mvProp" ).isMultiple()); }
            mpetria Marius Petria added a comment -

            tripod do you think you have time to apply the patch and maybe start a release?

            mpetria Marius Petria added a comment - tripod do you think you have time to apply the patch and maybe start a release?

            fixed in r1705214

            tripod Tobias Bocanegra added a comment - fixed in r1705214

            People

              tripod Tobias Bocanegra
              mpetria Marius Petria
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: