List of usage examples for com.liferay.portal.kernel.service.permission PortalPermissionUtil check
public static void check(PermissionChecker permissionChecker, String actionId) throws PrincipalException
From source file:com.liferay.users.admin.web.internal.portlet.MyOrganizationsPortlet.java
License:Open Source License
@Override protected void doDispatch(RenderRequest renderRequest, RenderResponse renderResponse) throws IOException, PortletException { String path = getPath(renderRequest, renderResponse); if (path.equals("/edit_organization.jsp")) { try {//w w w .j av a 2s .c o m long organizationId = ParamUtil.getLong(renderRequest, "organizationId"); if (organizationId == 0) { PortalPermissionUtil.check(PermissionThreadLocal.getPermissionChecker(), ActionKeys.ADD_ORGANIZATION); } } catch (PrincipalException pe) { if (_log.isDebugEnabled()) { _log.debug(pe, pe); } SessionErrors.add(renderRequest, pe.getClass()); path = "/error.jsp"; } include(path, renderRequest, renderResponse); } else { super.doDispatch(renderRequest, renderResponse); } }
From source file:eu.gerhards.liferay.services.angular.service.impl.AngularGroupServiceImpl.java
License:Open Source License
@Override public List<Group> getInstanceGroups(long companyId) throws PortalException { _log.info("Getting all groups for company id: " + String.valueOf(companyId)); _log.debug(" ... security check ..."); PortalPermissionUtil.check(getPermissionChecker(), AngularActionKeys.LIST_USER_GROUPS); _log.debug(" ... getting information ..."); int groupCount = GroupLocalServiceUtil.getCompanyGroupsCount(companyId); List<Group> instanceGroups = null; if (groupCount > 0) { instanceGroups = GroupLocalServiceUtil.getCompanyGroups(companyId, 0, groupCount - 1); }// w w w . j a v a 2s . c om return instanceGroups; }
From source file:eu.gerhards.liferay.services.angular.service.impl.AngularGroupServiceImpl.java
License:Open Source License
@Override public List<Group> getActiveGroups(long companyId) throws PortalException { _log.info("Getting all groups for company id: " + String.valueOf(companyId)); _log.debug(" ... security check ..."); PortalPermissionUtil.check(getPermissionChecker(), AngularActionKeys.LIST_USER_GROUPS); _log.debug(" ... getting information ..."); List<Group> activeGroup = GroupLocalServiceUtil.getActiveGroups(companyId, true); return activeGroup; }
From source file:eu.gerhards.liferay.services.angular.service.impl.AngularGroupServiceImpl.java
License:Open Source License
@Override public List<Group> getInactiveGroups(long companyId) throws PortalException { _log.info("Getting all groups for company id: " + String.valueOf(companyId)); _log.debug(" ... security check ..."); PortalPermissionUtil.check(getPermissionChecker(), AngularActionKeys.LIST_USER_GROUPS); _log.debug(" ... getting information ..."); List<Group> inactiveGroups = GroupLocalServiceUtil.getActiveGroups(companyId, false); return inactiveGroups; }
From source file:eu.gerhards.liferay.services.angular.service.impl.AngularGroupServiceImpl.java
License:Open Source License
@Override public Group createGroup(long parentGroupId, long liveGroupId, Map<Locale, String> nameMap, Map<Locale, String> descriptionMap, int type, boolean manualMembership, int membershipRestriction, String friendlyURL, boolean site, boolean inheritContent, boolean active) throws PortalException { _log.info("Creating new group ..."); _log.debug(" security check ..."); PortalPermissionUtil.check(getPermissionChecker(), ActionKeys.ADD_COMMUNITY); _log.debug(" ... processing ..."); User user = this.getGuestOrUser(); com.liferay.portal.kernel.service.ServiceContext serviceContext = new com.liferay.portal.kernel.service.ServiceContext(); serviceContext.setUserId(user.getUserId()); serviceContext.setCompanyId(user.getCompanyId()); return GroupLocalServiceUtil.addGroup(user.getUserId(), parentGroupId, null, 0L, liveGroupId, nameMap, descriptionMap, type, manualMembership, membershipRestriction, friendlyURL, site, inheritContent, active, serviceContext);//w ww .jav a 2 s. c o m }
From source file:eu.gerhards.liferay.services.angular.service.impl.AngularGroupServiceImpl.java
License:Open Source License
@Override public Group updateGroup(long groupId, long parentGroupId, long liveGroupId, Map<Locale, String> nameMap, Map<Locale, String> descriptionMap, int type, boolean manualMembership, int membershipRestriction, String friendlyURL, boolean site, boolean inheritContent, boolean active) throws PortalException { _log.info("Creating new group ..."); _log.debug(" security check ..."); PortalPermissionUtil.check(getPermissionChecker(), AngularActionKeys.UPDATE_COMMUNITY); _log.debug(" ... processing ..."); User user = this.getGuestOrUser(); com.liferay.portal.kernel.service.ServiceContext serviceContext = new com.liferay.portal.kernel.service.ServiceContext(); serviceContext.setUserId(user.getUserId()); serviceContext.setCompanyId(user.getCompanyId()); return GroupLocalServiceUtil.updateGroup(groupId, parentGroupId, nameMap, descriptionMap, type, manualMembership, membershipRestriction, friendlyURL, inheritContent, active, serviceContext); }
From source file:eu.gerhards.liferay.services.angular.service.impl.AngularGroupServiceImpl.java
License:Open Source License
@Override public void deleteGroup(long groupId) throws PortalException { _log.info("Creating new group ..."); _log.debug(" security check ..."); PortalPermissionUtil.check(getPermissionChecker(), AngularActionKeys.DELETE_COMMUNITY); _log.debug(" ... processing ..."); GroupLocalServiceUtil.deleteGroup(groupId); }
From source file:eu.gerhards.liferay.services.angular.service.impl.AngularLayoutServiceImpl.java
License:Open Source License
@Override public Layout getLayoutbyId(long layoutId) throws PortalException { _log.info("Getting layout with id " + layoutId); _log.debug(" ... security check ..."); PortalPermissionUtil.check(getPermissionChecker(), AngularActionKeys.LIST_LAYOUTS); _log.debug(" ... getting layout ..."); Layout layout = LayoutLocalServiceUtil.getLayout(layoutId); return layout; }
From source file:eu.gerhards.liferay.services.angular.service.impl.AngularLayoutServiceImpl.java
License:Open Source License
@Override public List<Layout> getLayouts(long groupId, boolean privateLayout) throws PortalException { _log.info("Getting layouts for group with id " + groupId); _log.debug(" ... security check ..."); PortalPermissionUtil.check(getPermissionChecker(), AngularActionKeys.LIST_LAYOUTS); _log.debug(" ... getting layouts ..."); java.util.List<com.liferay.portal.kernel.model.Layout> layouts = LayoutLocalServiceUtil.getLayouts(groupId, privateLayout);/* w ww .j a va 2 s .co m*/ return layouts; }
From source file:eu.gerhards.liferay.services.angular.service.impl.AngularLayoutServiceImpl.java
License:Open Source License
@Override public Layout createLayout(long groupId, boolean privateLayout, long parentLayoutId, Map<Locale, String> nameMap, Map<Locale, String> titleMap, Map<Locale, String> descriptionMap, Map<Locale, String> keywordsMap, Map<Locale, String> robotsMap, String type, String typeSettings, boolean hidden, Map<Locale, String> friendlyURLMap) throws PortalException { _log.info("Creating layout ... "); PortalPermissionUtil.check(getPermissionChecker(), ActionKeys.ADD_LAYOUT); _log.debug(" ... creating layout ..."); long userId = this.getGuestOrUserId(); com.liferay.portal.kernel.service.ServiceContext serviceContext = new com.liferay.portal.kernel.service.ServiceContext(); serviceContext.setUserId(this.getGuestOrUserId()); com.liferay.portal.kernel.model.Layout layout = LayoutLocalServiceUtil.addLayout(userId, groupId, privateLayout, parentLayoutId, nameMap, titleMap, descriptionMap, keywordsMap, robotsMap, type, typeSettings, hidden, friendlyURLMap, serviceContext); return layout; }