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