List of usage examples for com.liferay.portal.kernel.security.permission ActionKeys DELETE
String DELETE
To view the source code for com.liferay.portal.kernel.security.permission ActionKeys DELETE.
Click Source Link
From source file:com.liferay.wiki.web.internal.portlet.configuration.icon.DeletePagePortletConfigurationIcon.java
License:Open Source License
@Override public boolean isShow(PortletRequest portletRequest) { ThemeDisplay themeDisplay = (ThemeDisplay) portletRequest.getAttribute(WebKeys.THEME_DISPLAY); try {/*w w w . j a v a2s . c o m*/ WikiPage page = ActionUtil.getPage(portletRequest); if (!page.isDraft() && WikiPagePermissionChecker.contains(themeDisplay.getPermissionChecker(), page.getNodeId(), HtmlUtil.unescape(page.getTitle()), ActionKeys.DELETE)) { return true; } else if (page.isDraft() && WikiPagePermissionChecker.contains(themeDisplay.getPermissionChecker(), page, ActionKeys.DELETE)) { return true; } } catch (Exception e) { } return false; }
From source file:com.liferay.wiki.web.internal.search.NodesChecker.java
License:Open Source License
@Override public String getRowCheckBox(HttpServletRequest request, boolean checked, boolean disabled, String primaryKey) { long nodeId = GetterUtil.getLong(primaryKey); WikiNode node = null;/*from ww w . j a va 2 s .co m*/ try { node = WikiNodeServiceUtil.getNode(nodeId); } catch (PortalException pe) { return StringPool.BLANK; } String name = WikiNode.class.getSimpleName(); boolean showInput = false; if (WikiNodePermissionChecker.contains(_permissionChecker, node, ActionKeys.DELETE)) { showInput = true; } if (!showInput) { return StringPool.BLANK; } StringBundler sb = new StringBundler(5); sb.append("['"); sb.append(_liferayPortletResponse.getNamespace()); sb.append(RowChecker.ROW_IDS); sb.append(WikiNode.class.getSimpleName()); sb.append("']"); String checkBoxRowIds = sb.toString(); return getRowCheckBox(request, checked, disabled, _liferayPortletResponse.getNamespace() + RowChecker.ROW_IDS + name + "", primaryKey, checkBoxRowIds, "'#" + getAllRowIds() + "'", StringPool.BLANK); }
From source file:com.liferay.wiki.web.internal.search.PagesChecker.java
License:Open Source License
@Override public String getRowCheckBox(HttpServletRequest request, boolean checked, boolean disabled, String primaryKey) { long pageId = GetterUtil.getLong(primaryKey); WikiPage page = null;/*w w w. ja v a2 s .c om*/ try { page = WikiPageLocalServiceUtil.getPageByPageId(pageId); } catch (PortalException pe) { return StringPool.BLANK; } String name = WikiPage.class.getSimpleName(); boolean showInput = false; if (WikiPagePermissionChecker.contains(_permissionChecker, page, ActionKeys.DELETE)) { showInput = true; } if (!showInput) { return StringPool.BLANK; } StringBundler sb = new StringBundler(5); sb.append("['"); sb.append(_liferayPortletResponse.getNamespace()); sb.append(RowChecker.ROW_IDS); sb.append(WikiPage.class.getSimpleName()); sb.append("']"); String checkBoxRowIds = sb.toString(); return getRowCheckBox(request, checked, disabled, _liferayPortletResponse.getNamespace() + RowChecker.ROW_IDS + name + "", page.getTitle(), checkBoxRowIds, "'#" + getAllRowIds() + "'", StringPool.BLANK); }
From source file:com.liferay.wiki.web.internal.trash.WikiPageTrashHandler.java
License:Open Source License
@Override public boolean hasTrashPermission(PermissionChecker permissionChecker, long groupId, long classPK, String trashActionId) throws PortalException { if (trashActionId.equals(TrashActionKeys.MOVE)) { WikiPage page = _wikiPageLocalService.fetchLatestPage(classPK, WorkflowConstants.STATUS_ANY, true); if (page != null) { _wikiPageModelResourcePermission.check(permissionChecker, page, ActionKeys.DELETE); classPK = page.getNodeId();/*w w w . j a v a 2s . c o m*/ } return _wikiNodeModelResourcePermission.contains(permissionChecker, classPK, ActionKeys.ADD_PAGE); } return super.hasTrashPermission(permissionChecker, groupId, classPK, trashActionId); }
From source file:eu.gerhards.liferay.services.angular.service.impl.AngularRoleServiceImpl.java
License:Open Source License
@Override public Role deleteRole(long roleId) throws PortalException { _log.info("Deleting role with id: " + String.valueOf(roleId)); _log.debug(" security check ..."); RolePermissionUtil.check(getPermissionChecker(), roleId, ActionKeys.DELETE); _log.debug(" deleting role ..."); return RoleLocalServiceUtil.deleteRole(roleId); }
From source file:eu.gerhards.liferay.services.angular.service.impl.AngularTeamServiceImpl.java
License:Open Source License
@Override public com.liferay.portal.kernel.model.Team deleteTeam(long teamId) throws PortalException { _log.info("Deleting team with id " + teamId); _log.debug(" ... security check ..."); this.checkPersonalPermission(AngularActionKeys.DELETE_TEAM); this.hasResourcePermission(teamId, ActionKeys.DELETE); _log.debug(" ... processing ..."); return TeamLocalServiceUtil.deleteTeam(teamId); }
From source file:eu.gerhards.liferay.services.angular.service.impl.AngularUserGroupServiceImpl.java
License:Open Source License
@Override public void deleteUserGroup(long userGroupId) throws PortalException { _log.info("Deleting user group with id " + userGroupId); _log.debug(" ... security check ... "); this.checkPersonalPermission(AngularActionKeys.DELETE_USER_GROUP); com.liferay.portal.kernel.model.UserGroup userGroup = UserGroupLocalServiceUtil.getUserGroup(userGroupId); this.crossCompanyCheck(userGroup.getCompanyId()); this.hasResourcePermission(userGroupId, ActionKeys.DELETE); _log.debug(" ... processing ... "); UserGroupLocalServiceUtil.deleteUserGroup(userGroupId); }
From source file:eu.gerhards.liferay.services.angular.service.impl.AngularUserGroupServiceImpl.java
License:Open Source License
@Override public void deleteUserGroups(long[] userGroupIds) throws PortalException { _log.info("Deleting user groups " + userGroupIds); _log.debug(" ... security check ... "); this.checkPersonalPermission(AngularActionKeys.DELETE_USER_GROUP); List<com.liferay.portal.kernel.model.UserGroup> userGroups = UserGroupLocalServiceUtil .getUserGroups(userGroupIds); for (com.liferay.portal.kernel.model.UserGroup userGroup : userGroups) { this.crossCompanyCheck(userGroup.getCompanyId()); this.hasResourcePermission(userGroup.getUserGroupId(), ActionKeys.DELETE); }//from ww w . j a v a 2 s.co m _log.debug(" ... processing ... "); for (com.liferay.portal.kernel.model.UserGroup userGroup : userGroups) { UserGroupLocalServiceUtil.deleteUserGroup(userGroup); } }
From source file:eu.gerhards.liferay.services.angular.service.impl.AngularUserServiceImpl.java
License:Open Source License
protected User deleteUser(User user, User existingUser) throws PortalException { _log.debug("Target user: " + existingUser.toString()); try {/* w ww . java 2 s.c o m*/ // Check if target user is not an omni admin or a company admin PermissionChecker deleteUserPermChecker = PermissionCheckerFactoryUtil.create(existingUser); if (deleteUserPermChecker != null && !deleteUserPermChecker.isOmniadmin() && !deleteUserPermChecker.isCompanyAdmin()) { ServicePermissionUtil.checkAllPersonalPermissions(user, ActionKeys.DELETE, existingUser.getCompanyId(), getPermissionChecker(), User.class.getName()); boolean workflowEnabled = WorkflowThreadLocal.isEnabled(); try { User deletedUser = UserLocalServiceUtil.deleteUser(existingUser); return deletedUser; } catch (PortalException e) { _log.error("Cannot delete user ... "); _log.error(e); throw e; } finally { WorkflowThreadLocal.setEnabled(workflowEnabled); } } else { _log.error("User is omni admin or company admin and cannot be deleted!"); throw new PortalException(); } } catch (Exception e) { throw new PortalException(e); } }