bugs fix
This commit is contained in:
parent
f2c54df2b0
commit
41a540bd1e
13 changed files with 165 additions and 114 deletions
|
@ -40,9 +40,9 @@ namespace WebsitePanel.WebDavPortal.Controllers
|
|||
{
|
||||
var user = _authenticationService.LogIn(model.Login, model.Password);
|
||||
|
||||
ViewBag.LdapIsAuthentication = user.Identity.IsAuthenticated;
|
||||
ViewBag.LdapIsAuthentication = user != null;
|
||||
|
||||
if (user.Identity.IsAuthenticated)
|
||||
if (user != null && user.Identity.IsAuthenticated)
|
||||
{
|
||||
_authenticationService.CreateAuthenticationTicket(user);
|
||||
|
||||
|
|
|
@ -41,19 +41,21 @@ namespace WebsitePanel.WebDavPortal.Controllers
|
|||
public ActionResult ShowContent(string org, string pathPart = "")
|
||||
{
|
||||
if (org != WspContext.User.OrganizationId)
|
||||
return new HttpStatusCodeResult(HttpStatusCode.NoContent);
|
||||
|
||||
string fileName = pathPart.Split('/').Last();
|
||||
if (_webdavManager.IsFile(fileName))
|
||||
{
|
||||
var fileBytes = _webdavManager.GetFileBytes(fileName);
|
||||
return new HttpStatusCodeResult(HttpStatusCode.NoContent);
|
||||
}
|
||||
|
||||
string fileName = pathPart.Split('/').Last();
|
||||
|
||||
if (_webdavManager.IsFile(pathPart))
|
||||
{
|
||||
var fileBytes = _webdavManager.GetFileBytes(pathPart);
|
||||
return File(fileBytes, MediaTypeNames.Application.Octet, fileName);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
_webdavManager.OpenFolder(pathPart);
|
||||
IEnumerable<IHierarchyItem> children = _webdavManager.GetChildren().Where(x => !WebDavAppConfigManager.Instance.ElementsRendering.ElementsToIgnore.Contains(x.DisplayName.Trim('/')));
|
||||
IEnumerable<IHierarchyItem> children = _webdavManager.OpenFolder(pathPart).Where(x => !WebDavAppConfigManager.Instance.ElementsRendering.ElementsToIgnore.Contains(x.DisplayName.Trim('/')));
|
||||
|
||||
var model = new ModelForWebDav { Items = children.Take(WebDavAppConfigManager.Instance.ElementsRendering.DefaultCount), UrlSuffix = pathPart };
|
||||
Session[WebDavAppConfigManager.Instance.SessionKeys.ResourseRenderCount] = WebDavAppConfigManager.Instance.ElementsRendering.DefaultCount;
|
||||
|
@ -70,7 +72,7 @@ namespace WebsitePanel.WebDavPortal.Controllers
|
|||
{
|
||||
var owaOpener = WebDavAppConfigManager.Instance.OfficeOnline.Single(x => x.Extension == Path.GetExtension(pathPart));
|
||||
|
||||
string fileUrl = _webdavManager.RootPath.TrimEnd('/') + "/" + pathPart.TrimStart('/');
|
||||
string fileUrl = WebDavAppConfigManager.Instance.WebdavRoot+ org + "/" + pathPart.TrimStart('/');
|
||||
string accessToken = _authenticationService.CreateAccessToken(WspContext.User);
|
||||
|
||||
string wopiSrc = Server.UrlDecode(Url.RouteUrl(OwaRouteNames.CheckFileInfo, new { encodedPath = _webdavManager.CreateFileId(pathPart) }, Request.Url.Scheme));
|
||||
|
@ -81,13 +83,13 @@ namespace WebsitePanel.WebDavPortal.Controllers
|
|||
}
|
||||
|
||||
[HttpPost]
|
||||
public ActionResult ShowAdditionalContent()
|
||||
public ActionResult ShowAdditionalContent(string path)
|
||||
{
|
||||
if (Session[WebDavAppConfigManager.Instance.SessionKeys.ResourseRenderCount] != null)
|
||||
{
|
||||
var renderedElementsCount = (int)Session[WebDavAppConfigManager.Instance.SessionKeys.ResourseRenderCount];
|
||||
|
||||
IEnumerable<IHierarchyItem> children = _webdavManager.GetChildren();
|
||||
IEnumerable<IHierarchyItem> children = _webdavManager.OpenFolder(path);
|
||||
|
||||
var result = children.Skip(renderedElementsCount).Take(WebDavAppConfigManager.Instance.ElementsRendering.AddElementsCount);
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ using System.Web.SessionState;
|
|||
using WebsitePanel.WebDav.Core.Interfaces.Managers;
|
||||
using WebsitePanel.WebDav.Core.Interfaces.Owa;
|
||||
using WebsitePanel.WebDav.Core.Interfaces.Security;
|
||||
using WebsitePanel.WebDav.Core.Managers;
|
||||
using WebsitePanel.WebDav.Core.Owa;
|
||||
using WebsitePanel.WebDav.Core.Security;
|
||||
using WebsitePanel.WebDav.Core.Security.Authentication;
|
||||
|
@ -23,7 +24,7 @@ namespace WebsitePanel.WebDavPortal.DependencyInjection
|
|||
kernel.Bind<HttpSessionState>().ToProvider<HttpSessionStateProvider>();
|
||||
kernel.Bind<ICryptography>().To<CryptoUtils>();
|
||||
kernel.Bind<IAuthenticationService>().To<FormsAuthenticationService>();
|
||||
kernel.Bind<IWebDavManager>().ToProvider<WebDavManagerProvider>();
|
||||
kernel.Bind<IWebDavManager>().To<WebDavManager>();
|
||||
kernel.Bind<IWopiServer>().To<WopiServer>();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ function GetResources() {
|
|||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '/FileSystem/ShowAdditionalContent',
|
||||
data: '',
|
||||
data: { path: window.location.pathname },
|
||||
dataType: "html",
|
||||
success: function (result) {
|
||||
var domElement = $(result);
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
</appSettings>
|
||||
<webDavExplorerConfigurationSettings>
|
||||
<userDomain value="websitepanel.net" />
|
||||
<webdavRoot value="https://webdav.websitepanel.net/" />
|
||||
<applicationName value="WebDAV Explorer" />
|
||||
<authTimeoutCookieName value=".auth-logout-timeout" />
|
||||
<elementsRendering defaultCount="20" addElementsCount="20" elementsToIgnoreKey="web.config" />
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue