Beispiel #1
0
        public IActionResult GetDocumentsArchive(string volume, [FromBody] DocumentsRange range)
        {
            if (!TryGetSession(User, out Session session))
            {
                return(Unauthorized());
            }

            DocumentsSelection selection = new DocumentsSelection(range.DocumentIds, range.ExcludeMode)
            {
                ArchiveIfSingle = true
            };

            return(GetSelection(session, volume, selection));
        }
Beispiel #2
0
        public IActionResult GetDocumentToken(string volume, ulong documentId)
        {
            if (!TryGetSession(User, out Session _))
            {
                return(Unauthorized());
            }

            DocIdentity identity = new DocIdentity(documentId);

            string             sessionId = GetSessionId(User);
            DocumentsSelection selection = new DocumentsSelection(identity.CompositeId);

            DownloadTicket ticket = SessionManager
                                    .CreateDownloadTicket(sessionId, volume, selection);

            return(Ok(new { ticket.Token }));
        }
Beispiel #3
0
        public IActionResult GetDocumentsArchiveToken(string volume, [FromBody] DocumentsRange range)
        {
            if (!TryGetSession(User, out Session _))
            {
                return(Unauthorized());
            }

            DocumentsSelection selection = new DocumentsSelection(range.DocumentIds, range.ExcludeMode)
            {
                ArchiveIfSingle = true
            };

            if (!selection.IsValid())
            {
                return(BadRequest("Selection parameter is not valid"));
            }

            string         sessionId = GetSessionId(User);
            DownloadTicket ticket    = SessionManager.CreateDownloadTicket(sessionId, volume, selection);

            return(Ok(new { ticket.Token }));
        }
Beispiel #4
0
        public IActionResult DeleteDocuments(string volume, [FromBody] DocumentsRange range)
        {
            if (!TryGetSession(User, out Session session))
            {
                return(Unauthorized());
            }

            if (!session.IsVolumeExist(volume))
            {
                return(NotFound(Resources.ErrorVolumeNotFound));
            }

            DocumentsSelection selection = new DocumentsSelection(range.DocumentIds, range.ExcludeMode);

            if (!selection.IsValid())
            {
                return(BadRequest());
            }

            session.DeleteSelection(volume, selection);

            return(Ok());
        }