Additional Blogs by Members
cancel
Showing results for 
Search instead for 
Did you mean: 
abdulbasit
Active Contributor
0 Kudos

If you are going to implement Multilingual External Facing Portal with identical contents in each language;
luckily you have Portal Content Translation. However, if you have different contents you cannot use
Portal Content Translation or swap language with direct links like "/irj/portal/anonymous?guest_user=english".


Lets assume we are going to publish in two languages English and Turkish.

Here is step by step solution :
Step 1 - Grant Anonymous Access to KM


Use following documentation to configure an anonymous access to KM.

How To configure an anonymous access to KM

Step 2 - Create Anonymous Users


    • Create two users in portal "english" and "turkish".

    • In Config Tool, Enter the user ID of the users in the UME property ume.login.guest_user.uniqueids separated by comma.

    • Restart servlet engine.


Now we have two anonymous users named turkish and english. We want to use user turkish to publish content in Turkish Language and user english to publish content in English Language. Users can access the portal in anonymous mode via following URLs:



    1. http::/irj/portal/anonymous?guest_user=turkish
    2. http::/irj/portal/anonymous?guest_user=english

Step 3 - Create Content for Anonymous Users



    1. Create two roles "Anonymous English Content" and "Anonymous Turkish Content".

    2. Assign user "english" to role "Anonymous English Content" and user "turkish" to role "Anonymous Turkish Content".

    3. Prepare your content and assign them to relevant roles.


Do not forget to set "Authentication Scheme" property of your IViews to anonymous.
Step 4 - Change Portal Desktop to "Light Desktop"



Go to System Administraton - Portal Display - Desktop & Display Rules and configure "Master Rule Collection" to use Light Desktop for group "Anonymous Users".



Now, we have two different anonymous pages with different URLs. However, when you want to go to English Page from Turkish Page you will see that it is not possible just by changing URL or via direct link from any content. Even you change URL, you will see that Portal do not logoff first anonymous user and log on to other anonymous user. Let's see how we can overcome this trouble.


Step 5 - Develop a Portal Component to swap Anonymous Users



    1. Create a new Portal Application Project "Change User"

    2. Create a servlet by extending "AbstractPortalComponent" class


    3. In doContent method write following code :


      String guest_user = request.getParameter("guest_user");
      String href="https://blogs.sap.com/irj/portal/anonymous?guest_user="+guest_user;
      response.write("
");
response.write("window.top.location.href=\""href"\"");
response.write("</script>");
</font>
</pre>
</li>
<li>In portalapp.xml create a component "ChangeUser" and add property "Authscheme" with value "Anonymous"</li>
<li>Deploy your par file to Portal</li>
</ul>
<p>Now, we have a component called ChangeUser and we can use this component to swap anonymous users in Portal. In Turkish Page use following link to swap to English Page :<br>
"/irj/servlet/prt/portal/prtroot/ChangeUser.ChangeUser?logout_submit=true&guest_user=english" <br>
and in English page use following link to swap to Turkish Page : <br>
"/irj/servlet/prt/portal/prtroot/ChangeUser.ChangeUser?logout_submit=true&guest_user=turkish"
</p>
<p>
Notice that there is a "logout_submit=true" in querystring which actually handle logoff job. I changed Masthead and add following lines to swap languages :
</p>
<pre>
<font size=2>
<% if (isAnonymous) { %>
<% if (componentRequest.getUser().getUniqueName().equals("english")) { %>
<TD nowrap >

Turkish </TD>
<% } else { %>
<TD nowrap >[English | /irj/servlet/prt/portal/prtroot/ChangeUser.ChangeUser?logout_submit=true&guest_user=english]</TD>
<% } %>
<% } %>

</font>
</pre>

6 Comments