title: Getting user role in Java Portlets
body: <p>I'm working with liferay server to build a portal application using portlets. </p>
  
  <p>I want to display some user specific data on the website. </p>
  
  <p>How can I get the role of the logged in user in liferay portlet? </p>
  
  <p>my sample java code - </p>
  
  <pre><code>@Override
  public void processAction(ActionRequest request, ActionResponse response)
      throws PortletException, IOException {
    String data = ""; 
    if(userRole = "Admin") {    //How to get this user role? 
       data = "Admin user logged in";
    } else if(userRole = "Guest"){
       data = "Guest user logged in"; 
    }
    request.setAttribute("data", data);
  }
  </code></pre>
  
  <p>And JSP code - </p>
  
  <pre><code>&lt;script&gt;
      function WhoLoggedIn() {
          document.getElementById("gameForm").submit();
      }
  &lt;/script&gt;
  &lt;div onClick="WhoLoggedIn()"&gt;Click HERE&lt;/div&gt;
  &lt;div&gt;${data}&lt;/data&gt;
  </code></pre>
  
  <p>Thanks. </p>