Details

    • Fix Priority:
      3
    • Similar Issues:
      Show 5 results 

      Description

      When language portlet is included in the theme template by using any of $theme.language() methods, regular user can not change the language until administrator does it first in the page. This seems to be happening because permissions for language portlet in particular page are not yet set, and when it is used by regular user language change fails. When administrator changes locale for the first time in the page only then permissions for language portlet in that page are added, after that regular user can change the language as well.

      As a workaround $theme.runtime() method can be used to include language portlet in theme template. If $theme.runtime is used permissions for language portlet are set when page is loaded so regular user is able to change the language.

      Steps to reproduce:
      1. Include language portlet in the theme template using $theme.language();
      2. Create new page as administrator;
      3. Go to newly created page as regular user;
      4. Try to change language and it doesn't work.

        Activity

        Hide
        Miguel Angel Júlvez added a comment - - edited

        I confirm this issue in Liferay 6.2 m4 CE.

        Thanks Marius

        Show
        Miguel Angel Júlvez added a comment - - edited I confirm this issue in Liferay 6.2 m4 CE. Thanks Marius
        Hide
        Miguel Angel Júlvez added a comment -

        Community Verifier

        Show
        Miguel Angel Júlvez added a comment - Community Verifier
        Hide
        Edward Gonzales added a comment -

        Hello everyone! We are in the process of removing component "Theme" from LPS. Please make the necessary adjustments to affected your filters. Thanks!

        Show
        Edward Gonzales added a comment - Hello everyone! We are in the process of removing component "Theme" from LPS. Please make the necessary adjustments to affected your filters. Thanks!
        Hide
        Tibor Lipusz added a comment - - edited

        Here is the code snippet that blocks the language change in certain cases:

        LayoutAction#processPortletRequest
        //...
        				boolean access = PortletPermissionUtil.hasAccessPermission(
        					permissionChecker, scopeGroupId, ownerLayout, portlet,
        					portletMode);
        
        				if (access) {
        					invokerPortlet.processAction(
        						actionRequestImpl, actionResponseImpl);
        
        					actionResponseImpl.transferHeaders(response);
        				}
        

        "access" is true for the Admin, but false for a Site Member.

        Show
        Tibor Lipusz added a comment - - edited Here is the code snippet that blocks the language change in certain cases: LayoutAction#processPortletRequest //... boolean access = PortletPermissionUtil.hasAccessPermission( permissionChecker, scopeGroupId, ownerLayout, portlet, portletMode); if (access) { invokerPortlet.processAction( actionRequestImpl, actionResponseImpl); actionResponseImpl.transferHeaders(response); } "access" is true for the Admin, but false for a Site Member.
        Hide
        Tibor Lipusz added a comment -

        Just a slight addition: an HTTP request with method POST hits the portal in both cases, but for a non-admin user, the method #processAction in com.liferay.portlet.language.action.ViewAction will never be invoked.

        Show
        Tibor Lipusz added a comment - Just a slight addition: an HTTP request with method POST hits the portal in both cases, but for a non-admin user, the method #processAction in com.liferay.portlet.language.action.ViewAction will never be invoked.
        Hide
        Tibor Lipusz added a comment -

        Or, there is another workaround.

        Add the following element for the definition of Language Portlet (82) into $TOMCAT_HOME/webapps/ROOT/WEB-INF/liferay-portlet.xml:

        	<system>true</system>
        

        to look like this:

        	<portlet>
        		<portlet-name>82</portlet-name>
        		<icon>/html/icons/language.png</icon>
        		<struts-path>language</struts-path>
        		<configuration-action-class>com.liferay.portal.kernel.portlet.DefaultConfigurationAction</configuration-action-class>
        		<preferences-owned-by-group>true</preferences-owned-by-group>
        		<use-default-template>false</use-default-template>
        		<layout-cacheable>true</layout-cacheable>
        		<private-request-attributes>false</private-request-attributes>
        		<private-session-attributes>false</private-session-attributes>
        		<render-weight>50</render-weight>
        		<css-class-wrapper>portlet-language</css-class-wrapper>
        		<add-default-resource>true</add-default-resource>
        		<system>true</system>
        	</portlet>
        

        Let me refer to Ray's great blog about how to embed a portlet into a theme: https://www.liferay.com/web/raymond.auge/blog/-/blogs/embedding-portlets-in-themes-on-liferay.

        Show
        Tibor Lipusz added a comment - Or, there is another workaround. Add the following element for the definition of Language Portlet (82) into $TOMCAT_HOME/webapps/ROOT/WEB-INF/liferay-portlet.xml : <system> true </system> to look like this: <portlet> <portlet-name>82</portlet-name> <icon>/html/icons/language.png</icon> <struts-path>language</struts-path> <configuration-action-class>com.liferay.portal.kernel.portlet.DefaultConfigurationAction</configuration-action-class> <preferences-owned-by-group> true </preferences-owned-by-group> <use- default -template> false </use- default -template> <layout-cacheable> true </layout-cacheable> < private -request-attributes> false </ private -request-attributes> < private -session-attributes> false </ private -session-attributes> <render-weight>50</render-weight> <css-class-wrapper>portlet-language</css-class-wrapper> <add- default -resource> true </add- default -resource> <system> true </system> </portlet> Let me refer to Ray's great blog about how to embed a portlet into a theme: https://www.liferay.com/web/raymond.auge/blog/-/blogs/embedding-portlets-in-themes-on-liferay .

          People

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

            Dates

            • Created:
              Updated:
              Days since last comment:
              1 year, 28 weeks, 3 days ago

              Development

                Structure Helper Panel