Dear Friends
How can I set read write permissions to file or node with alfresco REST API for individual users?
The best way to understand the REST API is to take a look at the API Explorer.
In this case, you'll find out that you can set local permissions by using the update node API.
Hello Alfresco Community,
I'm using alfresco-sdk-client (developed byJean Marie Pascal and Gavin Cornwell).
I set successfully permission on file, but I can not return permission object in Response object
My code:
List<PermissionElementRepresentation> users = new ArrayList<PermissionElementRepresentation>();
PermissionElementRepresentation user = new PermissionElementRepresentation();
user.setAuthorityId("dato");
user.setName("read");
user.setAccessStatus(AccessStatusEnum.ALLOWED);
users.add(user);
PermissionsBodyUpdate permission = new PermissionsBodyUpdate(false, users);
NodeBodyUpdate permissionRequest = new NodeBodyUpdate(permission);
Response<NodeRepresentation> permissionResponse = nodeService.updateNodeCall(createdNodeResponse.body().getId(), permissionRequest)
.execute();
But in permissionResponse object the permission object is null
Please Help me
I successfully resolve this problem:
I add two arguments IncludeParam and FieldsParam to nodeService.updateNodeCall function and get expected result:
List<String> fieldPermission = new ArrayList<>();
fieldPermission.add("permissions");
IncludeParam fieldValues = new IncludeParam(fieldPermission);
FieldsParam field = new FieldsParam(fieldPermission);
Response<NodeRepresentation> permissionResponse = nodeService.updateNodeCall(createdNodeResponse.body().getId(), permissionRequest, fieldValues, field)
.execute();
Assert.assertEquals(permissionResponse.body().getPermissions().getLocallySet(), users, "Permission is wrong");
Thanks All
Ask for and offer help to other Alfresco Content Services Users and members of the Alfresco team.
Related links:
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.