Example #1
0
        public IActionResult DeleteAttachments(string volume, ulong documentId, [FromBody] AttachmentsRange range)
        {
            if (!TryGetSession(User, out Session session))
            {
                return(Unauthorized());
            }

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

            AttachmentsSelection attSelection = new AttachmentsSelection(
                documentId,
                range.Attachments,
                range.ExcludeMode
                );

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

            session.DeleteSelection(volume, attSelection);

            return(Ok());
        }
Example #2
0
        public IActionResult GetAttachmentsArchive(string volume, ulong documentId, [FromBody] AttachmentsRange range)
        {
            if (!TryGetSession(User, out Session session))
            {
                return(Unauthorized());
            }

            AttachmentsSelection selection = new AttachmentsSelection(documentId, range.Attachments, range.ExcludeMode)
            {
                ArchiveIfSingle = true
            };

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

            return(GetSelection(session, volume, selection));
        }
Example #3
0
        public IActionResult GetAttachmentsArchiveToken(string volume, ulong documentId, [FromBody] AttachmentsRange range)
        {
            if (!TryGetSession(User, out Session _))
            {
                return(Unauthorized());
            }

            AttachmentsSelection selection = new AttachmentsSelection(documentId, range.Attachments, 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 }));
        }