Esempio n. 1
0
        public async Task <PartialViewResult> LoadFilePreview(Guid id, string slug, CancellationToken cancellationToken)
        {
            if (id == Guid.Empty)
            {
                throw new ArgumentOutOfRangeException(nameof(id));
            }

            if (UserHasFileReadAccess(id))
            {
                var cookies = Request.GetCookieContainer(_configurationProvider.ApplicationGatewayFqdn);

                var response = await _fileServerService.GetCollaboraFileUrl(id, cookies, "view");

                if (response != null)
                {
                    return(PartialView("_FilePreview", response));
                }
            }

            return(null);
        }
Esempio n. 2
0
        public async Task <IActionResult> GetViewCollaboraUrlAsync(Guid userId, string slug, Guid id, CancellationToken cancellationToken)
        {
            var file = await _fileServerService.GetCollaboraFileUrl(userId, slug, "view", id, HttpContext.Request, cancellationToken);

            return(Ok(file));
        }