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

If a user has been deleted, clicking on their name in an uploaded Documents and Media file results in a com.liferay.portal.kernel.exception.NoSuchUserException



      If a user has been deactivated and deleted from Liferay, their uploaded assets in Documents and Media will remain. The problem is that if we go to the Documents and Media asset, their full name is displayed as a link. If the user existed and was active, clicking on this link would take us to their public profile. But, if a user is deleted, while no visual changes happen on the UI, an exception is thrown.

      It looks like the root of this issue is traced to the deleted user having a blank href tag. If you check the screenshot, you will notice the code appears as <a href>Test User</a> == $0

      Steps to Reproduce
      1. Start up 7.0 DE DXP + DE-4 fix pack
      2. Sign is as [email protected]
      3. Create a new user in Control Panel, and grant Admin role
      4. Create a new site
      5. Add a public page
      6. Add Documents and Media portlet to the layout
      7. Add the new user to a site
      8. Open another browser/private browsing mode window, and sign in as the new user
      9. As the new user, upload a file to Documents and Media in the new site created in step 4
      10. In the browser with [email protected], deactivate, then delete the new user
      11. As [email protected], access the file uploaded in step 9
      12. Click the hyperlink of the user's name in the Documents and Media info page

      Expected Result
      The hyperlink should be disabled after the user's deletion. I would also expect that if a user has been DISABLED, the link should be disabled as well, as I get a server error page.

      If you look at Blog portlet, you will notice in the comments section that disabled users have the hyperlink removed from their name. I feel that this should be consistent across Liferay components.

      Actual Result
      Clicking the hyperlink results in the following exception:

      00:34:02,656 ERROR [http-nio-12080-exec-8][IncludeTag:128] Current URL /web/z/test/-/document_library/Sw4tpJqJNaWR/view_file/46884?_com_liferay_document_library_web_portlet_DLPortlet_INSTANCE_Sw4tpJqJNaWR_redirect=http%3A%2F%2Flocalhost%3A12080%2Fweb%2Fz%2Ftest%3Fp_p_id%3Dcom_liferay_document_library_web_portlet_DLPortlet_INSTANCE_Sw4tpJqJNaWR%26p_p_lifecycle%3D0%26p_p_state%3Dnormal%26p_p_mode%3Dview%26p_p_col_id%3Dcolumn-1%26p_p_col_count%3D1 generates exception: com.liferay.portal.kernel.exception.NoSuchUserException: No User exists with the primary key 45150
      com.liferay.portal.kernel.exception.NoSuchUserException: No User exists with the primary key 45150
      	at com.liferay.portal.service.persistence.impl.UserPersistenceImpl.findByPrimaryKey(UserPersistenceImpl.java:8193)
      	at com.liferay.portal.service.persistence.impl.UserPersistenceImpl.findByPrimaryKey(UserPersistenceImpl.java:8209)
      	at com.liferay.portlet.messageboards.service.impl.MBMessageLocalServiceImpl.addMessage(MBMessageLocalServiceImpl.java:248)
      	at com.liferay.portlet.messageboards.service.impl.MBMessageLocalServiceImpl.addDiscussionMessage(MBMessageLocalServiceImpl.java:212)
      	at com.liferay.portlet.messageboards.service.impl.MBMessageLocalServiceImpl.getDiscussionMessageDisplay(MBMessageLocalServiceImpl.java:1010)
      	at com.liferay.portal.kernel.bean.ClassLoaderBeanHandler.invoke(ClassLoaderBeanHandler.java:67)
      	at com.liferay.message.boards.kernel.service.MBMessageLocalServiceWrapper.getDiscussionMessageDisplay(MBMessageLocalServiceWrapper.java:359)
      	at com.liferay.portal.kernel.bean.ClassLoaderBeanHandler.invoke(ClassLoaderBeanHandler.java:67)
      	at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:153)
      	at com.liferay.portal.spring.transaction.DefaultTransactionExecutor.execute(DefaultTransactionExecutor.java:85)
      	at com.liferay.portal.spring.transaction.TransactionInterceptor.invoke(TransactionInterceptor.java:58)
      	at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:127)
      	at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:56)
      	at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:127)
      	at com.liferay.portal.spring.aop.ServiceBeanAopProxy.invoke(ServiceBeanAopProxy.java:173)
      	at com.liferay.message.boards.comment.internal.MBCommentManagerImpl.getDiscussion(MBCommentManagerImpl.java:194)
      	at com.liferay.portal.kernel.comment.CommentManagerUtil.getDiscussion(CommentManagerUtil.java:107)
      	at org.apache.jsp.html.taglib.ui.discussion.page_jsp._jspService(page_jsp.java:837)
      	at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)


        1. fix_70.png
          36 kB
          Melody Wu
        2. fix.png
          260 kB
          Melody Wu
        3. Screen Shot 2016-10-07 at 11.14.38.png
          196 kB
          Brian Suh



            melody.wu Melody Wu
            brian.suh Brian Suh
            Participants of an Issue:
            Recent user:
            Csaba Turcsan
            0 Vote for this issue
            3 Start watching this issue


              Days since last comment:
              5 years, 34 weeks ago


                Version Package
                7.0.0 DXP FP8
                7.0.0 DXP SP2
                7.0.3 CE GA4