Example usage for com.liferay.portal.kernel.security.permission ActionKeys ADD_SHORTCUT

List of usage examples for com.liferay.portal.kernel.security.permission ActionKeys ADD_SHORTCUT

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.security.permission ActionKeys ADD_SHORTCUT.

Prototype

String ADD_SHORTCUT

To view the source code for com.liferay.portal.kernel.security.permission ActionKeys ADD_SHORTCUT.

Click Source Link

Usage

From source file:com.liferay.document.library.internal.trash.DLFileShortcutTrashHandler.java

License:Open Source License

@Override
public boolean hasTrashPermission(PermissionChecker permissionChecker, long groupId, long classPK,
        String trashActionId) throws PortalException {

    if (trashActionId.equals(TrashActionKeys.MOVE)) {
        return DLFolderPermission.contains(permissionChecker, groupId, classPK, ActionKeys.ADD_SHORTCUT);
    }//from www  . j  av  a 2  s .  c  o m

    return super.hasTrashPermission(permissionChecker, groupId, classPK, trashActionId);
}

From source file:com.liferay.document.library.web.internal.portlet.toolbar.contributor.DLPortletToolbarContributor.java

License:Open Source License

public URLMenuItem getPortletTitleAddShortcutMenuItem(Folder folder, ThemeDisplay themeDisplay,
        PortletRequest portletRequest) {

    if ((folder != null) && !folder.isSupportsShortcuts()) {
        return null;
    }/*w w w.j  a v  a2  s.  c  o m*/

    long folderId = _getFolderId(folder);

    if (!containsPermission(themeDisplay.getPermissionChecker(), themeDisplay.getScopeGroupId(), folderId,
            ActionKeys.ADD_SHORTCUT)) {

        return null;
    }

    URLMenuItem urlMenuItem = new URLMenuItem();

    urlMenuItem.setLabel(LanguageUtil.get(_portal.getHttpServletRequest(portletRequest), "shortcut"));

    PortletDisplay portletDisplay = themeDisplay.getPortletDisplay();

    PortletURL portletURL = PortletURLFactoryUtil.create(portletRequest, portletDisplay.getId(),
            PortletRequest.RENDER_PHASE);

    portletURL.setParameter("mvcRenderCommandName", "/document_library/edit_file_shortcut");
    portletURL.setParameter("redirect", _portal.getCurrentURL(portletRequest));
    portletURL.setParameter("repositoryId", String.valueOf(_getRepositoryId(themeDisplay, folder)));
    portletURL.setParameter("folderId", String.valueOf(folderId));

    urlMenuItem.setURL(portletURL.toString());

    return urlMenuItem;
}