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

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

Introduction

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

Prototype

String VIEW

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

Click Source Link

Usage

From source file:com.liferay.mobile.device.rules.service.impl.MDRRuleServiceImpl.java

License:Open Source License

@Override
public MDRRule fetchRule(long ruleId) throws PortalException {
    MDRRule rule = mdrRuleLocalService.fetchRule(ruleId);

    if (rule != null) {
        _mdrRuleGroupModelResourcePermission.check(getPermissionChecker(), rule.getRuleGroupId(),
                ActionKeys.VIEW);
    }/*from ww w.  j a v  a  2  s  . co  m*/

    return rule;
}

From source file:com.liferay.mobile.device.rules.service.impl.MDRRuleServiceImpl.java

License:Open Source License

@Override
public MDRRule getRule(long ruleId) throws PortalException {
    MDRRule rule = mdrRulePersistence.findByPrimaryKey(ruleId);

    _mdrRuleGroupModelResourcePermission.check(getPermissionChecker(), rule.getRuleGroupId(), ActionKeys.VIEW);

    return rule;/*from  ww  w . j a v a2  s  .co  m*/
}

From source file:com.liferay.roles.admin.web.internal.portlet.RolesAdminPortlet.java

License:Open Source License

protected void updateViewRootResourcePermission(Role role, long scopeGroupId, String portletId, int scope,
        String[] groupIds) throws Exception {

    String modelResource = ResourceActionsUtil.getPortletRootModelResource(portletId);

    if (modelResource != null) {
        List<String> actions = ResourceActionsUtil.getModelResourceActions(modelResource);

        if (actions.contains(ActionKeys.VIEW)) {
            updateAction(role, scopeGroupId, modelResource, ActionKeys.VIEW, true, scope, groupIds);
        }/*from   www  .j  av  a 2 s.c  o  m*/
    }
}

From source file:com.liferay.screens.service.impl.ScreensAssetEntryServiceImpl.java

License:Open Source License

@Override
public JSONObject getAssetEntry(long entryId, Locale locale) throws PortalException {

    AssetEntry entry = assetEntryLocalService.getEntry(entryId);

    AssetEntryPermission.check(getPermissionChecker(), entry, ActionKeys.VIEW);

    return toJSONObject(entry, locale);
}

From source file:com.liferay.screens.service.impl.ScreensAssetEntryServiceImpl.java

License:Open Source License

@Override
public JSONObject getAssetEntry(String className, long classPK, Locale locale) throws PortalException {

    AssetEntryPermission.check(getPermissionChecker(), className, classPK, ActionKeys.VIEW);

    return toJSONObject(assetEntryLocalService.getEntry(className, classPK), locale);
}

From source file:com.liferay.screens.service.impl.ScreensAssetEntryServiceImpl.java

License:Open Source License

protected List<AssetEntry> filterAssetEntries(List<AssetEntry> assetEntries) throws PortalException {

    List<AssetEntry> filteredAssetEntries = new ArrayList<>(assetEntries.size());

    for (AssetEntry assetEntry : assetEntries) {
        if (AssetEntryPermission.contains(getPermissionChecker(), assetEntry, ActionKeys.VIEW)) {

            filteredAssetEntries.add(assetEntry);
        }/*w w w .j  a v  a  2  s.  com*/
    }

    return filteredAssetEntries;
}

From source file:com.liferay.screens.service.impl.ScreensAssetEntryServiceImpl.java

License:Open Source License

protected JSONObject getJournalArticleJSONObject(AssetEntry assetEntry) throws PortalException {

    JournalArticle journalArticle = null;

    JournalArticlePermission.check(getPermissionChecker(), assetEntry.getClassPK(), ActionKeys.VIEW);

    try {/*from   w w  w.j  a va  2  s  . c  o m*/
        journalArticle = journalArticleLocalService.getArticle(assetEntry.getClassPK());
    } catch (Exception nsae) {
        JournalArticleResource journalArticleResource = journalArticleResourceLocalService
                .getArticleResource(assetEntry.getClassPK());

        journalArticle = journalArticleLocalService.getLatestArticle(journalArticleResource.getGroupId(),
                journalArticleResource.getArticleId());
    }

    JSONObject journalArticleJSONObject = JSONFactoryUtil.createJSONObject();

    journalArticleJSONObject.put("DDMStructure",
            JSONFactoryUtil.createJSONObject(JSONFactoryUtil.looseSerialize(journalArticle.getDDMStructure())));

    JSONObject jsonObject = JSONFactoryUtil.createJSONObject(JSONFactoryUtil.looseSerialize(journalArticle));

    journalArticleJSONObject.put("modelAttributes", jsonObject);
    journalArticleJSONObject.put("modelValues", jsonObject.getString("content"));

    jsonObject.remove("content");

    return journalArticleJSONObject;
}

From source file:com.liferay.screens.service.impl.ScreensDDLRecordServiceImpl.java

License:Open Source License

@Override
public JSONObject getDDLRecord(long ddlRecordId, Locale locale) throws PortalException {

    DDLRecord ddlRecord = ddlRecordLocalService.getRecord(ddlRecordId);

    _ddlRecordSetModelResourcePermission.check(getPermissionChecker(), ddlRecord.getRecordSetId(),
            ActionKeys.VIEW);

    DDMFormValues ddmFormValues = ddlRecord.getDDMFormValues();

    Set<Locale> availableLocales = ddmFormValues.getAvailableLocales();

    if ((locale == null) || !availableLocales.contains(locale)) {
        locale = ddmFormValues.getDefaultLocale();
    }//  w ww.  j  a v  a2  s .  c om

    return getDDLRecordJSONObject(ddlRecord, locale);
}

From source file:com.liferay.screens.service.impl.ScreensDDLRecordServiceImpl.java

License:Open Source License

@Override
public JSONArray getDDLRecords(long ddlRecordSetId, Locale locale, int start, int end,
        OrderByComparator<DDLRecord> obc) throws PortalException {

    _ddlRecordSetModelResourcePermission.check(getPermissionChecker(), ddlRecordSetId, ActionKeys.VIEW);

    List<DDLRecord> ddlRecords = ddlRecordLocalService.getRecords(ddlRecordSetId, start, end, obc);

    return getDDLRecordsJSONArray(ddlRecords, locale);
}

From source file:com.liferay.screens.service.impl.ScreensDDLRecordServiceImpl.java

License:Open Source License

@Override
public JSONArray getDDLRecords(long ddlRecordSetId, long userId, Locale locale, int start, int end,
        OrderByComparator<DDLRecord> obc) throws PortalException {

    _ddlRecordSetModelResourcePermission.check(getPermissionChecker(), ddlRecordSetId, ActionKeys.VIEW);

    List<DDLRecord> ddlRecords = ddlRecordLocalService.getRecords(ddlRecordSetId, userId, start, end, obc);

    return getDDLRecordsJSONArray(ddlRecords, locale);
}