• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ActionKeys类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.liferay.portal.kernel.security.permission.ActionKeys的典型用法代码示例。如果您正苦于以下问题:Java ActionKeys类的具体用法?Java ActionKeys怎么用?Java ActionKeys使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ActionKeys类属于com.liferay.portal.kernel.security.permission包,在下文中一共展示了ActionKeys类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: setFolderPermissions

import com.liferay.portal.kernel.security.permission.ActionKeys; //导入依赖的package包/类
public static void setFolderPermissions(Folder folder) throws Exception{
	ResourcePermission resourcePermission = null;
	final Role guestMemberRole = RoleLocalServiceUtil.getRole(folder.getCompanyId(), RoleConstants.GUEST);
	final Role siteMemberRole = RoleLocalServiceUtil.getRole(folder.getCompanyId(), RoleConstants.SITE_MEMBER);
	ResourceAction resourceAction = ResourceActionLocalServiceUtil.getResourceAction(DLFolder.class.getName(), ActionKeys.VIEW);
	String[] actionIdsGuest = new String[] { ActionKeys.VIEW, ActionKeys.ACCESS };
	String[] actionIds = new String[] { ActionKeys.VIEW, ActionKeys.ACCESS, ActionKeys.SUBSCRIBE, ActionKeys.ADD_DOCUMENT, ActionKeys.UPDATE, ActionKeys.ADD_SHORTCUT, ActionKeys.ADD_SUBFOLDER, ActionKeys.PERMISSIONS, ActionKeys.DELETE };
	try{
		 ResourcePermissionLocalServiceUtil.setResourcePermissions(folder.getCompanyId(), 
				 DLFolder.class.getName(), ResourceConstants.SCOPE_INDIVIDUAL, 
				 String.valueOf(folder.getPrimaryKey()), guestMemberRole.getRoleId(), actionIdsGuest);
		 ResourcePermissionLocalServiceUtil.setResourcePermissions(folder.getCompanyId(), 
				 DLFolder.class.getName(), ResourceConstants.SCOPE_INDIVIDUAL, 
				 String.valueOf(folder.getPrimaryKey()), siteMemberRole.getRoleId(), actionIds);
	} catch (NoSuchResourcePermissionException e){
		resourcePermission = ResourcePermissionLocalServiceUtil
		.createResourcePermission(CounterLocalServiceUtil.increment());
		resourcePermission.setCompanyId(folder.getCompanyId());
		resourcePermission.setName(DLFolder.class.getName());
		resourcePermission.setScope(ResourceConstants.SCOPE_INDIVIDUAL);
		resourcePermission.setPrimKey(String.valueOf(folder.getPrimaryKey()));
		resourcePermission.setRoleId(guestMemberRole.getRoleId());
		resourcePermission.setActionIds(resourceAction.getBitwiseValue());// (ActionKeys.VIEW);
		ResourcePermissionLocalServiceUtil.addResourcePermission(resourcePermission);
	}
}
 
开发者ID:VietOpenCPS,项目名称:opencps-v2,代码行数:27,代码来源:DocumentUtils.java


示例2: getRowCheckBox

