Posts

Showing posts with the label themeDisplay

Checking weather the user has the role Organization Administrator.

Whenever we are creating the Organization we can assign the user to the Organization also we can assign the Organization role to the User. As of now we have 2 roles. 1.Organization Owner. 2. Organization Administrator. User who created the Organization will have the role "Organization Owner". But we need to manually assign the "Organization Administrator" to the user. In programmatically to check weather user has roles or not here is the code. ThemeDisplay  themeDisplay = (ThemeDisplay)actionRequest.getAttribute(WebKeys.THEME_DISPLAY); try {         Role role = RoleLocalServiceUtil.getRole(themeDisplay.getCompanyId(),RoleConstants.ORGANIZATION_ADMINISTRATOR);  //Get the Role List<UserGroupRole> userGroupList = UserGroupRoleLocalServiceUtil.getUserGroupRoles(themeDisplay.getUserId()); //Getting the Roles of the User for(UserGroupRole userGroupRole :userGroupList) { //Iterating the loop      if...

Creation of URL in class

Some times it may require you to create url in class. Its quite easy task to do , Here you follow as , ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest. getAttribute(WebKeys.THEME_DISPLAY); long plid = PortalUtil.getPlidFromPortletId(themeDisplay.getScopeGroupId(),<portlet-name>);          PortletURL portletURL = PortletURLFactoryUtil.create(actionRequest ,<portlet-name>, plid ,PortletRequest.RENDER_PHASE);          portletURL.setWindowState(LiferayWindowState.POP_UP);          portletURL.setPortletMode(LiferayPortletMode.VIEW);          portletURL.setProperty("portletName", <portlet-name>);          portletURL.setParameter("type", "add"); For Custom portlet name will be some thing as like this <name>_WAR_<name>