Thursday, December 27, 2012

How to Identify that SignedIn User is having particualr Role or Not in Liferay

Here i am writing example code which is used to check that the signedIn User is having the Administrator Role or Not

<%@page import="com.liferay.portal.model.Role"% ><%@page import="com.liferay.portal.service.RoleLocalServiceUtil"%>
      long companyId = themeDisplay.getCompanyId();
       Role roleAdmin = RoleLocalServiceUtil.getRole(companyId, "Administrator");
    
      if(RoleLocalServiceUtil.hasUserRole(themeDisplay.getUserId(), roleAdmin.getRoleId())) {

       }

The Above Code is to check that the SignedIn User is having 'Administrator'  Role or Not

No comments:

Liferay DXP JNDI Data Source Cofiguration

 This Blog will help us to learn about the JNDI Data Source Configuration in Liferay DXP. We have tested this with Liferay 7.3 with Tomcat. ...