import com.liferay.portal.kernel.security.permission.ActionKeys; //导入依赖的package包/类
@Override
public String getRowCheckBox(HttpServletRequest request, boolean checked, boolean disabled, String primaryKey) {

    long entryId = GetterUtil.getLong(primaryKey);

    TaskRecord entry = TaskRecordLocalServiceUtil.fetchTaskRecord(entryId);

    boolean showInput = false;

    String name = null;

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

        try {
            if (TaskRecordPermission.contains(_permissionChecker, entry, 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);
}
 
开发者ID:inofix,项目名称:ch-inofix-timetracker,代码行数:35,代码来源:EntriesChecker.java


示例3: getApplicationDisplayTemplates

import com.liferay.portal.kernel.security.permission.ActionKeys; //导入依赖的package包/类
/**
 * Returns the DL File Entry types templates
 *
 * @param permissionChecker The current context's permission checker
 * @param groupId The current site ID
 * @param classNameId The template's classNameId
 * @return A list of templates indexed by file entry types
 *
 * @throws PortalException If an error occurs while searching templates
 */
private Map<Group, List<DDMTemplate>> getApplicationDisplayTemplates(PermissionChecker permissionChecker, long groupId, long classNameId) throws PortalException {
    HashMap<Group, List<DDMTemplate>> adts = new HashMap<>();

    long[] currentGroupIds = this.portal.getCurrentAndAncestorSiteGroupIds(groupId);
    long userId = permissionChecker.getUserId();
    for(long currentGroupId : currentGroupIds) {
        List<DDMTemplate> groupTemplates = this.ddmTemplateService.getTemplates(currentGroupId, classNameId)
            .stream()
            .filter(template -> {
                // See DDMTemplatePermission.java in Liferay's source code for the inspirational stuff
                String modelResourceName = DDMTemplate.class.getName();
                long companyId = template.getCompanyId();
                long templateId = template.getTemplateId();
                String actionKey = ActionKeys.VIEW;

                return (
                    permissionChecker.hasOwnerPermission(companyId, modelResourceName, templateId, userId, actionKey) ||
                    permissionChecker.hasPermission(companyId, modelResourceName, templateId, actionKey)
                );
            })
            .collect(Collectors.toList());

        // If we have templates to show, put it in the map
        if(!groupTemplates.isEmpty()) {
            Group group = this.groupService.getGroup(currentGroupId);
            adts.put(group, groupTemplates);
        }
    }

    return adts;
}
 
开发者ID:savoirfairelinux,项目名称:flashlight-search,代码行数:42,代码来源:FlashlightSearchServiceImpl.java


示例4: getRowCheckBox

import com.liferay.portal.kernel.security.permission.ActionKeys; //导入依赖的package包/类
@Override
public String getRowCheckBox(HttpServletRequest request, boolean checked, boolean disabled, String primaryKey) {

    long entryId = GetterUtil.getLong(primaryKey);

    Contact entry = ContactLocalServiceUtil.fetchContact(entryId);

    boolean showInput = false;

    String name = null;

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

        try {
            if (ContactPermission.contains(_permissionChecker, entry, 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);
}
 
开发者ID:inofix,项目名称:ch-inofix-contact-manager,代码行数:35,代码来源:EntriesChecker.java


示例5: setFilePermissions

import com.liferay.portal.kernel.security.permission.ActionKeys; //导入依赖的package包/类
public static void setFilePermissions(FileEntry fileEntry) throws Exception{
		ResourcePermission resourcePermission = null;
		final Role guestMemberRole = RoleLocalServiceUtil.getRole(fileEntry.getCompanyId(), RoleConstants.GUEST);
		ResourceAction resourceAction = ResourceActionLocalServiceUtil.getResourceAction(DLFileEntry.class.getName(), ActionKeys.VIEW);
		String[] actionIdsGuest = new String[] { ActionKeys.VIEW, ActionKeys.ACCESS };
		try{
			resourcePermission = ResourcePermissionLocalServiceUtil.getResourcePermission(fileEntry.getCompanyId(),
					DLFileEntry.class.getName(), ResourceConstants.SCOPE_INDIVIDUAL, String.valueOf(fileEntry
							.getPrimaryKey()), guestMemberRole.getRoleId());

			ResourcePermissionLocalServiceUtil.setResourcePermissions(fileEntry.getCompanyId(), 
					DLFileEntry.class.getName(), ResourceConstants.SCOPE_INDIVIDUAL, 
					 String.valueOf(fileEntry.getPrimaryKey()), guestMemberRole.getRoleId(), actionIdsGuest);
			
//			if (Validator.isNotNull(resourcePermission)){
//				resourcePermission.setActionIds(resourceAction.getBitwiseValue());
//				ResourcePermissionLocalServiceUtil.updateResourcePermission(resourcePermission);
//			}
		} catch (NoSuchResourcePermissionException e){
			resourcePermission = ResourcePermissionLocalServiceUtil
			.createResourcePermission(CounterLocalServiceUtil.increment());
			resourcePermission.setCompanyId(fileEntry.getCompanyId());
			resourcePermission.setName(DLFileEntry.class.getName());
			resourcePermission.setScope(ResourceConstants.SCOPE_INDIVIDUAL);
			resourcePermission.setPrimKey(String.valueOf(fileEntry.getPrimaryKey()));
			resourcePermission.setRoleId(guestMemberRole.getRoleId());
			resourcePermission.setActionIds(resourceAction.getBitwiseValue());// (ActionKeys.VIEW);
			ResourcePermissionLocalServiceUtil.addResourcePermission(resourcePermission);
		}
	}
 
开发者ID:VietOpenCPS,项目名称:opencps-v2,代码行数:31,代码来源:DocumentUtils.java


示例6: getRowCheckBox

import com.liferay.portal.kernel.security.permission.ActionKeys; //导入依赖的package包/类
@Override
public String getRowCheckBox(HttpServletRequest request, boolean checked, boolean disabled, String primaryKey) {

    long entryId = GetterUtil.getLong(primaryKey);

    Measurement entry = MeasurementLocalServiceUtil.fetchMeasurement(entryId);

    boolean showInput = false;

    String name = null;

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

        try {
            if (MeasurementPermission.contains(_permissionChecker, entry, 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);
}
 
开发者ID:inofix,项目名称:ch-inofix-data-manager,代码行数:35,代码来源:EntriesChecker.java


示例7: hasViewPermission

import com.liferay.portal.kernel.security.permission.ActionKeys; //导入依赖的package包/类
@Override
public boolean hasViewPermission(PermissionChecker permissionChecker) {

    return TaskRecordPermission.contains(permissionChecker, _taskRecord, ActionKeys.VIEW);
}
 
开发者ID:inofix,项目名称:ch-inofix-timetracker,代码行数:6,代码来源:TaskRecordAssetRenderer.java


示例8: hasPermission

import com.liferay.portal.kernel.security.permission.ActionKeys; //导入依赖的package包/类
@Override
public boolean hasPermission(PermissionChecker permissionChecker, String entryClassName, long entryClassPK,
        String actionId) throws Exception {
    return TaskRecordPermission.contains(permissionChecker, entryClassPK, ActionKeys.VIEW);
}
 
开发者ID:inofix,项目名称:ch-inofix-timetracker,代码行数:6,代码来源:TaskRecordIndexer.java


示例9: hasViewPermission

import com.liferay.portal.kernel.security.permission.ActionKeys; //导入依赖的package包/类
@Override
public boolean hasViewPermission(PermissionChecker permissionChecker) {

    return ContactPermission.contains(permissionChecker, _contact, ActionKeys.VIEW);
}
 
开发者ID:inofix,项目名称:ch-inofix-contact-manager,代码行数:6,代码来源:ContactAssetRenderer.java


示例10: hasPermission

import com.liferay.portal.kernel.security.permission.ActionKeys; //导入依赖的package包/类
@Override
public boolean hasPermission(PermissionChecker permissionChecker, String entryClassName, long entryClassPK,
        String actionId) throws Exception {

    return ContactPermission.contains(permissionChecker, entryClassPK, ActionKeys.VIEW);
}
 
开发者ID:inofix,项目名称:ch-inofix-contact-manager,代码行数:7,代码来源:ContactIndexer.java


示例11: setFilePermissions

import com.liferay.portal.kernel.security.permission.ActionKeys; //导入依赖的package包/类
public static void setFilePermissions(FileEntry fileEntry)
	throws Exception {

	ResourcePermission resourcePermission = null;
	final Role guestMemberRole = RoleLocalServiceUtil.getRole(
		fileEntry.getCompanyId(), RoleConstants.GUEST);
	ResourceAction resourceAction =
		ResourceActionLocalServiceUtil.getResourceAction(
			DLFileEntry.class.getName(), ActionKeys.VIEW);
	String[] actionIdsGuest = new String[] {
		ActionKeys.VIEW, ActionKeys.ACCESS
	};
	try {
		resourcePermission =
			ResourcePermissionLocalServiceUtil.getResourcePermission(
				fileEntry.getCompanyId(), DLFileEntry.class.getName(),
				ResourceConstants.SCOPE_INDIVIDUAL,
				String.valueOf(fileEntry.getPrimaryKey()),
				guestMemberRole.getRoleId());

		ResourcePermissionLocalServiceUtil.setResourcePermissions(
			fileEntry.getCompanyId(), DLFileEntry.class.getName(),
			ResourceConstants.SCOPE_INDIVIDUAL,
			String.valueOf(fileEntry.getPrimaryKey()),
			guestMemberRole.getRoleId(), actionIdsGuest);

		// if (Validator.isNotNull(resourcePermission)){
		// resourcePermission.setActionIds(resourceAction.getBitwiseValue());
		// ResourcePermissionLocalServiceUtil.updateResourcePermission(resourcePermission);
		// }
	}
	catch (NoSuchResourcePermissionException e) {
		resourcePermission =
			ResourcePermissionLocalServiceUtil.createResourcePermission(
				CounterLocalServiceUtil.increment());
		resourcePermission.setCompanyId(fileEntry.getCompanyId());
		resourcePermission.setName(DLFileEntry.class.getName());
		resourcePermission.setScope(ResourceConstants.SCOPE_INDIVIDUAL);
		resourcePermission.setPrimKey(
			String.valueOf(fileEntry.getPrimaryKey()));
		resourcePermission.setRoleId(guestMemberRole.getRoleId());
		resourcePermission.setActionIds(resourceAction.getBitwiseValue());// (ActionKeys.VIEW);
		ResourcePermissionLocalServiceUtil.addResourcePermission(
			resourcePermission);
	}
}
 
开发者ID:VietOpenCPS,项目名称:opencps-v2,代码行数:47,代码来源:DLFolderUtil.java


示例12: setFolderPermissions

import com.liferay.portal.kernel.security.permission.ActionKeys; //导入依赖的package包/类
public static void setFolderPermissions(Folder folder)
	throws Exception {

	ResourcePermission resourcePermission = null;
	final Role guestMemberRole = RoleLocalServiceUtil.getRole(
		folder.getCompanyId(), RoleConstants.GUEST);
	final Role siteMemberRole = RoleLocalServiceUtil.getRole(
		folder.getCompanyId(), RoleConstants.SITE_MEMBER);
	ResourceAction resourceAction =
		ResourceActionLocalServiceUtil.getResourceAction(
			DLFolder.class.getName(), ActionKeys.VIEW);
	String[] actionIdsGuest = new String[] {
		ActionKeys.VIEW, ActionKeys.ACCESS
	};
	String[] actionIds = new String[] {
		ActionKeys.VIEW, ActionKeys.ACCESS, ActionKeys.SUBSCRIBE,
		ActionKeys.ADD_DOCUMENT, ActionKeys.UPDATE, ActionKeys.ADD_SHORTCUT,
		ActionKeys.ADD_SUBFOLDER, ActionKeys.PERMISSIONS, ActionKeys.DELETE
	};
	try {
		ResourcePermissionLocalServiceUtil.setResourcePermissions(
			folder.getCompanyId(), DLFolder.class.getName(),
			ResourceConstants.SCOPE_INDIVIDUAL,
			String.valueOf(folder.getPrimaryKey()),
			guestMemberRole.getRoleId(), actionIdsGuest);
		ResourcePermissionLocalServiceUtil.setResourcePermissions(
			folder.getCompanyId(), DLFolder.class.getName(),
			ResourceConstants.SCOPE_INDIVIDUAL,
			String.valueOf(folder.getPrimaryKey()),
			siteMemberRole.getRoleId(), actionIds);
	}
	catch (NoSuchResourcePermissionException e) {
		resourcePermission =
			ResourcePermissionLocalServiceUtil.createResourcePermission(
				CounterLocalServiceUtil.increment());
		resourcePermission.setCompanyId(folder.getCompanyId());
		resourcePermission.setName(DLFolder.class.getName());
		resourcePermission.setScope(ResourceConstants.SCOPE_INDIVIDUAL);
		resourcePermission.setPrimKey(
			String.valueOf(folder.getPrimaryKey()));
		resourcePermission.setRoleId(guestMemberRole.getRoleId());
		resourcePermission.setActionIds(resourceAction.getBitwiseValue());// (ActionKeys.VIEW);
		ResourcePermissionLocalServiceUtil.addResourcePermission(
			resourcePermission);
	}
}
 
开发者ID:VietOpenCPS,项目名称:opencps-v2,代码行数:47,代码来源:DLFolderUtil.java


示例13: hasViewPermission

import com.liferay.portal.kernel.security.permission.ActionKeys; //导入依赖的package包/类
@Override
public boolean hasViewPermission(PermissionChecker permissionChecker) {

    return MeasurementPermission.contains(permissionChecker, _measurement, ActionKeys.VIEW);
}
 
开发者ID:inofix,项目名称:ch-inofix-data-manager,代码行数:6,代码来源:MeasurementAssetRenderer.java


示例14: getPermissionsActionId

import com.liferay.portal.kernel.security.permission.ActionKeys; //导入依赖的package包/类
protected String getPermissionsActionId(Data data) {
	return ActionKeys.VIEW;
}
 
开发者ID:jorgediaz-lr,项目名称:index-checker,代码行数:4,代码来源:IndexCheckerPermissionsHelper.java



注:本文中的com.liferay.portal.kernel.security.permission.ActionKeys类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java TypeInfo类代码示例发布时间:2022-05-22
下一篇:
Java ZOrder类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap