我想通过java类更改liferay中创建的DL文件夹的权限:让我们考虑foldername id" temp"
答案 0 :(得分:3)
您需要获取文件夹'temp':
Folder tempFolder = dlAppLocalService.getFolder(groupId, parentFolderId, "temp");
您必须为'tempFolder'资源设置permisssions。
例如,如果要将VIEW权限设置为GUEST角色:
Role guestRole = roleLocalService.getRole(companyId, RoleConstants.GUEST);
resourcePermissionLocalService.setResourcePermissions(companyId, DLFolder.class.getName(), ResourceConstants.SCOPE_INDIVIDUAL, String.valueOf(tempFolder.getFolderId()), guestRole.getRoleId(), new String[]{"VIEW"});
您可以在此处查看完整的API
祝你好运
答案 1 :(得分:2)
您可以使用 ResourcePermissionLocalServiceUtil 服务为您的DlFolder授予权限,如下所示:
ResourcePermissionLocalServiceUtil.setResourcePermissions(companyId,DLFolder.
class.getName(),ResourceConstants.SCOPE_INDIVIDUAL,""+
folder.getFolderId(), roleId, permissions);
从here获取有关它的详细信息!