List of usage examples for com.liferay.portal.kernel.security.permission ActionKeys UPDATE
String UPDATE
To view the source code for com.liferay.portal.kernel.security.permission ActionKeys UPDATE.
Click Source Link
From source file:com.liferay.layout.admin.web.internal.control.menu.CustomizationSettingsProductNavigationControlMenuEntry.java
License:Open Source License
public boolean hasUpdateLayoutPermission(ThemeDisplay themeDisplay) throws PortalException { if (LayoutPermissionUtil.contains(themeDisplay.getPermissionChecker(), themeDisplay.getLayout(), ActionKeys.UPDATE)) { return true; }/* w w w. j a v a2 s .co m*/ return false; }
From source file:com.liferay.layout.admin.web.internal.control.menu.ToggleControlsProductNavigationControlMenuEntry.java
License:Open Source License
protected boolean hasUpdateLayoutPermission(ThemeDisplay themeDisplay) throws PortalException { return LayoutPermissionUtil.contains(themeDisplay.getPermissionChecker(), themeDisplay.getLayout(), ActionKeys.UPDATE); }
From source file:com.liferay.layout.admin.web.internal.display.context.LayoutsAdminDisplayContext.java
License:Open Source License
public boolean showConfigureAction(Layout layout) throws PortalException { return LayoutPermissionUtil.contains(_themeDisplay.getPermissionChecker(), layout, ActionKeys.UPDATE); }
From source file:com.liferay.layout.admin.web.internal.display.context.LayoutsAdminDisplayContext.java
License:Open Source License
public boolean showCopyApplicationsAction(Layout layout) throws PortalException { // Check if layout is incomplete LayoutRevision layoutRevision = LayoutStagingUtil.getLayoutRevision(layout); boolean incomplete = false; if (layoutRevision != null) { long layoutSetBranchId = layoutRevision.getLayoutSetBranchId(); incomplete = StagingUtil.isIncomplete(layout, layoutSetBranchId); }//from w w w .j a v a 2s . c o m if (incomplete) { return false; } // Check if layout is a layout prototype Group group = layout.getGroup(); if (group.isLayoutPrototype()) { return false; } return LayoutPermissionUtil.contains(_themeDisplay.getPermissionChecker(), layout, ActionKeys.UPDATE); }
From source file:com.liferay.layout.admin.web.internal.product.navigation.control.menu.InformationMessagesProductNavigationControlMenuEntry.java
License:Open Source License
protected boolean isLinkedLayout(ThemeDisplay themeDisplay) throws PortalException { Layout layout = themeDisplay.getLayout(); Group group = layout.getGroup(); if (!SitesUtil.isLayoutUpdateable(layout) || (layout.isLayoutPrototypeLinkActive() && !group.hasStagingGroup())) { if (!LayoutPermissionUtil.containsWithoutViewableGroup(themeDisplay.getPermissionChecker(), layout, false, ActionKeys.UPDATE)) { return false; }//from ww w.ja v a 2 s . c om return true; } return false; }
From source file:com.liferay.layout.internal.util.LayoutsTreeImpl.java
License:Open Source License
private JSONObject _toJSONObject(HttpServletRequest request, long groupId, LayoutTreeNodes layoutTreeNodes, LayoutSetBranch layoutSetBranch) throws Exception { if (_log.isDebugEnabled()) { StringBundler sb = new StringBundler(5); sb.append("_toJSON(groupId="); sb.append(groupId);/* w w w . j a v a 2 s . com*/ sb.append(", layoutTreeNodes="); sb.append(layoutTreeNodes); sb.append(StringPool.CLOSE_PARENTHESIS); _log.debug(sb.toString()); } ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY); JSONArray jsonArray = JSONFactoryUtil.createJSONArray(); boolean hasManageLayoutsPermission = GroupPermissionUtil.contains(themeDisplay.getPermissionChecker(), groupId, ActionKeys.MANAGE_LAYOUTS); boolean mobile = BrowserSnifferUtil.isMobile(request); for (LayoutTreeNode layoutTreeNode : layoutTreeNodes) { JSONObject jsonObject = JSONFactoryUtil.createJSONObject(); JSONObject childrenJSONObject = _toJSONObject(request, groupId, layoutTreeNode.getChildLayoutTreeNodes(), layoutSetBranch); jsonObject.put("children", childrenJSONObject); Layout layout = layoutTreeNode.getLayout(); jsonObject.put("contentDisplayPage", layout.isContentDisplayPage()); jsonObject.put("deleteable", _isDeleteable(layout, themeDisplay, layoutSetBranch)); jsonObject.put("friendlyURL", layout.getFriendlyURL()); if (layout instanceof VirtualLayout) { VirtualLayout virtualLayout = (VirtualLayout) layout; jsonObject.put("groupId", virtualLayout.getSourceGroupId()); } else { jsonObject.put("groupId", layout.getGroupId()); } jsonObject.put("hasChildren", layout.hasChildren()); jsonObject.put("layoutId", layout.getLayoutId()); jsonObject.put("name", layout.getName(themeDisplay.getLocale())); jsonObject.put("parentable", LayoutPermissionUtil.contains(themeDisplay.getPermissionChecker(), layout, ActionKeys.ADD_LAYOUT)); jsonObject.put("parentLayoutId", layout.getParentLayoutId()); jsonObject.put("plid", layout.getPlid()); jsonObject.put("priority", layout.getPriority()); jsonObject.put("privateLayout", layout.isPrivateLayout()); jsonObject.put("regularURL", layout.getRegularURL(request)); jsonObject.put("sortable", hasManageLayoutsPermission && !mobile && SitesUtil.isLayoutSortable(layout)); jsonObject.put("type", layout.getType()); jsonObject.put("updateable", LayoutPermissionUtil.contains(themeDisplay.getPermissionChecker(), layout, ActionKeys.UPDATE)); jsonObject.put("uuid", layout.getUuid()); LayoutRevision layoutRevision = LayoutStagingUtil.getLayoutRevision(layout); if (layoutRevision != null) { long layoutSetBranchId = layoutRevision.getLayoutSetBranchId(); if (_staging.isIncomplete(layout, layoutSetBranchId)) { jsonObject.put("incomplete", true); } LayoutSetBranch boundLayoutSetBranch = _layoutSetBranchLocalService .getLayoutSetBranch(layoutSetBranchId); LayoutBranch layoutBranch = layoutRevision.getLayoutBranch(); if (!layoutBranch.isMaster()) { jsonObject.put("layoutBranchId", layoutBranch.getLayoutBranchId()); jsonObject.put("layoutBranchName", layoutBranch.getName()); } if (layoutRevision.isHead()) { jsonObject.put("layoutRevisionHead", true); } jsonObject.put("layoutRevisionId", layoutRevision.getLayoutRevisionId()); jsonObject.put("layoutSetBranchId", layoutSetBranchId); jsonObject.put("layoutSetBranchName", boundLayoutSetBranch.getName()); } jsonArray.put(jsonObject); } JSONObject responseJSONObject = JSONFactoryUtil.createJSONObject(); responseJSONObject.put("layouts", jsonArray); responseJSONObject.put("total", layoutTreeNodes.getTotal()); return responseJSONObject; }
From source file:com.liferay.layout.page.template.service.impl.LayoutPageTemplateCollectionServiceImpl.java
License:Open Source License
@Override public LayoutPageTemplateCollection updateLayoutPageTemplateCollection(long layoutPageTemplateCollectionId, String name, String description) throws PortalException { _layoutPageTemplateCollectionModelResourcePermission.check(getPermissionChecker(), layoutPageTemplateCollectionId, ActionKeys.UPDATE); return layoutPageTemplateCollectionLocalService .updateLayoutPageTemplateCollection(layoutPageTemplateCollectionId, name, description); }
From source file:com.liferay.layout.page.template.service.impl.LayoutPageTemplateEntryServiceImpl.java
License:Open Source License
@Override public LayoutPageTemplateEntry updateLayoutPageTemplateEntry(long layoutPageTemplateEntryId, String name) throws PortalException { _layoutPageTemplateEntryModelResourcePermission.check(getPermissionChecker(), layoutPageTemplateEntryId, ActionKeys.UPDATE); return layoutPageTemplateEntryLocalService.updateLayoutPageTemplateEntry(layoutPageTemplateEntryId, name); }
From source file:com.liferay.layout.page.template.service.impl.LayoutPageTemplateEntryServiceImpl.java
License:Open Source License
@Override public LayoutPageTemplateEntry updateLayoutPageTemplateEntry(long layoutPageTemplateEntryId, String name, List<FragmentEntry> fragmentEntries, ServiceContext serviceContext) throws PortalException { _layoutPageTemplateEntryModelResourcePermission.check(getPermissionChecker(), layoutPageTemplateEntryId, ActionKeys.UPDATE); return layoutPageTemplateEntryLocalService.updateLayoutPageTemplateEntry(getUserId(), layoutPageTemplateEntryId, name, fragmentEntries, serviceContext); }
From source file:com.liferay.message.boards.internal.service.permission.MBMessagePermission.java
License:Open Source License
private boolean _contains(PermissionChecker permissionChecker, MBMessage message, String actionId) throws PortalException { if (_mbBanLocalService.hasBan(message.getGroupId(), permissionChecker.getUserId())) { return false; }//w w w. j a v a2 s . c o m String portletId = PortletProviderUtil.getPortletId(MBMessage.class.getName(), PortletProvider.Action.EDIT); Boolean hasPermission = _stagingPermission.hasPermission(permissionChecker, message.getGroupId(), MBMessage.class.getName(), message.getMessageId(), portletId, actionId); if (hasPermission != null) { return hasPermission.booleanValue(); } if (message.isDraft() || message.isScheduled()) { if (actionId.equals(ActionKeys.VIEW) && !_contains(permissionChecker, message, ActionKeys.UPDATE)) { return false; } } else if (message.isPending()) { hasPermission = WorkflowPermissionUtil.hasPermission(permissionChecker, message.getGroupId(), message.getWorkflowClassName(), message.getMessageId(), actionId); if (hasPermission != null) { return hasPermission.booleanValue(); } } if (actionId.equals(ActionKeys.VIEW) && PropsValues.PERMISSIONS_VIEW_DYNAMIC_INHERITANCE) { long categoryId = message.getCategoryId(); if ((categoryId == MBCategoryConstants.DEFAULT_PARENT_CATEGORY_ID) || (categoryId == MBCategoryConstants.DISCUSSION_CATEGORY_ID)) { if (!MBPermission.contains(permissionChecker, message.getGroupId(), actionId)) { return false; } } else { try { MBCategory category = _mbCategoryLocalService.getCategory(categoryId); if (!MBCategoryPermission.contains(permissionChecker, category, actionId)) { return false; } } catch (NoSuchCategoryException nsce) { if (!message.isInTrash()) { throw nsce; } } } } if (permissionChecker.hasOwnerPermission(message.getCompanyId(), MBMessage.class.getName(), message.getRootMessageId(), message.getUserId(), actionId)) { return true; } if (!permissionChecker.hasPermission(message.getGroupId(), MBMessage.class.getName(), message.getMessageId(), actionId)) { return false; } if (message.isRoot() || !actionId.equals(ActionKeys.VIEW)) { return true; } return _contains(permissionChecker, _mbMessageLocalService.getMessage(message.getParentMessageId()), actionId); }