Files: FileStorageServiceController

This commit is contained in:
pavelbannov 2020-01-31 18:32:27 +03:00
parent fa1cf519f9
commit 0a8aa83813
4 changed files with 1170 additions and 1168 deletions

View File

@ -22,6 +22,7 @@
<PackageReference Include="Microsoft.AspNet.WebApi.Core" Version="5.2.7" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\common\ASC.Api.Core\ASC.Api.Core.csproj" />
<ProjectReference Include="..\..\..\common\ASC.Common\ASC.Common.csproj" />
<ProjectReference Include="..\..\..\common\ASC.Core.Common\ASC.Core.Common.csproj" />
<ProjectReference Include="..\..\..\common\ASC.Data.Storage\ASC.Data.Storage.csproj" />

View File

@ -29,7 +29,7 @@ using System.Collections.Generic;
namespace ASC.Files.Core
{
public interface IProviderDao : IDisposable
public interface IProviderDao
{
IProviderInfo GetProviderInfo(int linkId);
List<IProviderInfo> GetProvidersInfo();

View File

@ -130,21 +130,13 @@ namespace ASC.Web.Files.Classes
Logger.Fatal("Could not resolve IDaoFactory instance. Using default DaoFactory instead.");
}
if (!container.TryResolve(out IFileStorageService storageService))
{
storageService = new FileStorageServiceController();
Logger.Fatal("Could not resolve IFileStorageService instance. Using default FileStorageServiceController instead.");
}
DaoFactory = factory;
FileStorageService = storageService;
SocketManager = new SocketManager();
}
catch (Exception error)
{
Logger.Fatal("Could not resolve IDaoFactory instance. Using default DaoFactory instead.", error);
DaoFactory = daoFactory;
FileStorageService = new FileStorageServiceController();
}
Configuration = configuration;
@ -199,7 +191,7 @@ namespace ASC.Web.Files.Classes
public ILog Logger { get; set; }
public static IDaoFactory DaoFactory { get; private set; }
public IDaoFactory DaoFactory { get; private set; }
public EncryptedDataDao DaoEncryptedData
{
@ -210,7 +202,7 @@ namespace ASC.Web.Files.Classes
public static SocketManager SocketManager { get; private set; }
public static FileSecurity GetFilesSecurity()
public FileSecurity GetFilesSecurity()
{
return new FileSecurity(DaoFactory);
}
@ -391,7 +383,7 @@ namespace ASC.Web.Files.Classes
internal static readonly IDictionary<int, object> ShareFolderCache =
new ConcurrentDictionary<int, object>(); /*Use SYNCHRONIZED for cross thread blocks*/
public object FolderShare(IFolderDao folderDao)
public object GetFolderShare(IFolderDao folderDao)
{
if (CoreBaseSettings.Personal) return null;
if (IsOutsider) return null;
@ -514,4 +506,62 @@ namespace ASC.Web.Files.Classes
get { return UserManager.GetUsers(AuthContext.CurrentAccount.ID).IsOutsider(UserManager); }
}
}
public class GlobalFolderHelper
{
public Global Global { get; }
public GlobalFolder GlobalFolder { get; }
public GlobalFolderHelper(Global global, GlobalFolder globalFolder)
{
Global = global;
GlobalFolder = globalFolder;
}
public object FolderProjects
{
get
{
return GlobalFolder.GetFolderProjects(Global.DaoFactory);
}
}
public object FolderCommon
{
get
{
return GlobalFolder.GetFolderCommon(Global.DaoFactory);
}
}
public object FolderMy
{
get
{
return GlobalFolder.GetFolderMy(Global.DaoFactory);
}
set
{
GlobalFolder.SetFolderMy(value);
}
}
public object FolderShare
{
get
{
return GlobalFolder.GetFolderShare(Global.DaoFactory.FolderDao);
}
}
public object FolderTrash
{
get
{
return GlobalFolder.GetFolderTrash(Global.DaoFactory.FolderDao);
}
set
{
GlobalFolder.SetFolderTrash(value);
}
}
}
}