we have this function
public void giveUserCollaboratorAccessToFiles(GD_ListEntitiesResult result) {
GD_UserInfo user = createUserIfNeeded();
GD_ReviewerInfo info = new GD_ReviewerInfo();
info.primary_email = user.primary_email;
info.firstName = user.firstname;
info.lastName = user.lastname;
info.access_rights = '3';
info.guid = user.guid;
info.color = 16711680;
GD_ListEntitiesResult newResult = new GD_ListEntitiesResult();
List<GD_FileSystemDocument> newFiles = new List<GD_FileSystemDocument>();
for (GD_FileSystemDocument file : result.files) {
setCollaborator(file.guid, info);
String signedURL = new GD_GroupDocsSecurityHandler(GD_Utils.privateKey).handleURL(
'https://apps.groupdocs.com/document-annotation2/embed/' + file.guid + '?uid=' + user.guid, null);
file.fullSignedURL = signedURL;
file.modifyDate = convertDate(file.modified_on);
file.createDate = convertDate(file.created_on);
if (file.guid != null) {
GD_Drawing__c[] drawingObjs = [SELECT CreatedById, Name, Description__c, Id from GD_Drawing__c where Name = :file.guid];
if (drawingObjs.size() > 0) {
User owner = [SELECT Id, Name FROM User WHERE Id = :drawingObjs[0].createdById];
if (owner != null) {
file.ownerName = (String) owner.Name;
file.CreatorId = (String) owner.id;
}
file.description = drawingObjs[0].Description__c;
file.gdId = drawingObjs[0].Id;
}
}
newFiles.add(file);
}
newResult.files = newFiles;
this.files = newResult.files;
}
public String convertDate(Long millisecondDate) {
if (millisecondDate != null) {
DateTime dateVal = DateTime.newInstance(millisecondDate);
return dateVal.format();
}
return '';
}
this line is not setting the access_right when adding a user to group docs
info.access_rights = ‘3’;
are goal is to not allow user to delete annotations.
I found this info on the java library for access rights
CAN_VIEW - allows a user to view the document and add comments to existing annotations
CAN_ANNOTATE - allows a user to place new, and modify existing, annotations
CAN_DOWNLOAD - allows a user to download the original document without annotations
CAN_EXPORT - allows a user to export the document with annotations
CAN_DELETE - allows a user to delete annotations (both the user’s own annotations and those placed by other users)
CAN_REDACT - allows a user to redact (redaction tool) a text or a resource
All - permits all available actions
If you need to grant only specific access rights to a user, for example the ability to annotate and download the document, you can use the AccessRights helper method - public static int from(AccessRights[] accessRights):
AccessRights.from(AccessRights.CAN_ANNOTATE, AccessRights.CAN_DOWNLOAD)
This will compute the sum of these enums and return the integer value needed for the scripts generating method.
I also found this on a previous forum
None = 0,
CanView = 1,
CanAnnotate = 2,
CanDownload = 4,
CanExport = 8,
CanDelete = 16,
CanRedact = 32,
All = 63
I have tried changing to access right to a bunch of different number but it is not reflected in the
embedded annotation viewer.
How can I achieve not allowing users to delete annotations .
Thanks,
Michael Behan