当前位置: 首页>>代码示例>>Java>>正文


Java ActionKeys.SUBSCRIBE属性代码示例

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


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

示例1: setFolderPermissions

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,代码行数:26,代码来源:DocumentUtils.java

示例2: setFolderPermissions

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,代码行数:46,代码来源:DLFolderUtil.java


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