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

FreeMarker theme page through invalid reference exception when user has only User role with all permission under My Account section revoked.

    Details

      Description

      Hi Customer reported the issue with freemarker theme.

      They have a freemarker theme deployed Freemarker theme in their environment on a page. A test user with only User role with all permission under My Account revoked, when the test user try to visit the page with freemark theme page, the system return error and also the page will not render.

      Reproduce Steps:

      1. Log in as Administrator.
      2. Revoke all the Permission Definition for User role in "My Account" section.
      3. Create a new user named "testuserqantas" (do not need manually assign User role to the user since it is done by default)
      4. Create a test page
      5. Deploy Freemarker theme for test page(Sunset Theme from Marketplace in this case)
      6. Log out Administrator account, and Log in with "testuserqantas" account.
      7. Click on the test page.

      Observed Behavior: When accessing the Freemarker theme page, the page will not render and console return with exception

      Error Log

      Aug 05, 2014 1:18:24 AM org.apache.catalina.core.ApplicationDispatcher invoke
      SEVERE: Servlet.service() for servlet jsp threw exception
      
      Expression theme_display.getURLMyAccount() is undefined on line 126, column 51 in _SERVLET_CONTEXT_/html/themes/_unstyle
      d/templates/init.ftl.
      The problematic instruction:
      ----------
      ==> assignment: my_account_url=htmlUtil.escape(theme_display.getURLMyAccount().toString()) [on line 126, column 9 in _SE
      RVLET_CONTEXT_/html/themes/_unstyled/templates/init.ftl]
       in include init [on line 3, column 1 in qantas-loyalty-theme_SERVLET_CONTEXT_/templates/portal_normal.ftl]
      ----------
      
      Java backtrace for programmers:
      ----------
      freemarker.core.InvalidReferenceException: Expression theme_display.getURLMyAccount() is undefined on line 126, column 5
      1 in _SERVLET_CONTEXT_/html/themes/_unstyled/templates/init.ftl.
              at freemarker.core.TemplateObject.assertNonNull(TemplateObject.java:125)
              at freemarker.core.TemplateObject.invalidTypeException(TemplateObject.java:135)
              at freemarker.core.Dot._getAsTemplateModel(Dot.java:78)
              at freemarker.core.Expression.getAsTemplateModel(Expression.java:89)
              at freemarker.core.MethodCall._getAsTemplateModel(MethodCall.java:86)
              at freemarker.core.Expression.getAsTemplateModel(Expression.java:89)
              at freemarker.core.ListLiteral.getModelList(ListLiteral.java:119)
              at freemarker.core.MethodCall._getAsTemplateModel(MethodCall.java:89)
              at freemarker.core.Expression.getAsTemplateModel(Expression.java:89)
              at freemarker.core.Assignment.accept(Assignment.java:90)
              at freemarker.core.Environment.visit(Environment.java:221)
              at freemarker.core.MixedContent.accept(MixedContent.java:92)
              at freemarker.core.Environment.visit(Environment.java:221)
              at freemarker.core.ConditionalBlock.accept(ConditionalBlock.java:79)
              at freemarker.core.Environment.visit(Environment.java:221)
              at freemarker.core.MixedContent.accept(MixedContent.java:92)
              at freemarker.core.Environment.visit(Environment.java:221)
              at freemarker.core.Environment.include(Environment.java:1508)
              at freemarker.core.Include.accept(Include.java:169)
              at freemarker.core.Environment.visit(Environment.java:221)
              at freemarker.core.MixedContent.accept(MixedContent.java:92)
              at freemarker.core.Environment.visit(Environment.java:221)
              at freemarker.core.Environment.process(Environment.java:199)
              at freemarker.template.Template.process(Template.java:237)
              at com.liferay.portal.freemarker.FreeMarkerTemplate.processTemplate(FreeMarkerTemplate.java:122)
              at com.liferay.portal.template.AbstractTemplate.processTemplate(AbstractTemplate.java:108)
              at com.liferay.taglib.util.ThemeUtil.doIncludeFTL(ThemeUtil.java:344)
              at com.liferay.taglib.util.ThemeUtil.doDispatch(ThemeUtil.java:169)

      I have tested in the branch and the issue persist. Below is the Branch Git ID:
      4def7ea38967881df5b355103b6100decc2eff23

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              felix.zhang Felix Zhang
              Reporter:
              dale.shan Dale Shan (Inactive)
              Participants of an Issue:
              Recent user:
              Esther Sanz
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Days since last comment:
                6 years, 37 weeks, 5 days ago

                  Packages

                  Version Package
                  6.2.2 CE GA3
                  6.2.X EE
                  7.0.0 M1