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:ca.efendi.datafeeds.service.permission.CJProductPermission.java

License:Apache License

public static boolean contains(PermissionChecker permissionChecker, CJProduct entry, String actionId) {

    String portletId = PortletProviderUtil.getPortletId(CJProduct.class.getName(), PortletProvider.Action.EDIT);

    Boolean hasPermission = StagingPermissionUtil.hasPermission(permissionChecker, entry.getGroupId(),
            CJProduct.class.getName(), entry.getProductId(), portletId, actionId);

    if (hasPermission != null) {
        return hasPermission.booleanValue();
    }// w  w  w  . j ava 2 s.  co m

    if (entry.isDraft() || entry.isScheduled()) {
        if (actionId.equals(ActionKeys.VIEW) && !contains(permissionChecker, entry, ActionKeys.UPDATE)) {

            return false;
        }
    } else if (entry.isPending()) {
        hasPermission = WorkflowPermissionUtil.hasPermission(permissionChecker, entry.getGroupId(),
                CJProduct.class.getName(), entry.getProductId(), actionId);

        if (hasPermission != null) {
            return hasPermission.booleanValue();
        }
    }

    if (permissionChecker.hasOwnerPermission(entry.getCompanyId(), CJProduct.class.getName(),
            entry.getProductId(), entry.getUserId(), actionId)) {

        return true;
    }

    return permissionChecker.hasPermission(entry.getGroupId(), CJProduct.class.getName(), entry.getProductId(),
            actionId);
}

From source file:ca.efendi.datafeeds.web.asset.CJProductAssetRenderer.java

License:Apache License

@Override
public boolean hasEditPermission(PermissionChecker permissionChecker) {
    return CJProductPermission.contains(permissionChecker, _entry, ActionKeys.UPDATE);
}

From source file:ch.inofix.referencemanager.service.impl.BibliographyServiceImpl.java

License:Open Source License

/**
 * // ww  w.j a  v  a  2s . c  om
 * @param bibliographyId
 * @param userId
 * @param title
 * @paramet description
 * @param serviceContext
 * @return
 * @since 1.0.0
 * @throws PortalException
 */
public Bibliography updateBibliography(long bibliographyId, String title, String description, String urlTitle,
        String comments, String preamble, String strings, ServiceContext serviceContext)
        throws PortalException {

    BibliographyPermission.check(getPermissionChecker(), bibliographyId, ActionKeys.UPDATE);

    return bibliographyLocalService.updateBibliography(bibliographyId, getUserId(), title, description,
            urlTitle, comments, preamble, strings, serviceContext);
}

From source file:ch.inofix.referencemanager.service.impl.ReferenceServiceImpl.java

License:Open Source License

/**
 * //from www .jav a  2s.c om
 * @param referenceId
 * @param userId
 * @param bibTeX
 * @param serviceContext
 * @return
 * @since 1.0.0
 * @throws PortalException
 */
public Reference updateReference(long referenceId, String bibTeX, ServiceContext serviceContext)
        throws PortalException {

    ReferencePermission.check(getPermissionChecker(), referenceId, ActionKeys.UPDATE);

    return referenceLocalService.updateReference(referenceId, getUserId(), bibTeX, serviceContext);
}

From source file:ch.inofix.referencemanager.service.impl.ReferenceServiceImpl.java

License:Open Source License

/**
 * //from w w w  . j  ava 2s .  co m
 * @param referenceId
 * @param userId
 * @param bibTeX
 * @param bibliographyIds
 * @param serviceContext
 * @return
 * @since 1.0.8
 * @throws PortalException
 */
public Reference updateReference(long referenceId, String bibTeX, long[] bibliographyIds,
        ServiceContext serviceContext) throws PortalException {

    ReferencePermission.check(getPermissionChecker(), referenceId, ActionKeys.UPDATE);

    return referenceLocalService.updateReference(referenceId, getUserId(), bibTeX, bibliographyIds,
            serviceContext);
}

From source file:com.liferay.announcements.web.internal.portlet.configuration.icon.EditEntryPortletConfigurationIcon.java

License:Open Source License

@Override
public boolean isShow(PortletRequest portletRequest) {
    try {/*from  w  ww .ja va  2  s.  co m*/
        ThemeDisplay themeDisplay = (ThemeDisplay) portletRequest.getAttribute(WebKeys.THEME_DISPLAY);

        AnnouncementsEntry entry = ActionUtil.getEntry(portletRequest);

        return AnnouncementsEntryPermission.contains(themeDisplay.getPermissionChecker(), entry,
                ActionKeys.UPDATE);
    } catch (PortalException pe) {
        throw new RuntimeException(pe);
    }
}

From source file:com.liferay.asset.categories.admin.web.internal.portlet.configuration.icon.EditAssetCategoryPortletConfigurationIcon.java

License:Open Source License

@Override
public boolean isShow(PortletRequest portletRequest) {
    HttpServletRequest request = _portal.getHttpServletRequest(portletRequest);

    AssetCategoriesDisplayContext assetCategoriesDisplayContext = new AssetCategoriesDisplayContext(null, null,
            request);/* w ww .jav  a2s .  c om*/

    AssetCategory category = assetCategoriesDisplayContext.getCategory();

    if (Validator.isNull(category)) {
        return false;
    }

    try {
        return assetCategoriesDisplayContext.hasPermission(category, ActionKeys.UPDATE);
    } catch (PortalException pe) {
        if (_log.isDebugEnabled()) {
            _log.debug(pe, pe);
        }
    }

    return false;
}

From source file:com.liferay.asset.category.property.service.impl.AssetCategoryPropertyServiceImpl.java

License:Open Source License

@Override
public AssetCategoryProperty addCategoryProperty(long entryId, String key, String value)
        throws PortalException {

    AssetCategoryPermission.check(getPermissionChecker(), entryId, ActionKeys.UPDATE);

    return assetCategoryPropertyLocalService.addCategoryProperty(getUserId(), entryId, key, value);
}

From source file:com.liferay.asset.category.property.service.impl.AssetCategoryPropertyServiceImpl.java

License:Open Source License

@Override
public void deleteCategoryProperty(long categoryPropertyId) throws PortalException {

    AssetCategoryProperty assetCategoryProperty = assetCategoryPropertyLocalService
            .getAssetCategoryProperty(categoryPropertyId);

    AssetCategoryPermission.check(getPermissionChecker(), assetCategoryProperty.getCategoryId(),
            ActionKeys.UPDATE);

    assetCategoryPropertyLocalService.deleteCategoryProperty(categoryPropertyId);
}

From source file:com.liferay.asset.category.property.service.impl.AssetCategoryPropertyServiceImpl.java

License:Open Source License

@Override
public AssetCategoryProperty updateCategoryProperty(long userId, long categoryPropertyId, String key,
        String value) throws PortalException {

    AssetCategoryProperty assetCategoryProperty = assetCategoryPropertyLocalService
            .getAssetCategoryProperty(categoryPropertyId);

    AssetCategoryPermission.check(getPermissionChecker(), assetCategoryProperty.getCategoryId(),
            ActionKeys.UPDATE);

    return assetCategoryPropertyLocalService.updateCategoryProperty(userId, categoryPropertyId, key, value);
}