public IActionResult DownloadByToken(string token) { DownloadTicket ticket = SessionManager.GetDownloadTicket(token); if (ticket == null) { return(NotFound("Token is not valid or expired.")); } if (!TryGetSession(ticket.SessionId, out Session session)) { return(Unauthorized()); } return(GetSelection(session, ticket.VolumeName, ticket.Selection)); }
public IActionResult GetAttachmentToken(string volume, ulong documentId, string attachmentName) { if (!TryGetSession(User, out Session _)) { return(Unauthorized()); } DocIdentity identity = new DocIdentity(documentId); string sessionId = GetSessionId(User); AttachmentsSelection selection = new AttachmentsSelection(identity.CompositeId, attachmentName); DownloadTicket ticket = SessionManager .CreateDownloadTicket(sessionId, volume, selection); return(Ok(new { ticket.Token })); }
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 })); }