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

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

Introduction

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

Prototype

String DELETE

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

Click Source Link

Usage

From source file:com.liferay.bookmarks.web.internal.portlet.configuration.icon.DeleteFolderPortletConfigurationIcon.java

License:Open Source License

@Override
public boolean isShow(PortletRequest portletRequest) {
    try {/*from w ww  .  j  a  v  a  2s .  com*/
        BookmarksFolder folder = ActionUtil.getFolder(portletRequest);

        if (folder == null) {
            return false;
        }

        ThemeDisplay themeDisplay = (ThemeDisplay) portletRequest.getAttribute(WebKeys.THEME_DISPLAY);

        if (BookmarksFolderPermissionChecker.contains(themeDisplay.getPermissionChecker(), folder,
                ActionKeys.DELETE)) {

            return true;
        }
    } catch (Exception e) {
    }

    return false;
}

From source file:com.liferay.bookmarks.web.internal.search.EntriesChecker.java

License:Open Source License

@Override
public String getRowCheckBox(HttpServletRequest request, boolean checked, boolean disabled, String primaryKey) {

    long entryId = GetterUtil.getLong(primaryKey);

    BookmarksEntry entry = BookmarksEntryLocalServiceUtil.fetchBookmarksEntry(entryId);

    BookmarksFolder folder = null;/*from  w  w  w  . j av a 2s .c  om*/

    if (entry == null) {
        folder = BookmarksFolderLocalServiceUtil.fetchBookmarksFolder(entryId);
    }

    boolean showInput = false;

    String name = null;

    if (entry != null) {
        name = BookmarksEntry.class.getSimpleName();

        try {
            if (BookmarksEntryPermissionChecker.contains(_permissionChecker, entry, ActionKeys.DELETE)) {

                showInput = true;
            }
        } catch (Exception e) {
        }
    } else if (folder != null) {
        name = BookmarksFolder.class.getSimpleName();

        try {
            if (BookmarksFolderPermissionChecker.contains(_permissionChecker, folder, ActionKeys.DELETE)) {

                showInput = true;
            }
        } catch (Exception e) {
        }
    }

    if (!showInput) {
        return StringPool.BLANK;
    }

    String checkBoxRowIds = getEntryRowIds();
    String checkBoxAllRowIds = "'#" + getAllRowIds() + "'";

    return getRowCheckBox(request, checked, disabled,
            _liferayPortletResponse.getNamespace() + RowChecker.ROW_IDS + name, primaryKey, checkBoxRowIds,
            checkBoxAllRowIds, StringPool.BLANK);
}

From source file:com.liferay.calendar.web.internal.asset.CalendarBookingAssetRendererFactory.java

License:Open Source License

@Override
public boolean hasPermission(PermissionChecker permissionChecker, long classPK, String actionId)
        throws Exception {

    CalendarBooking calendarBooking = _calendarBookingLocalService.getCalendarBooking(classPK);

    if (actionId.equals(ActionKeys.DELETE) || actionId.equals(ActionKeys.UPDATE)) {

        actionId = CalendarActionKeys.MANAGE_BOOKINGS;
    }/*  ww  w. jav a 2s  .com*/

    return CalendarPermission.contains(permissionChecker, calendarBooking.getCalendarId(), actionId);
}

From source file:com.liferay.document.library.repository.cmis.internal.model.CMISFolder.java

License:Open Source License

@Override
public boolean containsPermission(PermissionChecker permissionChecker, String actionId) {

    if (_cmisFolder.isRootFolder()
            && (actionId.equals(ActionKeys.DELETE) || actionId.equals(ActionKeys.UPDATE))) {

        try {//from ww  w.  jav a2  s .c om
            Folder folder = DLAppLocalServiceUtil.getMountFolder(getRepositoryId());

            DLFolder dlFolder = DLFolderLocalServiceUtil.getFolder(folder.getFolderId());

            return DLFolderPermission.contains(permissionChecker, dlFolder, actionId);
        } catch (PortalException pe) {
            throw new SystemException(pe);
        }
    } else {
        return containsPermission(_cmisFolder, actionId);
    }
}

From source file:com.liferay.document.library.web.asset.DLFileEntryAssetRenderer.java

License:Open Source License

public boolean hasDeletePermission(PermissionChecker permissionChecker) throws PortalException {

    return DLFileEntryPermission.contains(permissionChecker, _fileEntry.getFileEntryId(), ActionKeys.DELETE);
}

From source file:com.liferay.document.library.web.internal.display.context.logic.FileEntryDisplayContextHelper.java

License:Open Source License

public boolean hasDeletePermission() throws PortalException {
    if (_hasDeletePermission == null) {
        _hasDeletePermission = DLFileEntryPermission.contains(_permissionChecker, _fileEntry,
                ActionKeys.DELETE);
    }/*  ww w.ja  v a2s .  co  m*/

    return _hasDeletePermission;
}

