public long getHostGroupId() { return getLayout().getGroupId(); }
public Portlet getPortlet() { // Attempt to get the Portlet object from the "RENDER_PORTLET" request attribute. Portlet portlet = (Portlet) getPortletRequest().getAttribute(WebKeys.RENDER_PORTLET); // FACES-1212: If the request attribute was null, then this method is being called outside of the RENDER_PHASE // of the portlet lifecycle. In that case, use the cached version of the Portlet object from the "liferay" // ViewScoped managed-bean. if (portlet == null) { portlet = getLiferayManagedBean().getPortlet(); } return portlet; }
public String getDocumentLibraryURL() { return getPortalURL() + "/c/document_library"; }
public void checkUserPortletPermission(String actionId) throws AuthorizationException { try { if (!userHasPortletPermission(actionId)) { throw new AuthorizationException("User " + getUserId() + " not authorized to perform action " + actionId); } } catch (Exception e) { throw new AuthorizationException("Exception checking permissions for actionId " + actionId, e); } }
public Layout getLayout() { return getThemeDisplay().getLayout(); }
public ServiceContext getServiceContext() { ServiceContext serviceContext = new ServiceContext(); ThemeDisplay themeDisplay = getThemeDisplay(); serviceContext.setCompanyId(themeDisplay.getCompanyId()); serviceContext.setLanguageId(themeDisplay.getLanguageId()); serviceContext.setPathMain(PortalUtil.getPathMain()); serviceContext.setPlid(themeDisplay.getPlid()); serviceContext.setPortalURL(PortalUtil.getPortalURL(getPortletRequest())); serviceContext.setScopeGroupId(themeDisplay.getScopeGroupId()); serviceContext.setUserId(themeDisplay.getUserId()); try { serviceContext.setLayoutFullURL(PortalUtil.getLayoutFullURL(themeDisplay)); serviceContext.setLayoutURL(PortalUtil.getLayoutURL(themeDisplay)); serviceContext.setUserDisplayURL(themeDisplay.getUser().getDisplayURL(themeDisplay)); } catch (Exception e) { logger.error(e.getMessage(), e); } return serviceContext; }
public String getPortletRootId() { return getPortlet().getRootPortletId(); }
public ThemeDisplay getThemeDisplay() { ThemeDisplay themeDisplay = (ThemeDisplay) getPortletRequest().getAttribute(WebKeys.THEME_DISPLAY); return themeDisplay; }
public User getScopeGroupUser() { User groupUser = null; Group scopeGroup = getScopeGroup(); if (scopeGroup.isUser()) { try { groupUser = UserLocalServiceUtil.getUserById(scopeGroup.getClassPK()); } catch (Exception e) { logger.error(e.getMessage(), e); } } return groupUser; }
public List<Role> getUserRoles() throws SystemException { return RoleLocalServiceUtil.getUserRoles(getUserId()); }
public boolean userHasRole(String roleName) { try { List<Role> roles = getUserRoles(); for (Role role : roles) { if (role.getName().equals(roleName)) { return true; } } } catch (Exception e) { logger.error(e.getMessage(), e); } return false; }
public long getUserId() { return getUser().getUserId(); }
public long getPlid() { return getThemeDisplay().getPlid(); }
public void checkUserPortletPermission(String actionId) throws AuthorizationException { try { if (!userHasPortletPermission(actionId)) { throw new AuthorizationException("User " + getUserId() + " not authorized to perform action " + actionId); } } catch (Exception e) { throw new AuthorizationException("Exception checking permissions for actionId " + actionId, e); } }
public ServiceContext getServiceContext() { ServiceContext serviceContext = new ServiceContext(); ThemeDisplay themeDisplay = getThemeDisplay(); serviceContext.setCompanyId(themeDisplay.getCompanyId()); serviceContext.setLanguageId(themeDisplay.getLanguageId()); serviceContext.setPathMain(PortalUtil.getPathMain()); serviceContext.setPlid(themeDisplay.getPlid()); serviceContext.setPortalURL(PortalUtil.getPortalURL(getPortletRequest())); serviceContext.setScopeGroupId(themeDisplay.getScopeGroupId()); serviceContext.setUserId(themeDisplay.getUserId()); try { serviceContext.setLayoutFullURL(PortalUtil.getLayoutFullURL(themeDisplay)); serviceContext.setLayoutURL(PortalUtil.getLayoutURL(themeDisplay)); serviceContext.setUserDisplayURL(themeDisplay.getUser().getDisplayURL(themeDisplay)); } catch (Exception e) { logger.error(e.getMessage(), e); } return serviceContext; }
public String getPortletInstanceId() { return getPortlet().getPortletId(); }
public ThemeDisplay getThemeDisplay() { ThemeDisplay themeDisplay = (ThemeDisplay) getPortletRequest().getAttribute(WebKeys.THEME_DISPLAY); return themeDisplay; }
public User getScopeGroupUser() { User groupUser = null; Group scopeGroup = getScopeGroup(); if (scopeGroup.isUser()) { try { groupUser = UserLocalServiceUtil.getUserById(scopeGroup.getClassPK()); } catch (Exception e) { logger.error(e.getMessage(), e); } } return groupUser; }
public List<Role> getUserRoles() throws SystemException { return RoleLocalServiceUtil.getUserRoles(getUserId()); }
public boolean userHasRole(String roleName) { try { List<Role> roles = getUserRoles(); for (Role role : roles) { if (role.getName().equals(roleName)) { return true; } } } catch (Exception e) { logger.error(e.getMessage(), e); } return false; }