webdav protal office 365 fix

This commit is contained in:
vfedosevich 2015-01-15 04:03:02 -08:00
parent 92befdea38
commit f2c54df2b0
27 changed files with 466 additions and 80 deletions

View file

@ -0,0 +1,53 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using WebsitePanel.WebDav.Core.Interfaces.Managers;
using WebsitePanel.WebDav.Core.Interfaces.Owa;
using WebsitePanel.WebDav.Core.Interfaces.Security;
using WebsitePanel.WebDav.Core.Security.Cryptography;
namespace WebsitePanel.WebDavPortal.Controllers
{
[AllowAnonymous]
public class OwaController : Controller
{
private readonly IWopiServer _wopiServer;
private readonly IWebDavManager _webDavManager;
private readonly IAuthenticationService _authenticationService;
public OwaController(IWopiServer wopiServer, IWebDavManager webDavManager, IAuthenticationService authenticationService)
{
_wopiServer = wopiServer;
_webDavManager = webDavManager;
_authenticationService = authenticationService;
}
public JsonResult CheckFileInfo( string encodedPath)
{
var path = _webDavManager.FilePathFromId(encodedPath);
var fileInfo = _wopiServer.GetCheckFileInfo(path);
return Json(fileInfo, JsonRequestBehavior.AllowGet);
}
public FileResult GetFile(string encodedPath)
{
var path = _webDavManager.FilePathFromId(encodedPath);
return _wopiServer.GetFile(path);
}
protected override void OnActionExecuting(ActionExecutingContext filterContext)
{
base.OnActionExecuting(filterContext);
if (!string.IsNullOrEmpty(Request["access_token"]))
{
_authenticationService.LogIn(Request["access_token"]);
}
}
}
}