Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-30206

Document Library portlet shows wrong version author in detail of a document

    Details

    • Type: Bug
    • Status: Closed
    • Resolution: Fixed
    • Affects Version/s: 6.1.1 CE GA2, 6.1.20 EE GA2, 6.1.30 EE GA3
    • Fix Version/s: 6.2.0 CE B1
    • Component/s: DM
    • Environment:
      ee-6.1.x, SO 2.0 from ee-6.1.x

      Description

      Steps to reproduce:

      (1) Start portal with SO 2.0 deployed (so-hook is important); create one SO site (make sure that SO EE Hook is applied in this site as Application Adapter)
      (2) create two distinct users (userA, userB)
      (3) as userA, in the SO site, go to Documents page
      (4) create a document, publish it; you'll see initial version 1.0 uploaded by userA
      (5) adjust permissions in a such way, that userB can edit given document (as userA add "Update" permission on given document)
      (6) as userB, login to portal, browse to the SO site, find the document
      (7) as userB, checkout the document
      (8) as userB, edit the document, simply by uploading some updated version of the file
      (9) as userB, publish and check in document

      Result:
      When you browse to given document detail, you'll see (in Version History section) that userA created version 1.1, which is wrong.

      Expected result:
      UserB should be listed by version 1.1, not the original creator of document.

      Installed SO 2.0 is important, so-hook overrides "html/portlet/document_library/view_file_entry.jsp", which makes the issue visible in the UI (using it as Application Adapter). Default JSP lists versions in a table without user name for each version, so the issue is not visible.

      The issue is not in the JSP, but in the incorrect content of dlFileVersion.getUserName() (and also dlFileVersion.getUserId()). It's always equal to the original document creator. New version is created during DLFileEntryLocalServiceImpl.checkOutFileEntry() which calls addFileVersion() in the same class. Here the "versionUserId" and "versionUserName" is computed, based on fileEntry.versionUserId and fileEntry.versionUserName. Those contain always the original creator, so each new version gets again always the original creator as its author. I guess that checkOutFileEntry() should correctly update the fileEntry.versionUserId and fileEntry.versionUserName before it calls addFileVersion(). Or addFileVersion() should update the userName and userId the same way as statusByUserName and statusByUserId.

      As a hotfix, I've customized the JSP and as a value I use "dlFileVersion.getStatusByUserName()" which contains the correct user.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Days since last comment:
                  5 years, 43 weeks, 5 days ago