/// <summary> /// Updates the document global annotation permissions /// </summary> /// <param name="fileId">The document path to update the permissions for</param> /// <param name="rights">The annotation permissions</param> public void SetDocumentAccessRights(string fileId, AnnotationReviewerRights rights) { var document = _documentSvc.GetDocument(fileId); long documentId = document != null ? document.Id : _annotator.CreateDocument(fileId); _annotator.SetDocumentAccessRights(documentId, rights); }
/// <summary> /// Assigns/sets document access rights /// </summary> public static void AssignAccessRights() { try { //ExStart:AssignAccessRight // Create instance of annotator. AnnotationConfig cfg = CommonUtilities.GetConfiguration(); AnnotationImageHandler annotator = new AnnotationImageHandler(cfg); IDocumentDataHandler documentRepository = annotator.GetDocumentDataHandler(); if (!Directory.Exists(cfg.StoragePath)) { Directory.CreateDirectory(cfg.StoragePath); } // Create document data object in storage. var document = documentRepository.GetDocument("Document.pdf"); long documentId = document != null ? document.Id : annotator.CreateDocument("Document.pdf"); // Set document access rights annotator.SetDocumentAccessRights(documentId, AnnotationReviewerRights.All); //ExEnd:AssignAccessRight } catch (System.Exception exp) { Console.WriteLine(exp.Message); } }