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

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

Introduction

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

Prototype

String UPDATE

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

Click Source Link

Usage

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

License:Open Source License

public boolean hasUpdatePermission() throws PortalException {
    if (_hasUpdatePermission == null) {
        _hasUpdatePermission = DLFileEntryPermission.contains(_permissionChecker, _fileEntry,
                ActionKeys.UPDATE);
    }//from  w  w w  . jav  a2  s  .c o  m

    return _hasUpdatePermission;
}

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

License:Open Source License

@Override
public boolean isShow(PortletRequest portletRequest) {
    try {/*from  ww w .j  av  a  2 s.co m*/
        long folderId = DLFolderConstants.DEFAULT_PARENT_FOLDER_ID;

        Folder folder = ActionUtil.getFolder(portletRequest);

        if (folder == null) {
            if (!WorkflowEngineManagerUtil.isDeployed()
                    || (WorkflowHandlerRegistryUtil.getWorkflowHandler(DLFileEntry.class.getName()) == null)) {

                return false;
            }
        } else {
            folderId = folder.getFolderId();
        }

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

        return DLFolderPermission.contains(themeDisplay.getPermissionChecker(), themeDisplay.getScopeGroupId(),
                folderId, ActionKeys.UPDATE);
    } catch (Exception e) {
    }

    return false;
}

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

License:Open Source License

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

    try {/*from  w  w w.j  a  va  2s .c  om*/
        Folder folder = ActionUtil.getFolder(portletRequest);

        if (DLFolderPermission.contains(themeDisplay.getPermissionChecker(), themeDisplay.getScopeGroupId(),
                folder.getFolderId(), ActionKeys.UPDATE) && !folder.isMountPoint()) {

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

    return false;
}

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;// w  ww.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 isShowEditRecordSetIcon(DDLRecordSet recordSet) {
    return DDLRecordSetPermission.contains(_ddlFormAdminRequestHelper.getPermissionChecker(), recordSet,
            ActionKeys.UPDATE);
}

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

License:Open Source License

/**
 * Disassociates the locale from the record.
 *
 * @param      recordId the primary key of the record
 * @param      locale the locale of the record values to be removed
 * @param      serviceContext the service context to be applied. This can
 *             set the record modified date.
 * @return     the affected record//from  w w w  . j a  v a2s . c o  m
 * @throws     PortalException
 * @deprecated As of 1.1.0, replaced by {@link #updateRecord(long, boolean,
 *             int, DDMFormValues, ServiceContext)}
 */
@Deprecated
@Override
public DDLRecord deleteRecordLocale(long recordId, Locale locale, ServiceContext serviceContext)
        throws PortalException {

    DDLRecord record = ddlRecordLocalService.getDDLRecord(recordId);

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

    return ddlRecordLocalService.deleteRecordLocale(recordId, locale, serviceContext);
}

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

License:Open Source License

/**
 * Reverts the record to a given version.
 *
 * @param  recordId the primary key of the record
 * @param  version the version to be reverted
 * @param  serviceContext the service context to be applied. This can set
 *         the record modified date.//from  www .j  av a 2s.co  m
 * @throws PortalException if a portal exception occurred
 */
@Override
public void revertRecord(long recordId, String version, ServiceContext serviceContext) throws PortalException {

    DDLRecord record = ddlRecordLocalService.getDDLRecord(recordId);

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

    ddlRecordLocalService.revertRecord(getGuestOrUserId(), recordId, version, serviceContext);
}

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

License:Open Source License

/**
 * Updates a record, replacing its display index and values.
 *
 * @param  recordId the primary key of the record
 * @param  majorVersion whether this update is a major change. A major
 *         change increments the record's major version number.
 * @param  displayIndex the index position in which the record is displayed
 *         in the spreadsheet view/* www  .  ja  va 2s . c o m*/
 * @param  ddmFormValues the record values. See <code>DDMFormValues</code>
 *         in the <code>dynamic.data.mapping.api</code> module.
 * @param  serviceContext the service context to be applied. This can set
 *         the record modified date.
 * @return the record
 * @throws PortalException if a portal exception occurred
 */
@Override
public DDLRecord updateRecord(long recordId, boolean majorVersion, int displayIndex,
        DDMFormValues ddmFormValues, ServiceContext serviceContext) throws PortalException {

    DDLRecord record = ddlRecordLocalService.getDDLRecord(recordId);

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

    return ddlRecordLocalService.updateRecord(getUserId(), recordId, majorVersion, displayIndex, ddmFormValues,
            serviceContext);
}

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

License:Open Source License

/**
 * Updates a record, replacing its display index and values.
 *
 * @param      recordId the primary key of the record
 * @param      majorVersion whether this update is a major change. Major
 *             changes causes the increment of the major version number.
 * @param      displayIndex the index position in which the record is
 *             displayed in the spreadsheet view
 * @param      fields the record values. See <code>Fields</code> in the
 *             <code>dynamic.data.mapping.api</code> module.
 * @param      mergeFields whether to merge the new fields with the existing
 *             ones; otherwise replace the existing fields
 * @param      serviceContext the service context to be applied. This can
 *             set the record modified date.
 * @return     the record//from w w  w  .j av a2  s .  c  o  m
 * @throws     PortalException if a portal exception occurred
 * @deprecated As of 1.1.0, replaced by {@link #updateRecord(long, boolean,
 *             int, DDMFormValues, ServiceContext)}
 */
@Deprecated
@Override
public DDLRecord updateRecord(long recordId, boolean majorVersion, int displayIndex, Fields fields,
        boolean mergeFields, ServiceContext serviceContext) throws PortalException {

    DDLRecord record = ddlRecordLocalService.getDDLRecord(recordId);

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

    return ddlRecordLocalService.updateRecord(getUserId(), recordId, majorVersion, displayIndex, fields,
            mergeFields, serviceContext);
}

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

License:Open Source License

/**
 * Updates a record, replacing its display index and values.
 *
 * @param      recordId the primary key of the record
 * @param      displayIndex the index position in which the record is
 *             displayed in the spreadsheet view
 * @param      fieldsMap the record values. The fieldsMap is a map of field
 *             names and its Serializable values.
 * @param      mergeFields whether to merge the new fields with the existing
 *             ones; otherwise replace the existing fields
 * @param      serviceContext the service context to be applied. This can
 *             set the record modified date.
 * @return     the record//from   w  ww .  j  av a 2s . c  om
 * @throws     PortalException if a portal exception occurred
 * @deprecated As of 1.1.0, replaced by {@link #updateRecord(long, boolean,
 *             int, DDMFormValues, ServiceContext)}
 */
@Deprecated
@Override
public DDLRecord updateRecord(long recordId, int displayIndex, Map<String, Serializable> fieldsMap,
        boolean mergeFields, ServiceContext serviceContext) throws PortalException {

    DDLRecord record = ddlRecordLocalService.getDDLRecord(recordId);

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

    return ddlRecordLocalService.updateRecord(getUserId(), recordId, displayIndex, fieldsMap, mergeFields,
            serviceContext);
}