From source file:com.liferay.document.library.web.internal.portlet.configuration.icon.DeleteFolderPortletConfigurationIcon.java

License:Open Source License

@Override
public boolean isShow(PortletRequest portletRequest) {
    ThemeDisplay themeDisplay = (ThemeDisplay) portletRequest.getAttribute(WebKeys.THEME_DISPLAY);

    try {//from w  w w .  ja  va  2s  .  c o m
        Folder folder = ActionUtil.getFolder(portletRequest);

        return DLFolderPermission.contains(themeDisplay.getPermissionChecker(), themeDisplay.getScopeGroupId(),
                folder.getFolderId(), ActionKeys.DELETE);
    } catch (PortalException pe) {
        throw new RuntimeException(pe);
    }
}

From source file:com.liferay.document.library.web.internal.search.EntriesChecker.java

License:Open Source License

@Override
public String getRowCheckBox(HttpServletRequest request, boolean checked, boolean disabled, String primaryKey) {

    FileEntry fileEntry = null;//  ww  w. j a  v a  2s .  c om
    FileShortcut fileShortcut = null;
    Folder folder = null;

    long entryId = GetterUtil.getLong(primaryKey);

    try {
        fileEntry = DLAppServiceUtil.getFileEntry(entryId);
    } catch (Exception e1) {
        if (e1 instanceof NoSuchFileEntryException || e1 instanceof NoSuchRepositoryEntryException) {

            try {
                fileShortcut = DLAppServiceUtil.getFileShortcut(entryId);
            } catch (Exception e2) {
                if (e2 instanceof NoSuchFileShortcutException) {
                    try {
                        folder = DLAppServiceUtil.getFolder(entryId);
                    } catch (Exception e3) {
                        return StringPool.BLANK;
                    }
                } else {
                    return StringPool.BLANK;
                }
            }
        } else {
            return StringPool.BLANK;
        }
    }

    boolean showInput = false;

    String name = null;

    if (fileEntry != null) {
        name = FileEntry.class.getSimpleName();

        try {
            if (DLFileEntryPermission.contains(_permissionChecker, fileEntry, ActionKeys.DELETE)
                    || DLFileEntryPermission.contains(_permissionChecker, fileEntry, ActionKeys.UPDATE)) {

                showInput = true;
            }
        } catch (Exception e) {
        }
    } else if (fileShortcut != null) {
        name = DLFileShortcut.class.getSimpleName();

        try {
            if (DLFileShortcutPermission.contains(_permissionChecker, fileShortcut, ActionKeys.DELETE)
                    || DLFileShortcutPermission.contains(_permissionChecker, fileShortcut, ActionKeys.UPDATE)) {

                showInput = true;
            }
        } catch (Exception e) {
        }
    } else if (folder != null) {
        name = Folder.class.getSimpleName();

        try {
            if (DLFolderPermission.contains(_permissionChecker, folder, ActionKeys.DELETE)
                    || DLFolderPermission.contains(_permissionChecker, folder, ActionKeys.UPDATE)) {

                showInput = true;
            }
        } catch (Exception e) {
        }
    }

    if (!showInput) {
        return StringPool.BLANK;
    }

    String checkBoxRowIds = getEntryRowIds();

    String checkBoxAllRowIds = "'#" + getAllRowIds() + "'";
    String checkBoxPostOnClick = _liferayPortletResponse.getNamespace() + "toggleActionsButton();";

    return getRowCheckBox(request, checked, disabled,
            _liferayPortletResponse.getNamespace() + RowChecker.ROW_IDS + name, primaryKey, checkBoxRowIds,
            checkBoxAllRowIds, checkBoxPostOnClick);
}

From source file:com.liferay.dynamic.data.lists.form.web.internal.display.context.DDLFormAdminDisplayContext.java

License:Open Source License

public boolean isShowDeleteRecordSetIcon(DDLRecordSet recordSet) {
    return DDLRecordSetPermission.contains(_ddlFormAdminRequestHelper.getPermissionChecker(), recordSet,
            ActionKeys.DELETE);
}

From source file:com.liferay.dynamic.data.lists.service.impl.DDLRecordServiceImpl.java

License:Open Source License

/**
 * Deletes the record and its resources.
 *
 * @param  recordId the primary key of the record to be deleted
 * @throws PortalException//from   w ww  . j a  va2s  .co  m
 */
@Override
public void deleteRecord(long recordId) throws PortalException {
    DDLRecord record = ddlRecordLocalService.getDDLRecord(recordId);

    DDLRecordPermission.check(getPermissionChecker(), record.getRecordId(), ActionKeys.DELETE);

    ddlRecordLocalService.deleteRecord(record);
}