Merge branch 'develop' into feature/fix-hide/show-header

This commit is contained in:
TatianaLopaeva 2020-11-20 11:11:12 +03:00
commit acde944525
46 changed files with 512 additions and 2245 deletions

View File

@ -224,7 +224,7 @@ namespace ASC.Files.Core
/// <param name="text"></param>
/// <param name="bunch"></param>
/// <returns></returns>
IEnumerable<Folder<T>> Search(string text, bool bunch = false);
IEnumerable<Folder<T>> SearchFolders(string text, bool bunch = false);
/// <summary>
/// Only in TMFolderDao
@ -331,9 +331,9 @@ namespace ASC.Files.Core
Dictionary<string, string> GetBunchObjectIDs(List<T> folderIDs);
IEnumerable<(Folder<T>, SmallShareRecord)> GetFeeds(int tenant, DateTime from, DateTime to);
IEnumerable<(Folder<T>, SmallShareRecord)> GetFeedsForFolders(int tenant, DateTime from, DateTime to);
IEnumerable<T> GetTenantsWithFeeds(DateTime fromTime);
IEnumerable<T> GetTenantsWithFeedsForFolders(DateTime fromTime);
#endregion
}

View File

@ -162,7 +162,8 @@ namespace ASC.Files.Core.Data
var newItem = new DbFilesThirdpartyIdMapping
{
Id = id.ToString(),
HashId = result.ToString()
HashId = result.ToString(),
TenantId = TenantID
};
FilesDbContext.AddOrUpdate(r => r.ThirdpartyIdMapping, newItem);

View File

@ -787,7 +787,7 @@ namespace ASC.Files.Core.Data
}
public IEnumerable<Folder<int>> Search(string text, bool bunch)
public IEnumerable<Folder<int>> SearchFolders(string text, bool bunch)
{
return Search(text).Where(f => bunch
? f.RootFolderType == FolderType.BUNCH
@ -1168,7 +1168,7 @@ namespace ASC.Files.Core.Data
.ToDictionary(r => r.LeftNode, r => r.RightNode);
}
public IEnumerable<(Folder<int>, SmallShareRecord)> GetFeeds(int tenant, DateTime from, DateTime to)
public IEnumerable<(Folder<int>, SmallShareRecord)> GetFeedsForFolders(int tenant, DateTime from, DateTime to)
{
var q1 = FilesDbContext.Folders
.Where(r => r.TenantId == tenant)
@ -1192,7 +1192,7 @@ namespace ASC.Files.Core.Data
return q2.Select(ToFolderWithShare).ToList().Union(q4.Select(ToFolderWithShare).ToList());
}
public IEnumerable<int> GetTenantsWithFeeds(DateTime fromTime)
public IEnumerable<int> GetTenantsWithFeedsForFolders(DateTime fromTime)
{
var q1 = FilesDbContext.Files
.Where(r => r.ModifiedOn > fromTime)

View File

@ -308,7 +308,9 @@ namespace ASC.Web.Files.Services.WCFService
|| parent.FolderType == FolderType.SHARE
|| parent.RootFolderType == FolderType.Privacy;
entries = entries.Where(x => x.FileEntryType == FileEntryType.Folder || !FileConverter.IsConverting((File<T>)x));
entries = entries.Where(x => x.FileEntryType == FileEntryType.Folder ||
(x is File<string> f1 && !FileConverter.IsConverting(f1) ||
x is File<int> f2 && !FileConverter.IsConverting(f2)));
var result = new DataWrapper<T>
{
@ -1165,13 +1167,14 @@ namespace ASC.Web.Files.Services.WCFService
public Folder<T> SaveThirdParty(ThirdPartyParams thirdPartyParams)
{
var folderDaoInt = DaoFactory.GetFolderDao<int>();
var folderDao = GetFolderDao();
var providerDao = GetProviderDao();
if (providerDao == null) return null;
ErrorIf(thirdPartyParams == null, FilesCommonResource.ErrorMassage_BadRequest);
var parentFolder = folderDao.GetFolder(thirdPartyParams.Corporate && !CoreBaseSettings.Personal ? GlobalFolderHelper.GetFolderCommon<T>() : GlobalFolderHelper.GetFolderMy<T>());
var parentFolder = folderDaoInt.GetFolder(thirdPartyParams.Corporate && !CoreBaseSettings.Personal ? GlobalFolderHelper.FolderCommon : GlobalFolderHelper.FolderMy);
ErrorIf(!FileSecurity.CanCreate(parentFolder), FilesCommonResource.ErrorMassage_SecurityException_Create);
ErrorIf(!FilesSettingsHelper.EnableThirdParty, FilesCommonResource.ErrorMassage_SecurityException_Create);
@ -1183,7 +1186,7 @@ namespace ASC.Web.Files.Services.WCFService
MessageAction messageAction;
if (string.IsNullOrEmpty(thirdPartyParams.ProviderId))
{
ErrorIf(!ThirdpartyConfiguration.SupportInclusion
ErrorIf(!ThirdpartyConfiguration.SupportInclusion(DaoFactory)
||
(!FilesSettingsHelper.EnableThirdParty
&& !CoreBaseSettings.Personal)

View File

@ -694,17 +694,26 @@ namespace ASC.Files.Core.Security
return daoFactory.GetSecurityDao<T>().GetShares(entry);
}
public List<FileEntry<T>> GetSharesForMe<T>(FilterType filterType, bool subjectGroup, Guid subjectID, string searchText = "", bool searchInContent = false, bool withSubfolders = false)
public List<FileEntry> GetSharesForMe(FilterType filterType, bool subjectGroup, Guid subjectID, string searchText = "", bool searchInContent = false, bool withSubfolders = false)
{
var securityDao = daoFactory.GetSecurityDao<int>();
var subjects = GetUserSubjects(AuthContext.CurrentAccount.ID);
var records = securityDao.GetShares(subjects);
var result = new List<FileEntry>();
result.AddRange(GetSharesForMe<int>(records.Where(r=> r.EntryId.GetType() == typeof(int)), subjects, filterType, subjectGroup, subjectID, searchText, searchInContent, withSubfolders));
result.AddRange(GetSharesForMe<string>(records.Where(r => r.EntryId.GetType() == typeof(string)), subjects, filterType, subjectGroup, subjectID, searchText, searchInContent, withSubfolders));
return result;
}
private List<FileEntry> GetSharesForMe<T>(IEnumerable<FileShareRecord> records, List<Guid> subjects, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText = "", bool searchInContent = false, bool withSubfolders = false)
{
var folderDao = daoFactory.GetFolderDao<T>();
var fileDao = daoFactory.GetFileDao<T>();
var securityDao = daoFactory.GetSecurityDao<T>();
var subjects = GetUserSubjects(AuthContext.CurrentAccount.ID);
var records = securityDao.GetShares(subjects);
var fileIds = new Dictionary<object, FileShare>();
var folderIds = new Dictionary<object, FileShare>();
var fileIds = new Dictionary<T, FileShare>();
var folderIds = new Dictionary<T, FileShare>();
var recordGroup = records.GroupBy(r => new { r.EntryId, r.EntryType }, (key, group) => new
{
@ -717,13 +726,13 @@ namespace ASC.Files.Core.Security
{
if (r.firstRecord.EntryType == FileEntryType.Folder)
{
if (!folderIds.ContainsKey(r.firstRecord.EntryId))
folderIds.Add(r.firstRecord.EntryId, r.firstRecord.Share);
if (!folderIds.ContainsKey((T)r.firstRecord.EntryId))
folderIds.Add((T)r.firstRecord.EntryId, r.firstRecord.Share);
}
else
{
if (!fileIds.ContainsKey(r.firstRecord.EntryId))
fileIds.Add(r.firstRecord.EntryId, r.firstRecord.Share);
if (!fileIds.ContainsKey((T)r.firstRecord.EntryId))
fileIds.Add((T)r.firstRecord.EntryId, r.firstRecord.Share);
}
}
@ -731,7 +740,7 @@ namespace ASC.Files.Core.Security
if (filterType != FilterType.FoldersOnly)
{
var files = fileDao.GetFilesFiltered(fileIds.Keys.Select(r => (T)r).ToArray(), filterType, subjectGroup, subjectID, searchText, searchInContent);
var files = fileDao.GetFilesFiltered(fileIds.Keys.Select(r => r).ToArray(), filterType, subjectGroup, subjectID, searchText, searchInContent);
files.ForEach(x =>
{
@ -747,7 +756,7 @@ namespace ASC.Files.Core.Security
if (filterType == FilterType.None || filterType == FilterType.FoldersOnly)
{
var folders = folderDao.GetFolders(folderIds.Keys.Select(r => (T)r).ToArray(), filterType, subjectGroup, subjectID, searchText, withSubfolders, false);
var folders = folderDao.GetFolders(folderIds.Keys.Select(r => r).ToArray(), filterType, subjectGroup, subjectID, searchText, withSubfolders, false);
if (withSubfolders)
{
@ -767,7 +776,7 @@ namespace ASC.Files.Core.Security
if (filterType != FilterType.FoldersOnly && withSubfolders)
{
var filesInSharedFolders = fileDao.GetFiles(folderIds.Keys.Select(r => (T)r).ToArray(), filterType, subjectGroup, subjectID, searchText, searchInContent);
var filesInSharedFolders = fileDao.GetFiles(folderIds.Keys.Select(r => r).ToArray(), filterType, subjectGroup, subjectID, searchText, searchInContent);
filesInSharedFolders = FilterRead(filesInSharedFolders).ToList();
entries.AddRange(filesInSharedFolders);
entries = entries.Distinct().ToList();
@ -802,7 +811,7 @@ namespace ASC.Files.Core.Security
securityDao.DeleteShareRecords(failedRecords);
}
return entries.Where(x => string.IsNullOrEmpty(x.Error)).ToList();
return entries.Where(x => string.IsNullOrEmpty(x.Error)).Cast<FileEntry>().ToList();
}
public List<FileEntry<T>> GetPrivacyForMe<T>(FilterType filterType, bool subjectGroup, Guid subjectID, string searchText = "", bool searchInContent = false, bool withSubfolders = false)

View File

@ -228,7 +228,7 @@ namespace ASC.Files.Thirdparty.Box
}
}
protected IEnumerable<string> GetChildren(string folderId)
protected override IEnumerable<string> GetChildren(string folderId)
{
return GetBoxItems(folderId).Select(entry => MakeId(entry.Id));
}

View File

@ -37,10 +37,8 @@ using ASC.Core.Tenants;
using ASC.Files.Core;
using ASC.Files.Core.EF;
using ASC.Files.Core.Resources;
using ASC.Files.Core.Security;
using ASC.Files.Core.Thirdparty;
using ASC.Web.Core.Files;
using ASC.Web.Files.Services.DocumentService;
using ASC.Web.Studio.Core;
using Box.V2.Models;
@ -547,64 +545,5 @@ namespace ASC.Files.Thirdparty.Box
}
#endregion
#region Only in TMFileDao
public void ReassignFiles(string[] fileIds, Guid newOwnerId)
{
}
public List<File<string>> GetFiles(string[] parentIds, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool searchInContent)
{
return new List<File<string>>();
}
public IEnumerable<File<string>> Search(string text, bool bunch)
{
return null;
}
public bool IsExistOnStorage(File<string> file)
{
return true;
}
public void SaveEditHistory(File<string> file, string changes, Stream differenceStream)
{
//Do nothing
}
public List<EditHistory> GetEditHistory(DocumentServiceHelper documentServiceHelper, string fileId, int fileVersion)
{
return null;
}
public Stream GetDifferenceStream(File<string> file)
{
return null;
}
public bool ContainChanges(string fileId, int fileVersion)
{
return false;
}
public string GetUniqFilePath(File<string> file, string fileTitle)
{
throw new NotImplementedException();
}
public IEnumerable<(File<int>, SmallShareRecord)> GetFeeds(int tenant, DateTime from, DateTime to)
{
throw new NotImplementedException();
}
public IEnumerable<int> GetTenantsWithFeeds(DateTime fromTime)
{
throw new NotImplementedException();
}
#endregion
}
}

View File

@ -36,7 +36,6 @@ using ASC.Core.Common.EF;
using ASC.Core.Tenants;
using ASC.Files.Core;
using ASC.Files.Core.EF;
using ASC.Files.Core.Security;
using ASC.Files.Core.Thirdparty;
using ASC.Web.Core.Files;
using ASC.Web.Studio.Core;
@ -438,99 +437,5 @@ namespace ASC.Files.Thirdparty.Box
return chunkedUpload ? storageMaxUploadSize : Math.Min(storageMaxUploadSize, SetupInfo.AvailableFileSize);
}
#region Only for TMFolderDao
public void ReassignFolders(string[] folderIds, Guid newOwnerId)
{
}
public IEnumerable<Folder<string>> Search(string text, bool bunch)
{
return null;
}
public string GetFolderID(string module, string bunch, string data, bool createIfNotExists)
{
return null;
}
public IEnumerable<string> GetFolderIDs(string module, string bunch, IEnumerable<string> data, bool createIfNotExists)
{
return new List<string>();
}
public string GetFolderIDCommon(bool createIfNotExists)
{
return null;
}
public string GetFolderIDUser(bool createIfNotExists, Guid? userId)
{
return null;
}
public string GetFolderIDShare(bool createIfNotExists)
{
return null;
}
public string GetFolderIDRecent(bool createIfNotExists)
{
return null;
}
public string GetFolderIDFavorites(bool createIfNotExists)
{
return null;
}
public string GetFolderIDTemplates(bool createIfNotExists)
{
return null;
}
public string GetFolderIDPrivacy(bool createIfNotExists, Guid? userId)
{
return null;
}
public string GetFolderIDTrash(bool createIfNotExists, Guid? userId)
{
return null;
}
public string GetFolderIDPhotos(bool createIfNotExists)
{
return null;
}
public string GetFolderIDProjects(bool createIfNotExists)
{
return null;
}
public string GetBunchObjectID(string folderID)
{
return null;
}
public Dictionary<string, string> GetBunchObjectIDs(List<string> folderIDs)
{
return null;
}
public IEnumerable<(Folder<string>, SmallShareRecord)> GetFeeds(int tenant, DateTime from, DateTime to)
{
throw new NotImplementedException();
}
public IEnumerable<string> GetTenantsWithFeeds(DateTime fromTime)
{
throw new NotImplementedException();
}
#endregion
}
}

View File

@ -25,14 +25,12 @@
using System;
using System.Collections.Generic;
using ASC.Common;
using ASC.Common.Logging;
using ASC.Core;
using ASC.Core.Common.EF;
using ASC.Core.Tenants;
using ASC.Files.Core;
using ASC.Files.Core.EF;
using ASC.Files.Core.Security;
using ASC.Web.Core.Files;
@ -48,47 +46,5 @@ namespace ASC.Files.Thirdparty.Box
public BoxSecurityDao(IServiceProvider serviceProvider, UserManager userManager, TenantManager tenantManager, TenantUtil tenantUtil, DbContextManager<FilesDbContext> dbContextManager, SetupInfo setupInfo, IOptionsMonitor<ILog> monitor, FileUtility fileUtility) : base(serviceProvider, userManager, tenantManager, tenantUtil, dbContextManager, setupInfo, monitor, fileUtility)
{
}
public void SetShare(FileShareRecord r)
{
}
public IEnumerable<FileShareRecord> GetShares(IEnumerable<Guid> subjects)
{
return null;
}
public IEnumerable<FileShareRecord> GetShares(IEnumerable<FileEntry<string>> entry)
{
return null;
}
public IEnumerable<FileShareRecord> GetShares(FileEntry<string> entry)
{
return null;
}
public void RemoveSubject(Guid subject)
{
}
public IEnumerable<FileShareRecord> GetPureShareRecords(IEnumerable<FileEntry<string>> entries)
{
return null;
}
public IEnumerable<FileShareRecord> GetPureShareRecords(FileEntry<string> entry)
{
return null;
}
public void DeleteShareRecords(IEnumerable<FileShareRecord> records)
{
}
public bool IsShared(object entryId, FileEntryType type)
{
throw new NotImplementedException();
}
}
}

View File

@ -25,8 +25,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using ASC.Common;
using ASC.Common.Logging;
@ -35,7 +33,6 @@ using ASC.Core.Common.EF;
using ASC.Core.Tenants;
using ASC.Files.Core;
using ASC.Files.Core.EF;
using ASC.Files.Thirdparty.Dropbox;
using ASC.Web.Core.Files;
using ASC.Web.Studio.Core;
@ -49,128 +46,5 @@ namespace ASC.Files.Thirdparty.Box
public BoxTagDao(IServiceProvider serviceProvider, UserManager userManager, TenantManager tenantManager, TenantUtil tenantUtil, DbContextManager<FilesDbContext> dbContextManager, SetupInfo setupInfo, IOptionsMonitor<ILog> monitor, FileUtility fileUtility) : base(serviceProvider, userManager, tenantManager, tenantUtil, dbContextManager, setupInfo, monitor, fileUtility)
{
}
#region ITagDao Members
public IEnumerable<Tag> GetTags(Guid subject, TagType tagType, IEnumerable<FileEntry<string>> fileEntries)
{
throw new NotImplementedException();
}
public IEnumerable<Tag> GetTags(TagType tagType, IEnumerable<FileEntry<string>> fileEntries)
{
return null;
}
public IEnumerable<Tag> GetTags(Guid owner, TagType tagType)
{
return null;
}
public IEnumerable<Tag> GetTags(string name, TagType tagType)
{
return null;
}
public IEnumerable<Tag> GetTags(string[] names, TagType tagType)
{
return null;
}
public IEnumerable<Tag> GetNewTags(Guid subject, Folder<string> parentFolder, bool deepSearch)
{
var folderId = DaoSelector.ConvertId(parentFolder.ID);
var fakeFolderId = parentFolder.ID.ToString();
var entryIDs = FilesDbContext.ThirdpartyIdMapping
.Where(r => r.Id.StartsWith(fakeFolderId))
.Select(r => r.HashId)
.ToList();
if (!entryIDs.Any()) return new List<Tag>();
var q = FilesDbContext.Tag
.Join(FilesDbContext.TagLink.DefaultIfEmpty(),
r => new TagLink { TenantId = r.TenantId, Id = r.Id },
r => new TagLink { TenantId = r.TenantId, Id = r.TagId },
(tag, tagLink) => new { tag, tagLink },
new TagLinkComparer())
.Where(r => r.tag.TenantId == TenantID)
.Where(r => r.tag.Flag == TagType.New)
.Where(r => r.tagLink.TenantId == TenantID)
.Where(r => entryIDs.Any(a => a == r.tagLink.EntryId));
if (subject != Guid.Empty)
{
q = q.Where(r => r.tag.Owner == subject);
}
var tags = q
.ToList()
.Select(r => new Tag
{
TagName = r.tag.Name,
TagType = r.tag.Flag,
Owner = r.tag.Owner,
EntryId = MappingID(r.tagLink.EntryId),
EntryType = r.tagLink.EntryType,
Count = r.tagLink.TagCount,
Id = r.tag.Id
});
if (deepSearch) return tags;
var folderFileIds = new[] { fakeFolderId }
.Concat(GetChildren(folderId));
return tags.Where(tag => folderFileIds.Contains(tag.EntryId.ToString()));
}
public IEnumerable<Tag> GetNewTags(Guid subject, IEnumerable<FileEntry<string>> fileEntries)
{
return null;
}
public IEnumerable<Tag> GetNewTags(Guid subject, FileEntry<string> fileEntry)
{
return null;
}
public IEnumerable<Tag> SaveTags(IEnumerable<Tag> tag)
{
return null;
}
public IEnumerable<Tag> SaveTags(Tag tag)
{
return null;
}
public void UpdateNewTags(IEnumerable<Tag> tag)
{
}
public void UpdateNewTags(Tag tag)
{
}
public void RemoveTags(IEnumerable<Tag> tag)
{
}
public void RemoveTags(Tag tag)
{
}
public IEnumerable<Tag> GetTags(string entryID, FileEntryType entryType, TagType tagType)
{
return null;
}
public void MarkAsNew(Guid subject, FileEntry fileEntry)
{
}
#endregion
}
}

View File

@ -3,8 +3,8 @@ using System.Linq;
using System.Threading;
using ASC.Common;
using ASC.Files.Core.Data;
using ASC.Files.Core.Resources;
using ASC.Files.Core.Security;
using ASC.Files.Thirdparty.Box;
using ASC.Files.Thirdparty.Dropbox;
using ASC.Files.Thirdparty.GoogleDrive;
@ -49,8 +49,8 @@ namespace ASC.Files.Core.Thirdparty
FileSizeComment.FilesSizeToString(SetupInfo.AvailableFileSize)));
}
var securityDao = ServiceProvider.GetService<SecurityDao<TFrom>>();
var tagDao = ServiceProvider.GetService<TagDao<TFrom>>();
var securityDao = ServiceProvider.GetService<ISecurityDao<TFrom>>();
var tagDao = ServiceProvider.GetService<ITagDao<TFrom>>();
var fromFileShareRecords = securityDao.GetPureShareRecords(fromFile).Where(x => x.EntryType == FileEntryType.File);
var fromFileNewTags = tagDao.GetNewTags(Guid.Empty, fromFile).ToList();
@ -153,7 +153,7 @@ namespace ASC.Files.Core.Thirdparty
if (deleteSourceFolder)
{
var securityDao = ServiceProvider.GetService<SecurityDao<TFrom>>();
var securityDao = ServiceProvider.GetService<ISecurityDao<TFrom>>();
var fromFileShareRecords = securityDao.GetPureShareRecords(fromFolder)
.Where(x => x.EntryType == FileEntryType.Folder);
@ -166,7 +166,7 @@ namespace ASC.Files.Core.Thirdparty
});
}
var tagDao = ServiceProvider.GetService<TagDao<TFrom>>();
var tagDao = ServiceProvider.GetService<ITagDao<TFrom>>();
var fromFileNewTags = tagDao.GetNewTags(Guid.Empty, fromFolder).ToList();
if (fromFileNewTags.Any())

View File

@ -220,7 +220,7 @@ namespace ASC.Files.Thirdparty.Dropbox
}
}
protected IEnumerable<string> GetChildren(object folderId)
protected override IEnumerable<string> GetChildren(string folderId)
{
return GetDropboxItems(folderId).Select(MakeId);
}

View File

@ -37,10 +37,8 @@ using ASC.Core.Tenants;
using ASC.Files.Core;
using ASC.Files.Core.EF;
using ASC.Files.Core.Resources;
using ASC.Files.Core.Security;
using ASC.Files.Core.Thirdparty;
using ASC.Web.Core.Files;
using ASC.Web.Files.Services.DocumentService;
using ASC.Web.Studio.Core;
using Dropbox.Api.Files;
@ -592,64 +590,5 @@ namespace ASC.Files.Thirdparty.Dropbox
}
#endregion
#region Only in TMFileDao
public void ReassignFiles(string[] fileIds, Guid newOwnerId)
{
}
public List<File<string>> GetFiles(string[] parentIds, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool searchInContent)
{
return new List<File<string>>();
}
public IEnumerable<File<string>> Search(string text, bool bunch)
{
return null;
}
public bool IsExistOnStorage(File<string> file)
{
return true;
}
public void SaveEditHistory(File<string> file, string changes, Stream differenceStream)
{
//Do nothing
}
public List<EditHistory> GetEditHistory(DocumentServiceHelper documentServiceHelper, string fileId, int fileVersion)
{
return null;
}
public Stream GetDifferenceStream(File<string> file)
{
return null;
}
public bool ContainChanges(string fileId, int fileVersion)
{
return false;
}
public string GetUniqFilePath(File<string> file, string fileTitle)
{
throw new NotImplementedException();
}
public IEnumerable<(File<int>, SmallShareRecord)> GetFeeds(int tenant, DateTime from, DateTime to)
{
throw new NotImplementedException();
}
public IEnumerable<int> GetTenantsWithFeeds(DateTime fromTime)
{
throw new NotImplementedException();
}
#endregion
}
}

View File

@ -36,7 +36,6 @@ using ASC.Core.Common.EF;
using ASC.Core.Tenants;
using ASC.Files.Core;
using ASC.Files.Core.EF;
using ASC.Files.Core.Security;
using ASC.Files.Core.Thirdparty;
using ASC.Web.Core.Files;
using ASC.Web.Studio.Core;
@ -435,99 +434,5 @@ namespace ASC.Files.Thirdparty.Dropbox
return chunkedUpload ? storageMaxUploadSize : Math.Min(storageMaxUploadSize, SetupInfo.AvailableFileSize);
}
#region Only for TMFolderDao
public void ReassignFolders(string[] folderIds, Guid newOwnerId)
{
}
public IEnumerable<Folder<string>> Search(string text, bool bunch)
{
return null;
}
public string GetFolderID(string module, string bunch, string data, bool createIfNotExists)
{
return null;
}
public IEnumerable<string> GetFolderIDs(string module, string bunch, IEnumerable<string> data, bool createIfNotExists)
{
return new List<string>();
}
public string GetFolderIDCommon(bool createIfNotExists)
{
return null;
}
public string GetFolderIDUser(bool createIfNotExists, Guid? userId)
{
return null;
}
public string GetFolderIDShare(bool createIfNotExists)
{
return null;
}
public string GetFolderIDRecent(bool createIfNotExists)
{
return null;
}
public string GetFolderIDFavorites(bool createIfNotExists)
{
return null;
}
public string GetFolderIDTemplates(bool createIfNotExists)
{
return null;
}
public string GetFolderIDPrivacy(bool createIfNotExists, Guid? userId)
{
return null;
}
public string GetFolderIDTrash(bool createIfNotExists, Guid? userId)
{
return null;
}
public string GetFolderIDPhotos(bool createIfNotExists)
{
return null;
}
public string GetFolderIDProjects(bool createIfNotExists)
{
return null;
}
public string GetBunchObjectID(string folderID)
{
return null;
}
public Dictionary<string, string> GetBunchObjectIDs(List<string> folderIDs)
{
return null;
}
public IEnumerable<(Folder<string>, SmallShareRecord)> GetFeeds(int tenant, DateTime from, DateTime to)
{
throw new NotImplementedException();
}
public IEnumerable<string> GetTenantsWithFeeds(DateTime fromTime)
{
throw new NotImplementedException();
}
#endregion
}
}

View File

@ -25,14 +25,12 @@
using System;
using System.Collections.Generic;
using ASC.Common;
using ASC.Common.Logging;
using ASC.Core;
using ASC.Core.Common.EF;
using ASC.Core.Tenants;
using ASC.Files.Core;
using ASC.Files.Core.EF;
using ASC.Files.Core.Security;
using ASC.Web.Core.Files;
@ -48,47 +46,5 @@ namespace ASC.Files.Thirdparty.Dropbox
public DropboxSecurityDao(IServiceProvider serviceProvider, UserManager userManager, TenantManager tenantManager, TenantUtil tenantUtil, DbContextManager<FilesDbContext> dbContextManager, SetupInfo setupInfo, IOptionsMonitor<ILog> monitor, FileUtility fileUtility) : base(serviceProvider, userManager, tenantManager, tenantUtil, dbContextManager, setupInfo, monitor, fileUtility)
{
}
public void SetShare(FileShareRecord r)
{
}
public IEnumerable<FileShareRecord> GetShares(IEnumerable<Guid> subjects)
{
return null;
}
public IEnumerable<FileShareRecord> GetShares(IEnumerable<FileEntry<string>> entry)
{
return null;
}
public IEnumerable<FileShareRecord> GetShares(FileEntry<string> entry)
{
return null;
}
public void RemoveSubject(Guid subject)
{
}
public IEnumerable<FileShareRecord> GetPureShareRecords(IEnumerable<FileEntry<string>> entries)
{
return null;
}
public IEnumerable<FileShareRecord> GetPureShareRecords(FileEntry<string> entry)
{
return null;
}
public void DeleteShareRecords(IEnumerable<FileShareRecord> records)
{
}
public bool IsShared(object entryId, FileEntryType type)
{
throw new NotImplementedException();
}
}
}

View File

@ -25,9 +25,6 @@
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using ASC.Common;
using ASC.Common.Logging;
@ -49,147 +46,5 @@ namespace ASC.Files.Thirdparty.Dropbox
public DropboxTagDao(IServiceProvider serviceProvider, UserManager userManager, TenantManager tenantManager, TenantUtil tenantUtil, DbContextManager<FilesDbContext> dbContextManager, SetupInfo setupInfo, IOptionsMonitor<ILog> monitor, FileUtility fileUtility) : base(serviceProvider, userManager, tenantManager, tenantUtil, dbContextManager, setupInfo, monitor, fileUtility)
{
}
#region ITagDao Members
public IEnumerable<Tag> GetTags(Guid subject, TagType tagType, IEnumerable<FileEntry<string>> fileEntries)
{
return null;
}
public IEnumerable<Tag> GetTags(TagType tagType, IEnumerable<FileEntry<string>> fileEntries)
{
return null;
}
public IEnumerable<Tag> GetTags(Guid owner, TagType tagType)
{
return null;
}
public IEnumerable<Tag> GetTags(string name, TagType tagType)
{
return null;
}
public IEnumerable<Tag> GetTags(string[] names, TagType tagType)
{
return null;
}
public IEnumerable<Tag> GetNewTags(Guid subject, Folder<string> parentFolder, bool deepSearch)
{
var folderId = DaoSelector.ConvertId(parentFolder.ID);
var fakeFolderId = parentFolder.ID.ToString();
var entryIDs = FilesDbContext.ThirdpartyIdMapping
.Where(r => r.Id.StartsWith(fakeFolderId))
.Select(r => r.HashId)
.ToList();
if (!entryIDs.Any()) return new List<Tag>();
var q = FilesDbContext.Tag
.Join(FilesDbContext.TagLink.DefaultIfEmpty(),
r => new TagLink { TenantId = r.TenantId, Id = r.Id },
r => new TagLink { TenantId = r.TenantId, Id = r.TagId },
(tag, tagLink) => new { tag, tagLink },
new TagLinkComparer())
.Where(r => r.tag.TenantId == TenantID)
.Where(r => r.tag.Flag == TagType.New)
.Where(r => r.tagLink.TenantId == TenantID)
.Where(r => entryIDs.Any(a => a == r.tagLink.EntryId));
if (subject != Guid.Empty)
{
q = q.Where(r => r.tag.Owner == subject);
}
var tags = q
.ToList()
.Select(r => new Tag
{
TagName = r.tag.Name,
TagType = r.tag.Flag,
Owner = r.tag.Owner,
EntryId = MappingID(r.tagLink.EntryId),
EntryType = r.tagLink.EntryType,
Count = r.tagLink.TagCount,
Id = r.tag.Id
});
if (deepSearch) return tags;
var folderFileIds = new[] { fakeFolderId }
.Concat(GetChildren(folderId));
return tags.Where(tag => folderFileIds.Contains(tag.EntryId.ToString()));
}
public IEnumerable<Tag> GetNewTags(Guid subject, IEnumerable<FileEntry<string>> fileEntries)
{
return null;
}
public IEnumerable<Tag> GetNewTags(Guid subject, FileEntry<string> fileEntry)
{
return null;
}
public IEnumerable<Tag> SaveTags(IEnumerable<Tag> tag)
{
return null;
}
public IEnumerable<Tag> SaveTags(Tag tag)
{
return null;
}
public void UpdateNewTags(IEnumerable<Tag> tag)
{
}
public void UpdateNewTags(Tag tag)
{
}
public void RemoveTags(IEnumerable<Tag> tag)
{
}
public void RemoveTags(Tag tag)
{
}
public IEnumerable<Tag> GetTags(string entryID, FileEntryType entryType, TagType tagType)
{
return null;
}
public void MarkAsNew(Guid subject, FileEntry<string> fileEntry)
{
}
#endregion
}
public class TagLink
{
public int TenantId { get; set; }
public int Id { get; set; }
}
public class TagLinkComparer : IEqualityComparer<TagLink>
{
public bool Equals([AllowNull] TagLink x, [AllowNull] TagLink y)
{
return x.Id == y.Id && x.TenantId == y.TenantId;
}
public int GetHashCode([DisallowNull] TagLink obj)
{
return obj.Id.GetHashCode() + obj.TenantId.GetHashCode();
}
}
}

View File

@ -226,7 +226,7 @@ namespace ASC.Files.Thirdparty.GoogleDrive
}
}
protected IEnumerable<string> GetChildren(object folderId)
protected override IEnumerable<string> GetChildren(string folderId)
{
return GetDriveEntries(folderId).Select(entry => MakeId(entry.Id));
}

View File

@ -37,10 +37,8 @@ using ASC.Core.Tenants;
using ASC.Files.Core;
using ASC.Files.Core.EF;
using ASC.Files.Core.Resources;
using ASC.Files.Core.Security;
using ASC.Files.Core.Thirdparty;
using ASC.Web.Core.Files;
using ASC.Web.Files.Services.DocumentService;
using ASC.Web.Studio.Core;
using Microsoft.Extensions.Options;
@ -593,64 +591,5 @@ namespace ASC.Files.Thirdparty.GoogleDrive
}
#endregion
#region Only in TMFileDao
public void ReassignFiles(string[] fileIds, Guid newOwnerId)
{
}
public List<File<string>> GetFiles(string[] parentIds, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool searchInContent)
{
return new List<File<string>>();
}
public IEnumerable<File<string>> Search(string text, bool bunch)
{
return null;
}
public bool IsExistOnStorage(File<string> file)
{
return true;
}
public void SaveEditHistory(File<string> file, string changes, Stream differenceStream)
{
//Do nothing
}
public List<EditHistory> GetEditHistory(DocumentServiceHelper documentServiceHelper, string fileId, int fileVersion)
{
return null;
}
public Stream GetDifferenceStream(File<string> file)
{
return null;
}
public bool ContainChanges(string fileId, int fileVersion)
{
return false;
}
public string GetUniqFilePath(File<string> file, string fileTitle)
{
return null;
}
public IEnumerable<(File<int>, SmallShareRecord)> GetFeeds(int tenant, DateTime from, DateTime to)
{
throw new NotImplementedException();
}
public IEnumerable<int> GetTenantsWithFeeds(DateTime fromTime)
{
throw new NotImplementedException();
}
#endregion
}
}

View File

@ -36,7 +36,6 @@ using ASC.Core.Common.EF;
using ASC.Core.Tenants;
using ASC.Files.Core;
using ASC.Files.Core.EF;
using ASC.Files.Core.Security;
using ASC.Files.Core.Thirdparty;
using ASC.Web.Core.Files;
using ASC.Web.Studio.Core;
@ -427,99 +426,5 @@ namespace ASC.Files.Thirdparty.GoogleDrive
return chunkedUpload ? storageMaxUploadSize : Math.Min(storageMaxUploadSize, SetupInfo.AvailableFileSize);
}
#region Only for TMFolderDao
public void ReassignFolders(string[] folderIds, Guid newOwnerId)
{
}
public IEnumerable<Folder<string>> Search(string text, bool bunch)
{
return null;
}
public string GetFolderID(string module, string bunch, string data, bool createIfNotExists)
{
return null;
}
public IEnumerable<string> GetFolderIDs(string module, string bunch, IEnumerable<string> data, bool createIfNotExists)
{
return new List<string>();
}
public string GetFolderIDCommon(bool createIfNotExists)
{
return null;
}
public string GetFolderIDUser(bool createIfNotExists, Guid? userId)
{
return null;
}
public string GetFolderIDShare(bool createIfNotExists)
{
return null;
}
public string GetFolderIDRecent(bool createIfNotExists)
{
return null;
}
public string GetFolderIDFavorites(bool createIfNotExists)
{
return null;
}
public string GetFolderIDTemplates(bool createIfNotExists)
{
return null;
}
public string GetFolderIDPrivacy(bool createIfNotExists, Guid? userId)
{
return null;
}
public string GetFolderIDTrash(bool createIfNotExists, Guid? userId)
{
return null;
}
public string GetFolderIDPhotos(bool createIfNotExists)
{
return null;
}
public string GetFolderIDProjects(bool createIfNotExists)
{
return null;
}
public string GetBunchObjectID(string folderID)
{
return null;
}
public Dictionary<string, string> GetBunchObjectIDs(List<string> folderIDs)
{
return null;
}
public IEnumerable<(Folder<string>, SmallShareRecord)> GetFeeds(int tenant, DateTime from, DateTime to)
{
throw new NotImplementedException();
}
public IEnumerable<string> GetTenantsWithFeeds(DateTime fromTime)
{
throw new NotImplementedException();
}
#endregion
}
}

View File

@ -25,14 +25,12 @@
using System;
using System.Collections.Generic;
using ASC.Common;
using ASC.Common.Logging;
using ASC.Core;
using ASC.Core.Common.EF;
using ASC.Core.Tenants;
using ASC.Files.Core;
using ASC.Files.Core.EF;
using ASC.Files.Core.Security;
using ASC.Web.Core.Files;
@ -48,47 +46,5 @@ namespace ASC.Files.Thirdparty.GoogleDrive
public GoogleDriveSecurityDao(IServiceProvider serviceProvider, UserManager userManager, TenantManager tenantManager, TenantUtil tenantUtil, DbContextManager<FilesDbContext> dbContextManager, SetupInfo setupInfo, IOptionsMonitor<ILog> monitor, FileUtility fileUtility) : base(serviceProvider, userManager, tenantManager, tenantUtil, dbContextManager, setupInfo, monitor, fileUtility)
{
}
public void SetShare(FileShareRecord r)
{
}
public IEnumerable<FileShareRecord> GetShares(IEnumerable<Guid> subjects)
{
return null;
}
public IEnumerable<FileShareRecord> GetShares(IEnumerable<FileEntry<string>> entry)
{
return null;
}
public IEnumerable<FileShareRecord> GetShares(FileEntry<string> entry)
{
return null;
}
public void RemoveSubject(Guid subject)
{
}
public IEnumerable<FileShareRecord> GetPureShareRecords(IEnumerable<FileEntry<string>> entries)
{
return null;
}
public IEnumerable<FileShareRecord> GetPureShareRecords(FileEntry<string> entry)
{
return null;
}
public void DeleteShareRecords(IEnumerable<FileShareRecord> records)
{
}
public bool IsShared(object entryId, FileEntryType type)
{
throw new NotImplementedException();
}
}
}

View File

@ -25,8 +25,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using ASC.Common;
using ASC.Common.Logging;
@ -35,7 +33,6 @@ using ASC.Core.Common.EF;
using ASC.Core.Tenants;
using ASC.Files.Core;
using ASC.Files.Core.EF;
using ASC.Files.Thirdparty.Dropbox;
using ASC.Web.Core.Files;
using ASC.Web.Studio.Core;
@ -49,128 +46,5 @@ namespace ASC.Files.Thirdparty.GoogleDrive
public GoogleDriveTagDao(IServiceProvider serviceProvider, UserManager userManager, TenantManager tenantManager, TenantUtil tenantUtil, DbContextManager<FilesDbContext> dbContextManager, SetupInfo setupInfo, IOptionsMonitor<ILog> monitor, FileUtility fileUtility) : base(serviceProvider, userManager, tenantManager, tenantUtil, dbContextManager, setupInfo, monitor, fileUtility)
{
}
#region ITagDao Members
public IEnumerable<Tag> GetTags(Guid subject, TagType tagType, IEnumerable<FileEntry<string>> fileEntries)
{
return null;
}
public IEnumerable<Tag> GetTags(TagType tagType, IEnumerable<FileEntry<string>> fileEntries)
{
return null;
}
public IEnumerable<Tag> GetTags(Guid owner, TagType tagType)
{
return null;
}
public IEnumerable<Tag> GetTags(string name, TagType tagType)
{
return null;
}
public IEnumerable<Tag> GetTags(string[] names, TagType tagType)
{
return null;
}
public IEnumerable<Tag> GetNewTags(Guid subject, Folder<string> parentFolder, bool deepSearch)
{
var folderId = DaoSelector.ConvertId(parentFolder.ID);
var fakeFolderId = parentFolder.ID.ToString();
var entryIDs = FilesDbContext.ThirdpartyIdMapping
.Where(r => r.Id.StartsWith(fakeFolderId))
.Select(r => r.HashId)
.ToList();
if (!entryIDs.Any()) return new List<Tag>();
var q = FilesDbContext.Tag
.Join(FilesDbContext.TagLink.DefaultIfEmpty(),
r => new TagLink { TenantId = r.TenantId, Id = r.Id },
r => new TagLink { TenantId = r.TenantId, Id = r.TagId },
(tag, tagLink) => new { tag, tagLink },
new TagLinkComparer())
.Where(r => r.tag.TenantId == TenantID)
.Where(r => r.tag.Flag == TagType.New)
.Where(r => r.tagLink.TenantId == TenantID)
.Where(r => entryIDs.Any(a => a == r.tagLink.EntryId));
if (subject != Guid.Empty)
{
q = q.Where(r => r.tag.Owner == subject);
}
var tags = q
.ToList()
.Select(r => new Tag
{
TagName = r.tag.Name,
TagType = r.tag.Flag,
Owner = r.tag.Owner,
EntryId = MappingID(r.tagLink.EntryId),
EntryType = r.tagLink.EntryType,
Count = r.tagLink.TagCount,
Id = r.tag.Id
});
if (deepSearch) return tags;
var folderFileIds = new[] { fakeFolderId }
.Concat(GetChildren(folderId));
return tags.Where(tag => folderFileIds.Contains(tag.EntryId.ToString()));
}
public IEnumerable<Tag> GetNewTags(Guid subject, IEnumerable<FileEntry<string>> fileEntries)
{
return null;
}
public IEnumerable<Tag> GetNewTags(Guid subject, FileEntry<string> fileEntry)
{
return null;
}
public IEnumerable<Tag> SaveTags(IEnumerable<Tag> tag)
{
return null;
}
public IEnumerable<Tag> SaveTags(Tag tag)
{
return null;
}
public void UpdateNewTags(IEnumerable<Tag> tag)
{
}
public void UpdateNewTags(Tag tag)
{
}
public void RemoveTags(IEnumerable<Tag> tag)
{
}
public void RemoveTags(Tag tag)
{
}
public IEnumerable<Tag> GetTags(string entryID, FileEntryType entryType, TagType tagType)
{
return null;
}
public void MarkAsNew(Guid subject, FileEntry<string> fileEntry)
{
}
#endregion
}
}

View File

@ -1,4 +1,7 @@
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
@ -12,15 +15,172 @@ using ASC.Files.Core.Security;
using ASC.Files.Core.Thirdparty;
using ASC.Security.Cryptography;
using ASC.Web.Core.Files;
using ASC.Web.Files.Services.DocumentService;
using ASC.Web.Studio.Core;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
using FileShare = ASC.Files.Core.Security.FileShare;
namespace ASC.Files.Thirdparty
{
internal abstract class ThirdPartyProviderDao<T> : IDisposable where T : class, IProviderInfo
internal abstract class ThirdPartyProviderDao
{
#region FileDao
public void ReassignFiles(string[] fileIds, Guid newOwnerId)
{
}
public List<File<string>> GetFiles(string[] parentIds, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool searchInContent)
{
return new List<File<string>>();
}
public IEnumerable<File<string>> Search(string text, bool bunch)
{
return null;
}
public bool IsExistOnStorage(File<string> file)
{
return true;
}
public void SaveEditHistory(File<string> file, string changes, Stream differenceStream)
{
//Do nothing
}
public List<EditHistory> GetEditHistory(DocumentServiceHelper documentServiceHelper, string fileId, int fileVersion)
{
return null;
}
public Stream GetDifferenceStream(File<string> file)
{
return null;
}
public bool ContainChanges(string fileId, int fileVersion)
{
return false;
}
public string GetUniqFilePath(File<string> file, string fileTitle)
{
throw new NotImplementedException();
}
public IEnumerable<(File<int>, SmallShareRecord)> GetFeeds(int tenant, DateTime from, DateTime to)
{
throw new NotImplementedException();
}
public IEnumerable<int> GetTenantsWithFeeds(DateTime fromTime)
{
throw new NotImplementedException();
}
#endregion
#region FolderDao
public void ReassignFolders(string[] folderIds, Guid newOwnerId)
{
}
public IEnumerable<Folder<string>> SearchFolders(string text, bool bunch)
{
return null;
}
public string GetFolderID(string module, string bunch, string data, bool createIfNotExists)
{
return null;
}
public IEnumerable<string> GetFolderIDs(string module, string bunch, IEnumerable<string> data, bool createIfNotExists)
{
return new List<string>();
}
public string GetFolderIDCommon(bool createIfNotExists)
{
return null;
}
public string GetFolderIDUser(bool createIfNotExists, Guid? userId)
{
return null;
}
public string GetFolderIDShare(bool createIfNotExists)
{
return null;
}
public string GetFolderIDRecent(bool createIfNotExists)
{
return null;
}
public string GetFolderIDFavorites(bool createIfNotExists)
{
return null;
}
public string GetFolderIDTemplates(bool createIfNotExists)
{
return null;
}
public string GetFolderIDPrivacy(bool createIfNotExists, Guid? userId)
{
return null;
}
public string GetFolderIDTrash(bool createIfNotExists, Guid? userId)
{
return null;
}
public string GetFolderIDPhotos(bool createIfNotExists)
{
return null;
}
public string GetFolderIDProjects(bool createIfNotExists)
{
return null;
}
public string GetBunchObjectID(string folderID)
{
return null;
}
public Dictionary<string, string> GetBunchObjectIDs(List<string> folderIDs)
{
return null;
}
public IEnumerable<(Folder<string>, SmallShareRecord)> GetFeedsForFolders(int tenant, DateTime from, DateTime to)
{
throw new NotImplementedException();
}
public IEnumerable<string> GetTenantsWithFeedsForFolders(DateTime fromTime)
{
throw new NotImplementedException();
}
#endregion
}
internal abstract class ThirdPartyProviderDao<T> : ThirdPartyProviderDao, IDisposable where T : class, IProviderInfo
{
public int TenantID { get; private set; }
protected IServiceProvider ServiceProvider { get; }
@ -165,8 +325,183 @@ namespace ASC.Files.Thirdparty
fileEntry.Error = entry.Error;
}
protected abstract string MakeId(string path = null);
#region SecurityDao
public void SetShare(FileShareRecord r)
{
}
public IEnumerable<FileShareRecord> GetShares(IEnumerable<Guid> subjects)
{
return null;
}
public IEnumerable<FileShareRecord> GetShares(IEnumerable<FileEntry<string>> entry)
{
return null;
}
public IEnumerable<FileShareRecord> GetShares(FileEntry<string> entry)
{
return null;
}
public void RemoveSubject(Guid subject)
{
}
public IEnumerable<FileShareRecord> GetPureShareRecords(IEnumerable<FileEntry<string>> entries)
{
return null;
}
public IEnumerable<FileShareRecord> GetPureShareRecords(FileEntry<string> entry)
{
return null;
}
public void DeleteShareRecords(IEnumerable<FileShareRecord> records)
{
}
public bool IsShared(object entryId, FileEntryType type)
{
throw new NotImplementedException();
}
#endregion
#region TagDao
public IEnumerable<Tag> GetTags(Guid subject, TagType tagType, IEnumerable<FileEntry<string>> fileEntries)
{
return new List<Tag>();
}
public IEnumerable<Tag> GetTags(TagType tagType, IEnumerable<FileEntry<string>> fileEntries)
{
return new List<Tag>();
}
public IEnumerable<Tag> GetTags(Guid owner, TagType tagType)
{
return new List<Tag>();
}
public IEnumerable<Tag> GetTags(string name, TagType tagType)
{
return new List<Tag>();
}
public IEnumerable<Tag> GetTags(string[] names, TagType tagType)
{
return new List<Tag>();
}
public IEnumerable<Tag> GetNewTags(Guid subject, IEnumerable<FileEntry<string>> fileEntries)
{
return new List<Tag>();
}
public IEnumerable<Tag> GetNewTags(Guid subject, FileEntry<string> fileEntry)
{
return new List<Tag>();
}
public IEnumerable<Tag> SaveTags(IEnumerable<Tag> tag)
{
return new List<Tag>();
}
public IEnumerable<Tag> SaveTags(Tag tag)
{
return new List<Tag>();
}
public void UpdateNewTags(IEnumerable<Tag> tag)
{
}
public void UpdateNewTags(Tag tag)
{
}
public void RemoveTags(IEnumerable<Tag> tag)
{
}
public void RemoveTags(Tag tag)
{
}
public IEnumerable<Tag> GetTags(string entryID, FileEntryType entryType, TagType tagType)
{
return new List<Tag>();
}
public void MarkAsNew(Guid subject, FileEntry<string> fileEntry)
{
}
public IEnumerable<Tag> GetNewTags(Guid subject, Folder<string> parentFolder, bool deepSearch)
{
var folderId = DaoSelector.ConvertId(parentFolder.ID);
var entryIDs = FilesDbContext.ThirdpartyIdMapping
.Where(r => r.Id.StartsWith(parentFolder.ID))
.Select(r => r.HashId)
.ToList();
if (!entryIDs.Any()) return new List<Tag>();
var q = FilesDbContext.Tag
.Join(FilesDbContext.TagLink.DefaultIfEmpty(),
r => new TagLink { TenantId = r.TenantId, Id = r.Id },
r => new TagLink { TenantId = r.TenantId, Id = r.TagId },
(tag, tagLink) => new { tag, tagLink },
new TagLinkComparer())
.Where(r => r.tag.TenantId == TenantID)
.Where(r => r.tag.Flag == TagType.New)
.Where(r => r.tagLink.TenantId == TenantID)
.Where(r => entryIDs.Any(a => a == r.tagLink.EntryId));
if (subject != Guid.Empty)
{
q = q.Where(r => r.tag.Owner == subject);
}
var tags = q
.ToList()
.Select(r => new Tag
{
TagName = r.tag.Name,
TagType = r.tag.Flag,
Owner = r.tag.Owner,
EntryId = MappingID(r.tagLink.EntryId),
EntryType = r.tagLink.EntryType,
Count = r.tagLink.TagCount,
Id = r.tag.Id
});
if (deepSearch) return tags;
var folderFileIds = new[] { parentFolder.ID }
.Concat(GetChildren(folderId));
return tags.Where(tag => folderFileIds.Contains(tag.EntryId.ToString()));
}
protected abstract IEnumerable<string> GetChildren(string folderId);
#endregion
public void Dispose()
{
if (ProviderInfo != null)
@ -189,4 +524,23 @@ namespace ASC.Files.Thirdparty
ErrorId = errorId;
}
}
public class TagLink
{
public int TenantId { get; set; }
public int Id { get; set; }
}
public class TagLinkComparer : IEqualityComparer<TagLink>
{
public bool Equals([AllowNull] TagLink x, [AllowNull] TagLink y)
{
return x.Id == y.Id && x.TenantId == y.TenantId;
}
public int GetHashCode([DisallowNull] TagLink obj)
{
return obj.Id.GetHashCode() + obj.TenantId.GetHashCode();
}
}
}

View File

@ -202,7 +202,7 @@ namespace ASC.Files.Thirdparty.OneDrive
}
}
protected IEnumerable<string> GetChildren(string folderId)
protected override IEnumerable<string> GetChildren(string folderId)
{
return GetOneDriveItems(folderId).Select(entry => MakeId(entry.Id));
}

View File

@ -37,10 +37,8 @@ using ASC.Core.Tenants;
using ASC.Files.Core;
using ASC.Files.Core.EF;
using ASC.Files.Core.Resources;
using ASC.Files.Core.Security;
using ASC.Files.Core.Thirdparty;
using ASC.Web.Core.Files;
using ASC.Web.Files.Services.DocumentService;
using ASC.Web.Studio.Core;
using Microsoft.Extensions.Options;
@ -594,64 +592,5 @@ namespace ASC.Files.Thirdparty.OneDrive
}
#endregion
#region Only in TMFileDao
public void ReassignFiles(string[] fileIds, Guid newOwnerId)
{
}
public List<File<string>> GetFiles(string[] parentIds, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool searchInContent)
{
return new List<File<string>>();
}
public IEnumerable<File<string>> Search(string text, bool bunch)
{
return null;
}
public bool IsExistOnStorage(File<string> file)
{
return true;
}
public void SaveEditHistory(File<string> file, string changes, Stream differenceStream)
{
//Do nothing
}
public List<EditHistory> GetEditHistory(DocumentServiceHelper documentServiceHelper, string fileId, int fileVersion)
{
return null;
}
public Stream GetDifferenceStream(File<string> file)
{
return null;
}
public bool ContainChanges(string fileId, int fileVersion)
{
return false;
}
public string GetUniqFilePath(File<string> file, string fileTitle)
{
throw new NotImplementedException();
}
public IEnumerable<(File<int>, SmallShareRecord)> GetFeeds(int tenant, DateTime from, DateTime to)
{
throw new NotImplementedException();
}
public IEnumerable<int> GetTenantsWithFeeds(DateTime fromTime)
{
throw new NotImplementedException();
}
#endregion
}
}

View File

@ -36,7 +36,6 @@ using ASC.Core.Common.EF;
using ASC.Core.Tenants;
using ASC.Files.Core;
using ASC.Files.Core.EF;
using ASC.Files.Core.Security;
using ASC.Files.Core.Thirdparty;
using ASC.Web.Core.Files;
using ASC.Web.Studio.Core;
@ -438,99 +437,5 @@ namespace ASC.Files.Thirdparty.OneDrive
return chunkedUpload ? storageMaxUploadSize : Math.Min(storageMaxUploadSize, SetupInfo.AvailableFileSize);
}
#region Only for TMFolderDao
public void ReassignFolders(string[] folderIds, Guid newOwnerId)
{
}
public IEnumerable<Folder<string>> Search(string text, bool bunch)
{
return null;
}
public string GetFolderID(string module, string bunch, string data, bool createIfNotExists)
{
return null;
}
public IEnumerable<string> GetFolderIDs(string module, string bunch, IEnumerable<string> data, bool createIfNotExists)
{
return new List<string>();
}
public string GetFolderIDCommon(bool createIfNotExists)
{
return null;
}
public string GetFolderIDUser(bool createIfNotExists, Guid? userId)
{
return null;
}
public string GetFolderIDShare(bool createIfNotExists)
{
return null;
}
public string GetFolderIDRecent(bool createIfNotExists)
{
return null;
}
public string GetFolderIDFavorites(bool createIfNotExists)
{
return null;
}
public string GetFolderIDTemplates(bool createIfNotExists)
{
return null;
}
public string GetFolderIDPrivacy(bool createIfNotExists, Guid? userId)
{
return null;
}
public string GetFolderIDTrash(bool createIfNotExists, Guid? userId)
{
return null;
}
public string GetFolderIDPhotos(bool createIfNotExists)
{
return null;
}
public string GetFolderIDProjects(bool createIfNotExists)
{
return null;
}
public string GetBunchObjectID(string folderID)
{
return null;
}
public Dictionary<string, string> GetBunchObjectIDs(List<string> folderIDs)
{
return null;
}
public IEnumerable<(Folder<string>, SmallShareRecord)> GetFeeds(int tenant, DateTime from, DateTime to)
{
throw new NotImplementedException();
}
public IEnumerable<string> GetTenantsWithFeeds(DateTime fromTime)
{
throw new NotImplementedException();
}
#endregion
}
}

View File

@ -25,14 +25,12 @@
using System;
using System.Collections.Generic;
using ASC.Common;
using ASC.Common.Logging;
using ASC.Core;
using ASC.Core.Common.EF;
using ASC.Core.Tenants;
using ASC.Files.Core;
using ASC.Files.Core.EF;
using ASC.Files.Core.Security;
using ASC.Web.Core.Files;
@ -48,47 +46,5 @@ namespace ASC.Files.Thirdparty.OneDrive
public OneDriveSecurityDao(IServiceProvider serviceProvider, UserManager userManager, TenantManager tenantManager, TenantUtil tenantUtil, DbContextManager<FilesDbContext> dbContextManager, SetupInfo setupInfo, IOptionsMonitor<ILog> monitor, FileUtility fileUtility) : base(serviceProvider, userManager, tenantManager, tenantUtil, dbContextManager, setupInfo, monitor, fileUtility)
{
}
public void SetShare(FileShareRecord r)
{
}
public IEnumerable<FileShareRecord> GetShares(IEnumerable<Guid> subjects)
{
return null;
}
public IEnumerable<FileShareRecord> GetShares(IEnumerable<FileEntry<string>> entry)
{
return null;
}
public IEnumerable<FileShareRecord> GetShares(FileEntry<string> entry)
{
return null;
}
public void RemoveSubject(Guid subject)
{
}
public IEnumerable<FileShareRecord> GetPureShareRecords(IEnumerable<FileEntry<string>> entries)
{
return null;
}
public IEnumerable<FileShareRecord> GetPureShareRecords(FileEntry<string> entry)
{
return null;
}
public void DeleteShareRecords(IEnumerable<FileShareRecord> records)
{
}
public bool IsShared(object entryId, FileEntryType type)
{
throw new NotImplementedException();
}
}
}

View File

@ -25,8 +25,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using ASC.Common;
using ASC.Common.Logging;
@ -35,7 +33,6 @@ using ASC.Core.Common.EF;
using ASC.Core.Tenants;
using ASC.Files.Core;
using ASC.Files.Core.EF;
using ASC.Files.Thirdparty.Dropbox;
using ASC.Web.Core.Files;
using ASC.Web.Studio.Core;
@ -49,128 +46,5 @@ namespace ASC.Files.Thirdparty.OneDrive
public OneDriveTagDao(IServiceProvider serviceProvider, UserManager userManager, TenantManager tenantManager, TenantUtil tenantUtil, DbContextManager<FilesDbContext> dbContextManager, SetupInfo setupInfo, IOptionsMonitor<ILog> monitor, FileUtility fileUtility) : base(serviceProvider, userManager, tenantManager, tenantUtil, dbContextManager, setupInfo, monitor, fileUtility)
{
}
#region ITagDao Members
public IEnumerable<Tag> GetTags(Guid subject, TagType tagType, IEnumerable<FileEntry<string>> fileEntries)
{
return null;
}
public IEnumerable<Tag> GetTags(TagType tagType, IEnumerable<FileEntry<string>> fileEntries)
{
return null;
}
public IEnumerable<Tag> GetTags(Guid owner, TagType tagType)
{
return null;
}
public IEnumerable<Tag> GetTags(string name, TagType tagType)
{
return null;
}
public IEnumerable<Tag> GetTags(string[] names, TagType tagType)
{
return null;
}
public IEnumerable<Tag> GetNewTags(Guid subject, Folder<string> parentFolder, bool deepSearch)
{
var folderId = DaoSelector.ConvertId(parentFolder.ID);
var fakeFolderId = parentFolder.ID.ToString();
var entryIDs = FilesDbContext.ThirdpartyIdMapping
.Where(r => r.Id.StartsWith(fakeFolderId))
.Select(r => r.HashId)
.ToList();
if (!entryIDs.Any()) return new List<Tag>();
var q = FilesDbContext.Tag
.Join(FilesDbContext.TagLink.DefaultIfEmpty(),
r => new TagLink { TenantId = r.TenantId, Id = r.Id },
r => new TagLink { TenantId = r.TenantId, Id = r.TagId },
(tag, tagLink) => new { tag, tagLink },
new TagLinkComparer())
.Where(r => r.tag.TenantId == TenantID)
.Where(r => r.tag.Flag == TagType.New)
.Where(r => r.tagLink.TenantId == TenantID)
.Where(r => entryIDs.Any(a => a == r.tagLink.EntryId));
if (subject != Guid.Empty)
{
q = q.Where(r => r.tag.Owner == subject);
}
var tags = q
.ToList()
.Select(r => new Tag
{
TagName = r.tag.Name,
TagType = r.tag.Flag,
Owner = r.tag.Owner,
EntryId = MappingID(r.tagLink.EntryId),
EntryType = r.tagLink.EntryType,
Count = r.tagLink.TagCount,
Id = r.tag.Id
});
if (deepSearch) return tags;
var folderFileIds = new[] { fakeFolderId }
.Concat(GetChildren(folderId));
return tags.Where(tag => folderFileIds.Contains(tag.EntryId.ToString()));
}
public IEnumerable<Tag> GetNewTags(Guid subject, IEnumerable<FileEntry<string>> fileEntries)
{
return null;
}
public IEnumerable<Tag> GetNewTags(Guid subject, FileEntry<string> fileEntry)
{
return null;
}
public IEnumerable<Tag> SaveTags(IEnumerable<Tag> tag)
{
return null;
}
public IEnumerable<Tag> SaveTags(Tag tag)
{
return null;
}
public void UpdateNewTags(IEnumerable<Tag> tag)
{
}
public void UpdateNewTags(Tag tag)
{
}
public void RemoveTags(IEnumerable<Tag> tag)
{
}
public void RemoveTags(Tag tag)
{
}
public IEnumerable<Tag> GetTags(string entryID, FileEntryType entryType, TagType tagType)
{
return null;
}
public void MarkAsNew(Guid subject, FileEntry<string> fileEntry)
{
}
#endregion
}
}

View File

@ -28,6 +28,9 @@ using System;
using System.Collections.Generic;
using System.Linq;
using AppLimit.CloudComputing.SharpBox;
using AppLimit.CloudComputing.SharpBox.StorageProvider.DropBox;
using ASC.Common;
using ASC.Common.Logging;
using ASC.Core;
@ -48,6 +51,7 @@ using ASC.Files.Thirdparty.SharePoint;
using ASC.Files.Thirdparty.Sharpbox;
using ASC.Security.Cryptography;
using ASC.Web.Files.Classes;
using ASC.Web.Files.Helpers;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
@ -85,6 +89,7 @@ namespace ASC.Files.Thirdparty
private InstanceCrypto InstanceCrypto { get; }
private SecurityContext SecurityContext { get; }
private ConsumerFactory ConsumerFactory { get; }
private ThirdpartyConfiguration ThirdpartyConfiguration { get; }
public ProviderAccountDao(
IServiceProvider serviceProvider,
@ -93,6 +98,7 @@ namespace ASC.Files.Thirdparty
InstanceCrypto instanceCrypto,
SecurityContext securityContext,
ConsumerFactory consumerFactory,
ThirdpartyConfiguration thirdpartyConfiguration,
DbContextManager<FilesDbContext> dbContextManager,
IOptionsMonitor<ILog> options)
{
@ -104,6 +110,7 @@ namespace ASC.Files.Thirdparty
InstanceCrypto = instanceCrypto;
SecurityContext = securityContext;
ConsumerFactory = consumerFactory;
ThirdpartyConfiguration = thirdpartyConfiguration;
}
public virtual IProviderInfo GetProviderInfo(int linkId)
@ -475,83 +482,78 @@ namespace ASC.Files.Thirdparty
private AuthData GetEncodedAccesToken(AuthData authData, ProviderTypes provider)
{
string code;
OAuth20Token token;
switch (provider)
{
//case ProviderTypes.GoogleDrive:
// var code = authData.Token;
// var token = OAuth20TokenHelper.GetAccessToken<GoogleLoginProvider>(code);
// if (token == null) throw new UnauthorizedAccessException(string.Format(FilesCommonResource.ErrorMassage_SecurityException_Auth, provider));
// return new AuthData(token: token.ToJson());
//case ProviderTypes.Box:
// code = authData.Token;
// token = OAuth20TokenHelper.GetAccessToken<BoxLoginProvider>(code);
// if (token == null) throw new UnauthorizedAccessException(string.Format(FilesCommonResource.ErrorMassage_SecurityException_Auth, provider));
// return new AuthData(token: token.ToJson());
case ProviderTypes.DropboxV2:
var code = authData.Token;
var token = OAuth20TokenHelper.GetAccessToken<DropboxLoginProvider>(ConsumerFactory, code);
case ProviderTypes.GoogleDrive:
code = authData.Token;
token = OAuth20TokenHelper.GetAccessToken<GoogleLoginProvider>(ConsumerFactory, code);
if (token == null) throw new UnauthorizedAccessException(string.Format(FilesCommonResource.ErrorMassage_SecurityException_Auth, provider));
return new AuthData(token: token.ToJson());
//case ProviderTypes.DropBox:
case ProviderTypes.Box:
code = authData.Token;
token = OAuth20TokenHelper.GetAccessToken<BoxLoginProvider>(ConsumerFactory, code);
// var dropBoxRequestToken = DropBoxRequestToken.Parse(authData.Token);
if (token == null) throw new UnauthorizedAccessException(string.Format(FilesCommonResource.ErrorMassage_SecurityException_Auth, provider));
// var config = CloudStorage.GetCloudConfigurationEasy(nSupportedCloudConfigurations.DropBox);
// var accessToken = DropBoxStorageProviderTools.ExchangeDropBoxRequestTokenIntoAccessToken(config as DropBoxConfiguration,
// ThirdpartyConfiguration.DropboxAppKey,
// ThirdpartyConfiguration.DropboxAppSecret,
// dropBoxRequestToken);
return new AuthData(token: token.ToJson());
// var base64Token = new CloudStorage().SerializeSecurityTokenToBase64Ex(accessToken, config.GetType(), new Dictionary<string, string>());
case ProviderTypes.DropboxV2:
code = authData.Token;
token = OAuth20TokenHelper.GetAccessToken<DropboxLoginProvider>(ConsumerFactory, code);
// return new AuthData(token: base64Token);
if (token == null) throw new UnauthorizedAccessException(string.Format(FilesCommonResource.ErrorMassage_SecurityException_Auth, provider));
//case ProviderTypes.OneDrive:
return new AuthData(token: token.ToJson());
// code = authData.Token;
case ProviderTypes.DropBox:
// token = OAuth20TokenHelper.GetAccessToken<OneDriveLoginProvider>(code);
var dropBoxRequestToken = DropBoxRequestToken.Parse(authData.Token);
// if (token == null) throw new UnauthorizedAccessException(string.Format(FilesCommonResource.ErrorMassage_SecurityException_Auth, provider));
var config = CloudStorage.GetCloudConfigurationEasy(nSupportedCloudConfigurations.DropBox);
var accessToken = DropBoxStorageProviderTools.ExchangeDropBoxRequestTokenIntoAccessToken(config as DropBoxConfiguration,
ThirdpartyConfiguration.DropboxAppKey,
ThirdpartyConfiguration.DropboxAppSecret,
dropBoxRequestToken);
// return new AuthData(token: token.ToJson());
var base64Token = new CloudStorage().SerializeSecurityTokenToBase64Ex(accessToken, config.GetType(), new Dictionary<string, string>());
//case ProviderTypes.SkyDrive:
return new AuthData(token: base64Token);
// code = authData.Token;
case ProviderTypes.OneDrive:
code = authData.Token;
token = OAuth20TokenHelper.GetAccessToken<OneDriveLoginProvider>(ConsumerFactory, code);
// token = OAuth20TokenHelper.GetAccessToken<OneDriveLoginProvider>(code);
if (token == null) throw new UnauthorizedAccessException(string.Format(FilesCommonResource.ErrorMassage_SecurityException_Auth, provider));
// if (token == null) throw new UnauthorizedAccessException(string.Format(FilesCommonResource.ErrorMassage_SecurityException_Auth, provider));
return new AuthData(token: token.ToJson());
// accessToken = AppLimit.CloudComputing.SharpBox.Common.Net.oAuth20.OAuth20Token.FromJson(token.ToJson());
case ProviderTypes.SkyDrive:
// if (accessToken == null) throw new UnauthorizedAccessException(string.Format(FilesCommonResource.ErrorMassage_SecurityException_Auth, provider));
code = authData.Token;
// config = CloudStorage.GetCloudConfigurationEasy(nSupportedCloudConfigurations.SkyDrive);
// var storage = new CloudStorage();
// base64Token = storage.SerializeSecurityTokenToBase64Ex(accessToken, config.GetType(), new Dictionary<string, string>());
token = OAuth20TokenHelper.GetAccessToken<OneDriveLoginProvider>(ConsumerFactory, code);
// return new AuthData(token: base64Token);
if (token == null) throw new UnauthorizedAccessException(string.Format(FilesCommonResource.ErrorMassage_SecurityException_Auth, provider));
//case ProviderTypes.SharePoint:
//case ProviderTypes.WebDav:
// break;
accessToken = AppLimit.CloudComputing.SharpBox.Common.Net.oAuth20.OAuth20Token.FromJson(token.ToJson());
if (accessToken == null) throw new UnauthorizedAccessException(string.Format(FilesCommonResource.ErrorMassage_SecurityException_Auth, provider));
config = CloudStorage.GetCloudConfigurationEasy(nSupportedCloudConfigurations.SkyDrive);
var storage = new CloudStorage();
base64Token = storage.SerializeSecurityTokenToBase64Ex(accessToken, config.GetType(), new Dictionary<string, string>());
return new AuthData(token: base64Token);
case ProviderTypes.SharePoint:
case ProviderTypes.WebDav:
break;
default:
authData.Url = null;

View File

@ -44,7 +44,7 @@ using Microsoft.Extensions.DependencyInjection;
namespace ASC.Files.Thirdparty.ProviderDao
{
internal class ProviderDaoBase : IDisposable
internal class ProviderDaoBase : ThirdPartyProviderDao, IDisposable
{
private readonly List<IDaoSelector> Selectors;
@ -152,11 +152,10 @@ namespace ASC.Files.Thirdparty.ProviderDao
protected Folder<int> PerformCrossDaoFolderCopy(string fromFolderId, int toRootFolderId, bool deleteSourceFolder, CancellationToken? cancellationToken)
{
var fromSelector = GetSelector(fromFolderId);
using var scope = ServiceProvider.CreateScope();
return CrossDao.PerformCrossDaoFolderCopy(
fromFolderId, fromSelector.GetFolderDao(fromFolderId), fromSelector.GetFileDao(fromFolderId), fromSelector.ConvertId,
toRootFolderId, scope.ServiceProvider.GetService<FolderDao>(), scope.ServiceProvider.GetService<IFileDao<int>>(), r => r,
toRootFolderId, ServiceProvider.GetService<IFolderDao<int>>(), ServiceProvider.GetService<IFileDao<int>>(), r => r,
deleteSourceFolder, cancellationToken);
}

View File

@ -33,9 +33,7 @@ using ASC.Common;
using ASC.Core;
using ASC.Files.Core;
using ASC.Files.Core.Data;
using ASC.Files.Core.Security;
using ASC.Files.Core.Thirdparty;
using ASC.Web.Files.Services.DocumentService;
namespace ASC.Files.Thirdparty.ProviderDao
{
@ -463,63 +461,5 @@ namespace ASC.Files.Thirdparty.ProviderDao
}
#endregion
#region Only in TMFileDao
public void ReassignFiles(string[] fileIds, Guid newOwnerId)
{
}
public List<File<string>> GetFiles(string[] parentIds, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool searchInContent)
{
return new List<File<string>>();
}
public IEnumerable<File<string>> Search(string text, bool bunch)
{
return null;
}
public bool IsExistOnStorage(File<string> file)
{
return true;
}
public void SaveEditHistory(File<string> file, string changes, Stream differenceStream)
{
//Do nothing
}
public List<EditHistory> GetEditHistory(DocumentServiceHelper documentServiceHelper, string fileId, int fileVersion)
{
return null;
}
public Stream GetDifferenceStream(File<string> file)
{
return null;
}
public bool ContainChanges(string fileId, int fileVersion)
{
return false;
}
public string GetUniqFilePath(File<string> file, string fileTitle)
{
throw new NotImplementedException();
}
public IEnumerable<(File<int>, SmallShareRecord)> GetFeeds(int tenant, DateTime from, DateTime to)
{
throw new NotImplementedException();
}
public IEnumerable<int> GetTenantsWithFeeds(DateTime fromTime)
{
throw new NotImplementedException();
}
#endregion
}
}

View File

@ -33,7 +33,6 @@ using ASC.Common;
using ASC.Core;
using ASC.Files.Core;
using ASC.Files.Core.Data;
using ASC.Files.Core.Security;
using ASC.Files.Core.Thirdparty;
namespace ASC.Files.Thirdparty.ProviderDao
@ -350,100 +349,5 @@ filterType, subjectGroup, subjectID, searchText, searchSubfolders, checkShare);
return storageMaxUploadSize;
}
#region Only for TMFolderDao
public void ReassignFolders(string[] folderIds, Guid newOwnerId)
{
throw new NotImplementedException();
}
public IEnumerable<Folder<string>> Search(string text, bool bunch)
{
throw new NotImplementedException();
}
public string GetFolderID(string module, string bunch, string data, bool createIfNotExists)
{
throw new NotImplementedException();
}
public IEnumerable<string> GetFolderIDs(string module, string bunch, IEnumerable<string> data, bool createIfNotExists)
{
throw new NotImplementedException();
}
public string GetFolderIDCommon(bool createIfNotExists)
{
throw new NotImplementedException();
}
public string GetFolderIDProjects(bool createIfNotExists)
{
throw new NotImplementedException();
}
public string GetFolderIDPhotos(bool createIfNotExists)
{
throw new NotImplementedException();
}
public string GetBunchObjectID(string folderID)
{
throw new NotImplementedException();
}
public Dictionary<string, string> GetBunchObjectIDs(List<string> folderIDs)
{
throw new NotImplementedException();
}
public string GetFolderIDUser(bool createIfNotExists, Guid? userId = null)
{
throw new NotImplementedException();
}
public string GetFolderIDShare(bool createIfNotExists)
{
throw new NotImplementedException();
}
public string GetFolderIDRecent(bool createIfNotExists)
{
throw new NotImplementedException();
}
public string GetFolderIDFavorites(bool createIfNotExists)
{
throw new NotImplementedException();
}
public string GetFolderIDTemplates(bool createIfNotExists)
{
throw new NotImplementedException();
}
public string GetFolderIDPrivacy(bool createIfNotExists, Guid? userId = null)
{
throw new NotImplementedException();
}
public string GetFolderIDTrash(bool createIfNotExists, Guid? userId = null)
{
throw new NotImplementedException();
}
public IEnumerable<(Folder<string>, SmallShareRecord)> GetFeeds(int tenant, DateTime from, DateTime to)
{
throw new NotImplementedException();
}
public IEnumerable<string> GetTenantsWithFeeds(DateTime fromTime)
{
throw new NotImplementedException();
}
#endregion
}
}

View File

@ -25,6 +25,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
@ -144,5 +145,12 @@ namespace ASC.Files.Thirdparty.SharePoint
{
return path;
}
protected override IEnumerable<string> GetChildren(string folderId)
{
var subFolders = ProviderInfo.GetFolderFolders(folderId).Select(x => ProviderInfo.MakeId(x.ServerRelativeUrl));
var files = ProviderInfo.GetFolderFiles(folderId).Select(x => ProviderInfo.MakeId(x.ServerRelativeUrl));
return subFolders.Concat(files);
}
}
}

View File

@ -37,10 +37,8 @@ using ASC.Core.Tenants;
using ASC.Files.Core;
using ASC.Files.Core.EF;
using ASC.Files.Core.Resources;
using ASC.Files.Core.Security;
using ASC.Files.Core.Thirdparty;
using ASC.Web.Core.Files;
using ASC.Web.Files.Services.DocumentService;
using ASC.Web.Studio.Core;
using Microsoft.Extensions.Options;
@ -428,63 +426,5 @@ namespace ASC.Files.Thirdparty.SharePoint
return file;
}
#region Only in TMFileDao
public void ReassignFiles(string[] fileIds, Guid newOwnerId)
{
}
public List<File<string>> GetFiles(string[] parentIds, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool searchInContent)
{
return new List<File<string>>();
}
public IEnumerable<File<string>> Search(string text, bool bunch)
{
return null;
}
public bool IsExistOnStorage(File<string> file)
{
return true;
}
public void SaveEditHistory(File<string> file, string changes, Stream differenceStream)
{
//Do nothing
}
public List<EditHistory> GetEditHistory(DocumentServiceHelper documentServiceHelper, string fileId, int fileVersion)
{
return null;
}
public Stream GetDifferenceStream(File<string> file)
{
return null;
}
public bool ContainChanges(string fileId, int fileVersion)
{
return false;
}
public string GetUniqFilePath(File<string> file, string fileTitle)
{
throw new NotImplementedException();
}
public IEnumerable<(File<int>, SmallShareRecord)> GetFeeds(int tenant, DateTime from, DateTime to)
{
throw new NotImplementedException();
}
public IEnumerable<int> GetTenantsWithFeeds(DateTime fromTime)
{
throw new NotImplementedException();
}
#endregion
}
}

View File

@ -36,7 +36,6 @@ using ASC.Core.Common.EF;
using ASC.Core.Tenants;
using ASC.Files.Core;
using ASC.Files.Core.EF;
using ASC.Files.Core.Security;
using ASC.Files.Core.Thirdparty;
using ASC.Web.Core.Files;
using ASC.Web.Studio.Core;
@ -387,100 +386,5 @@ namespace ASC.Files.Thirdparty.SharePoint
{
return 2L * 1024L * 1024L * 1024L;
}
#region Only for TMFolderDao
public void ReassignFolders(string[] folderIds, Guid newOwnerId)
{
}
public IEnumerable<Folder<string>> Search(string text, bool bunch)
{
return null;
}
public string GetFolderID(string module, string bunch, string data, bool createIfNotExists)
{
return null;
}
public IEnumerable<string> GetFolderIDs(string module, string bunch, IEnumerable<string> data,
bool createIfNotExists)
{
return new List<string>();
}
public string GetFolderIDCommon(bool createIfNotExists)
{
return null;
}
public string GetFolderIDUser(bool createIfNotExists, Guid? userId)
{
return null;
}
public string GetFolderIDShare(bool createIfNotExists)
{
return null;
}
public string GetFolderIDRecent(bool createIfNotExists)
{
throw new NotImplementedException();
}
public string GetFolderIDFavorites(bool createIfNotExists)
{
throw new NotImplementedException();
}
public string GetFolderIDTemplates(bool createIfNotExists)
{
throw new NotImplementedException();
}
public string GetFolderIDPrivacy(bool createIfNotExists, Guid? userId = null)
{
throw new NotImplementedException();
}
public string GetFolderIDTrash(bool createIfNotExists, Guid? userId)
{
return null;
}
public string GetFolderIDPhotos(bool createIfNotExists)
{
return null;
}
public string GetFolderIDProjects(bool createIfNotExists)
{
return null;
}
public string GetBunchObjectID(string folderID)
{
return null;
}
public Dictionary<string, string> GetBunchObjectIDs(List<string> folderIDs)
{
return null;
}
public IEnumerable<(Folder<string>, SmallShareRecord)> GetFeeds(int tenant, DateTime from, DateTime to)
{
throw new NotImplementedException();
}
public IEnumerable<string> GetTenantsWithFeeds(DateTime fromTime)
{
throw new NotImplementedException();
}
#endregion
}
}

View File

@ -25,14 +25,12 @@
using System;
using System.Collections.Generic;
using ASC.Common;
using ASC.Common.Logging;
using ASC.Core;
using ASC.Core.Common.EF;
using ASC.Core.Tenants;
using ASC.Files.Core;
using ASC.Files.Core.EF;
using ASC.Files.Core.Security;
using ASC.Web.Core.Files;
@ -48,47 +46,5 @@ namespace ASC.Files.Thirdparty.SharePoint
public SharePointSecurityDao(IServiceProvider serviceProvider, UserManager userManager, TenantManager tenantManager, TenantUtil tenantUtil, DbContextManager<FilesDbContext> dbContextManager, SetupInfo setupInfo, IOptionsMonitor<ILog> monitor, FileUtility fileUtility) : base(serviceProvider, userManager, tenantManager, tenantUtil, dbContextManager, setupInfo, monitor, fileUtility)
{
}
public void SetShare(FileShareRecord r)
{
}
public IEnumerable<FileShareRecord> GetShares(IEnumerable<Guid> subjects)
{
return null;
}
public IEnumerable<FileShareRecord> GetShares(IEnumerable<FileEntry<string>> entry)
{
return null;
}
public IEnumerable<FileShareRecord> GetShares(FileEntry<string> entry)
{
return null;
}
public void RemoveSubject(Guid subject)
{
}
public IEnumerable<FileShareRecord> GetPureShareRecords(IEnumerable<FileEntry<string>> entries)
{
return null;
}
public IEnumerable<FileShareRecord> GetPureShareRecords(FileEntry<string> entry)
{
return null;
}
public void DeleteShareRecords(IEnumerable<FileShareRecord> records)
{
}
public bool IsShared(object entryId, FileEntryType type)
{
throw new NotImplementedException();
}
}
}

View File

@ -25,8 +25,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using ASC.Common;
using ASC.Common.Logging;
@ -35,7 +33,6 @@ using ASC.Core.Common.EF;
using ASC.Core.Tenants;
using ASC.Files.Core;
using ASC.Files.Core.EF;
using ASC.Files.Thirdparty.Dropbox;
using ASC.Web.Core.Files;
using ASC.Web.Studio.Core;
@ -49,123 +46,5 @@ namespace ASC.Files.Thirdparty.SharePoint
public SharePointTagDao(IServiceProvider serviceProvider, UserManager userManager, TenantManager tenantManager, TenantUtil tenantUtil, DbContextManager<FilesDbContext> dbContextManager, SetupInfo setupInfo, IOptionsMonitor<ILog> monitor, FileUtility fileUtility) : base(serviceProvider, userManager, tenantManager, tenantUtil, dbContextManager, setupInfo, monitor, fileUtility)
{
}
public IEnumerable<Tag> GetTags(Guid subject, TagType tagType, IEnumerable<FileEntry<string>> fileEntries)
{
return null;
}
public IEnumerable<Tag> GetTags(TagType tagType, IEnumerable<FileEntry<string>> fileEntries)
{
return new List<Tag>();
}
public IEnumerable<Tag> GetTags(Guid owner, TagType tagType)
{
return new List<Tag>();
}
public IEnumerable<Tag> GetTags(string name, TagType tagType)
{
return new List<Tag>();
}
public IEnumerable<Tag> GetTags(string[] names, TagType tagType)
{
return new List<Tag>();
}
public IEnumerable<Tag> GetNewTags(Guid subject, Folder<string> parentFolder, bool deepSearch)
{
var folderId = DaoSelector.ConvertId(parentFolder.ID);
var fakeFolderId = parentFolder.ID.ToString();
var entryIDs = FilesDbContext.ThirdpartyIdMapping
.Where(r => r.Id.StartsWith(fakeFolderId))
.Select(r => r.HashId)
.ToList();
if (!entryIDs.Any()) return new List<Tag>();
var q = FilesDbContext.Tag
.Join(FilesDbContext.TagLink.DefaultIfEmpty(),
r => new TagLink { TenantId = r.TenantId, Id = r.Id },
r => new TagLink { TenantId = r.TenantId, Id = r.TagId },
(tag, tagLink) => new { tag, tagLink },
new TagLinkComparer())
.Where(r => r.tag.TenantId == TenantID)
.Where(r => r.tag.Flag == TagType.New)
.Where(r => r.tagLink.TenantId == TenantID)
.Where(r => entryIDs.Any(a => a == r.tagLink.EntryId));
if (subject != Guid.Empty)
{
q = q.Where(r => r.tag.Owner == subject);
}
var tags = q
.ToList()
.Select(r => new Tag
{
TagName = r.tag.Name,
TagType = r.tag.Flag,
Owner = r.tag.Owner,
EntryId = MappingID(r.tagLink.EntryId),
EntryType = r.tagLink.EntryType,
Count = r.tagLink.TagCount,
Id = r.tag.Id
});
if (deepSearch) return tags;
var folderFileIds = new[] { fakeFolderId }
.Concat(ProviderInfo.GetFolderFolders(folderId).Select(x => ProviderInfo.MakeId(x.ServerRelativeUrl)))
.Concat(ProviderInfo.GetFolderFiles(folderId).Select(x => ProviderInfo.MakeId(x.ServerRelativeUrl)));
return tags.Where(tag => folderFileIds.Contains(tag.EntryId.ToString()));
}
public IEnumerable<Tag> GetNewTags(Guid subject, IEnumerable<FileEntry<string>> fileEntries)
{
return new List<Tag>();
}
public IEnumerable<Tag> GetNewTags(Guid subject, FileEntry<string> fileEntry)
{
return new List<Tag>();
}
public IEnumerable<Tag> SaveTags(IEnumerable<Tag> tag)
{
return new List<Tag>();
}
public IEnumerable<Tag> SaveTags(Tag tag)
{
return new List<Tag>();
}
public void UpdateNewTags(IEnumerable<Tag> tag)
{
}
public void UpdateNewTags(Tag tag)
{
}
public void RemoveTags(IEnumerable<Tag> tag)
{
}
public void RemoveTags(Tag tag)
{
}
public IEnumerable<Tag> GetTags(string entryID, FileEntryType entryType, TagType tagType)
{
return new List<Tag>();
}
}
}

View File

@ -451,6 +451,13 @@ namespace ASC.Files.Thirdparty.Sharpbox
return requestTitle;
}
protected override IEnumerable<string> GetChildren(string folderId)
{
var subFolders = GetFolderSubfolders(folderId).Select(x => MakeId(x));
var files = GetFolderFiles(folderId).Select(x => MakeId(x));
return subFolders.Concat(files);
}
private static string MatchEvaluator(Match match)
{
var index = Convert.ToInt32(match.Groups[2].Value);

View File

@ -42,10 +42,8 @@ using ASC.Core.Tenants;
using ASC.Files.Core;
using ASC.Files.Core.EF;
using ASC.Files.Core.Resources;
using ASC.Files.Core.Security;
using ASC.Files.Core.Thirdparty;
using ASC.Web.Core.Files;
using ASC.Web.Files.Services.DocumentService;
using ASC.Web.Studio.Core;
using Microsoft.Extensions.Options;
@ -650,63 +648,5 @@ namespace ASC.Files.Thirdparty.Sharpbox
}
#endregion
#region Only in TMFileDao
public void ReassignFiles(string[] fileIds, Guid newOwnerId)
{
}
public List<File<string>> GetFiles(string[] parentIds, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool searchInContent)
{
return new List<File<string>>();
}
public IEnumerable<File<string>> Search(string text, bool bunch)
{
return null;
}
public bool IsExistOnStorage(File<string> file)
{
return true;
}
public void SaveEditHistory(File<string> file, string changes, Stream differenceStream)
{
//Do nothing
}
public List<EditHistory> GetEditHistory(DocumentServiceHelper documentServiceHelper, string fileId, int fileVersion)
{
return null;
}
public Stream GetDifferenceStream(File<string> file)
{
return null;
}
public bool ContainChanges(string fileId, int fileVersion)
{
return false;
}
public string GetUniqFilePath(File<string> file, string fileTitle)
{
throw new NotImplementedException();
}
public IEnumerable<(File<int>, SmallShareRecord)> GetFeeds(int tenant, DateTime from, DateTime to)
{
throw new NotImplementedException();
}
public IEnumerable<int> GetTenantsWithFeeds(DateTime fromTime)
{
throw new NotImplementedException();
}
#endregion
}
}

View File

@ -41,7 +41,6 @@ using ASC.Core.Tenants;
using ASC.Files.Core;
using ASC.Files.Core.EF;
using ASC.Files.Core.Resources;
using ASC.Files.Core.Security;
using ASC.Files.Core.Thirdparty;
using ASC.Web.Core.Files;
using ASC.Web.Studio.Core;
@ -457,98 +456,5 @@ namespace ASC.Files.Thirdparty.Sharpbox
return chunkedUpload ? storageMaxUploadSize : Math.Min(storageMaxUploadSize, SetupInfo.AvailableFileSize);
}
#region Only for TMFolderDao
public void ReassignFolders(string[] folderIds, Guid newOwnerId)
{
}
public IEnumerable<Folder<string>> Search(string text, bool bunch)
{
return null;
}
public string GetFolderID(string module, string bunch, string data, bool createIfNotExists)
{
return null;
}
public IEnumerable<string> GetFolderIDs(string module, string bunch, IEnumerable<string> data, bool createIfNotExists)
{
return new List<string>();
}
public string GetFolderIDCommon(bool createIfNotExists)
{
return null;
}
public string GetFolderIDUser(bool createIfNotExists, Guid? userId)
{
return null;
}
public string GetFolderIDShare(bool createIfNotExists)
{
return null;
}
public string GetFolderIDRecent(bool createIfNotExists)
{
throw new NotImplementedException();
}
public string GetFolderIDFavorites(bool createIfNotExists)
{
throw new NotImplementedException();
}
public string GetFolderIDTemplates(bool createIfNotExists)
{
throw new NotImplementedException();
}
public string GetFolderIDPrivacy(bool createIfNotExists, Guid? userId = null)
{
throw new NotImplementedException();
}
public string GetFolderIDTrash(bool createIfNotExists, Guid? userId)
{
return null;
}
public string GetFolderIDPhotos(bool createIfNotExists)
{
return null;
}
public string GetFolderIDProjects(bool createIfNotExists)
{
return null;
}
public string GetBunchObjectID(string folderID)
{
return null;
}
public Dictionary<string, string> GetBunchObjectIDs(List<string> folderIDs)
{
return null;
}
public IEnumerable<(Folder<string>, SmallShareRecord)> GetFeeds(int tenant, DateTime from, DateTime to)
{
throw new NotImplementedException();
}
public IEnumerable<string> GetTenantsWithFeeds(DateTime fromTime)
{
throw new NotImplementedException();
}
#endregion
}
}

View File

@ -25,14 +25,12 @@
using System;
using System.Collections.Generic;
using ASC.Common;
using ASC.Common.Logging;
using ASC.Core;
using ASC.Core.Common.EF;
using ASC.Core.Tenants;
using ASC.Files.Core;
using ASC.Files.Core.EF;
using ASC.Files.Core.Security;
using ASC.Web.Core.Files;
@ -48,47 +46,5 @@ namespace ASC.Files.Thirdparty.Sharpbox
public SharpBoxSecurityDao(IServiceProvider serviceProvider, UserManager userManager, TenantManager tenantManager, TenantUtil tenantUtil, DbContextManager<FilesDbContext> dbContextManager, SetupInfo setupInfo, IOptionsMonitor<ILog> monitor, FileUtility fileUtility) : base(serviceProvider, userManager, tenantManager, tenantUtil, dbContextManager, setupInfo, monitor, fileUtility)
{
}
public void SetShare(FileShareRecord r)
{
}
public IEnumerable<FileShareRecord> GetShares(IEnumerable<Guid> subjects)
{
return null;
}
public IEnumerable<FileShareRecord> GetShares(IEnumerable<FileEntry<string>> entry)
{
return null;
}
public IEnumerable<FileShareRecord> GetShares(FileEntry<string> entry)
{
return null;
}
public void RemoveSubject(Guid subject)
{
}
public IEnumerable<FileShareRecord> GetPureShareRecords(IEnumerable<FileEntry<string>> entries)
{
return null;
}
public IEnumerable<FileShareRecord> GetPureShareRecords(FileEntry<string> entry)
{
return null;
}
public void DeleteShareRecords(IEnumerable<FileShareRecord> records)
{
}
public bool IsShared(object entryId, FileEntryType type)
{
throw new NotImplementedException();
}
}
}

View File

@ -25,8 +25,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using ASC.Common;
using ASC.Common.Logging;
@ -35,7 +33,6 @@ using ASC.Core.Common.EF;
using ASC.Core.Tenants;
using ASC.Files.Core;
using ASC.Files.Core.EF;
using ASC.Files.Thirdparty.Dropbox;
using ASC.Web.Core.Files;
using ASC.Web.Studio.Core;
@ -49,131 +46,5 @@ namespace ASC.Files.Thirdparty.Sharpbox
public SharpBoxTagDao(IServiceProvider serviceProvider, UserManager userManager, TenantManager tenantManager, TenantUtil tenantUtil, DbContextManager<FilesDbContext> dbContextManager, SetupInfo setupInfo, IOptionsMonitor<ILog> monitor, FileUtility fileUtility) : base(serviceProvider, userManager, tenantManager, tenantUtil, dbContextManager, setupInfo, monitor, fileUtility)
{
}
#region ITagDao Members
public IEnumerable<Tag> GetTags(Guid subject, TagType tagType, IEnumerable<FileEntry<string>> fileEntries)
{
return null;
}
public IEnumerable<Tag> GetTags(TagType tagType, IEnumerable<FileEntry<string>> fileEntries)
{
return null;
}
public IEnumerable<Tag> GetTags(Guid owner, TagType tagType)
{
return null;
}
public IEnumerable<Tag> GetTags(string name, TagType tagType)
{
return null;
}
public IEnumerable<Tag> GetTags(string[] names, TagType tagType)
{
return null;
}
public IEnumerable<Tag> GetNewTags(Guid subject, Folder<string> parentFolder, bool deepSearch)
{
var folderId = DaoSelector.ConvertId(parentFolder.ID);
var fakeFolderId = parentFolder.ID.ToString();
var entryIDs = FilesDbContext.ThirdpartyIdMapping
.Where(r => r.Id.StartsWith(fakeFolderId))
.Select(r => r.HashId)
.ToList();
if (!entryIDs.Any()) return new List<Tag>();
var q = FilesDbContext.Tag
.Join(FilesDbContext.TagLink.DefaultIfEmpty(),
r => new TagLink { TenantId = r.TenantId, Id = r.Id },
r => new TagLink { TenantId = r.TenantId, Id = r.TagId },
(tag, tagLink) => new { tag, tagLink },
new TagLinkComparer())
.Where(r => r.tag.TenantId == TenantID)
.Where(r => r.tag.Flag == TagType.New)
.Where(r => r.tagLink.TenantId == TenantID)
.Where(r => entryIDs.Any(a => a == r.tagLink.EntryId));
if (subject != Guid.Empty)
{
q = q.Where(r => r.tag.Owner == subject);
}
var tags = q
.ToList()
.Select(r => new Tag
{
TagName = r.tag.Name,
TagType = r.tag.Flag,
Owner = r.tag.Owner,
EntryId = MappingID(r.tagLink.EntryId),
EntryType = r.tagLink.EntryType,
Count = r.tagLink.TagCount,
Id = r.tag.Id
});
if (deepSearch) return tags;
var folderFileIds = new[] { fakeFolderId }
.Concat(GetFolderSubfolders(folderId).Select(x => MakeId(x)))
.Concat(GetFolderFiles(folderId).Select(x => MakeId(x)));
return tags.Where(tag => folderFileIds.Contains(tag.EntryId.ToString()));
}
public IEnumerable<Tag> GetNewTags(Guid subject, IEnumerable<FileEntry<string>> fileEntries)
{
return null;
}
public IEnumerable<Tag> GetNewTags(Guid subject, FileEntry<string> fileEntry)
{
return null;
}
public IEnumerable<Tag> SaveTags(IEnumerable<Tag> tag)
{
return null;
}
public IEnumerable<Tag> SaveTags(Tag tag)
{
return null;
}
public void UpdateNewTags(IEnumerable<Tag> tag)
{
}
public void UpdateNewTags(Tag tag)
{
}
public void RemoveTags(IEnumerable<Tag> tag)
{
}
public void RemoveTags(Tag tag)
{
}
public IEnumerable<Tag> GetTags(string entryID, FileEntryType entryType, TagType tagType)
{
return null;
}
public void MarkAsNew(Guid subject, FileEntry<string> fileEntry)
{
}
#endregion
}
}

View File

@ -41,7 +41,6 @@ namespace ASC.Web.Files.Helpers
public class ThirdpartyConfiguration
{
private IConfiguration Configuration { get; }
private IDaoFactory DaoFactory { get; }
private Lazy<BoxLoginProvider> BoxLoginProvider { get; }
private Lazy<DropboxLoginProvider> DropboxLoginProvider { get; }
private Lazy<OneDriveLoginProvider> OneDriveLoginProvider { get; }
@ -50,11 +49,9 @@ namespace ASC.Web.Files.Helpers
public ThirdpartyConfiguration(
IConfiguration configuration,
IDaoFactory daoFactory,
ConsumerFactory consumerFactory)
{
Configuration = configuration;
DaoFactory = daoFactory;
BoxLoginProvider = new Lazy<BoxLoginProvider>(() => consumerFactory.Get<BoxLoginProvider>());
DropboxLoginProvider = new Lazy<DropboxLoginProvider>(() => consumerFactory.Get<DropboxLoginProvider>());
OneDriveLoginProvider = new Lazy<OneDriveLoginProvider>(() => consumerFactory.Get<OneDriveLoginProvider>());
@ -67,16 +64,13 @@ namespace ASC.Web.Files.Helpers
get { return (Configuration.GetSection("files:thirdparty:enable").Get<string[]>() ?? new string[] { }).ToList(); }
}
public bool SupportInclusion
public bool SupportInclusion(IDaoFactory daoFactory)
{
get
{
var providerDao = DaoFactory.ProviderDao;
var providerDao = daoFactory.ProviderDao;
if (providerDao == null) return false;
return SupportBoxInclusion || SupportDropboxInclusion || SupportDocuSignInclusion || SupportGoogleDriveInclusion || SupportOneDriveInclusion || SupportSharePointInclusion || SupportWebDavInclusion || SupportNextcloudInclusion || SupportOwncloudInclusion || SupportkDriveInclusion || SupportYandexInclusion;
}
}
public bool SupportBoxInclusion
{

View File

@ -107,9 +107,9 @@ namespace ASC.Web.Files.Configuration
var security = FileSecurity;
IEnumerable<Folder<int>> result;
var folderDao = DaoFactory.GetFolderDao<int>();
result = folderDao.Search(text).Where(security.CanRead);
result = folderDao.SearchFolders(text).Where(security.CanRead);
if (ThirdpartyConfiguration.SupportInclusion
if (ThirdpartyConfiguration.SupportInclusion(DaoFactory)
&& FilesSettingsHelper.EnableThirdParty)
{
var id = GlobalFolderHelper.FolderMy;

View File

@ -42,7 +42,7 @@ namespace ASC.Api.Documents
{
/// <summary>
/// </summary>
public List<FileWrapper<T>> Files { get; set; }
public List<FileEntryWrapper> Files { get; set; }
/// <summary>
/// </summary>
@ -87,7 +87,7 @@ namespace ASC.Api.Documents
return new FolderContentWrapper<int>
{
Current = FolderWrapper<int>.GetSample(),
Files = new List<FileWrapper<int>>(new[] { FileWrapper<int>.GetSample(), FileWrapper<int>.GetSample() }),
Files = new List<FileEntryWrapper>(new[] { FileWrapper<int>.GetSample(), FileWrapper<int>.GetSample() }),
Folders = new List<FileEntryWrapper>(new[] { FolderWrapper<int>.GetSample(), FolderWrapper<int>.GetSample() }),
PathParts = new
{
@ -120,7 +120,24 @@ namespace ASC.Api.Documents
{
var result = new FolderContentWrapper<T>
{
Files = folderItems.Entries.OfType<File<T>>().Select(FileWrapperHelper.Get).ToList(),
Files = folderItems.Entries
.Where(r => r.FileEntryType == FileEntryType.File)
.Select(r =>
{
FileEntryWrapper wrapper = null;
if (r is File<int> fol1)
{
wrapper = FileWrapperHelper.Get(fol1);
}
if (r is File<string> fol2)
{
wrapper = FileWrapperHelper.Get(fol2);
}
return wrapper;
}
)
.ToList(),
Folders = folderItems.Entries
.Where(r => r.FileEntryType == FileEntryType.Folder)
.Select(r =>

View File

@ -372,7 +372,7 @@ namespace ASC.Web.Files.Utils
else if (parent.FolderType == FolderType.SHARE)
{
//share
var shared = (IEnumerable<FileEntry<T>>)fileSecurity.GetSharesForMe<T>(filter, subjectGroup, subjectId, searchText, searchInContent, withSubfolders);
var shared = fileSecurity.GetSharesForMe(filter, subjectGroup, subjectId, searchText, searchInContent, withSubfolders);
entries = entries.Concat(shared);
@ -497,7 +497,7 @@ namespace ASC.Web.Files.Utils
var folderList = new List<Folder<string>>();
if ((parent.ID.Equals(GlobalFolderHelper.FolderMy) || parent.ID.Equals(GlobalFolderHelper.FolderCommon))
&& ThirdpartyConfiguration.SupportInclusion
&& ThirdpartyConfiguration.SupportInclusion(DaoFactory)
&& (FilesSettingsHelper.EnableThirdParty
|| CoreBaseSettings.Personal))
{

View File

@ -78,12 +78,12 @@ namespace ASC.Files.Service.Core
public override IEnumerable<int> GetTenantsWithFeeds(DateTime fromTime)
{
return FolderDao.GetTenantsWithFeeds(fromTime);
return FolderDao.GetTenantsWithFeedsForFolders(fromTime);
}
public override IEnumerable<Tuple<Feed.Aggregator.Feed, object>> GetFeeds(FeedFilter filter)
{
var folders = FolderDao.GetFeeds(filter.Tenant, filter.Time.From, filter.Time.To)
var folders = FolderDao.GetFeedsForFolders(filter.Tenant, filter.Time.From, filter.Time.To)
.Where(f => f.Item1.RootFolderType != FolderType.TRASH && f.Item1.RootFolderType != FolderType.BUNCH)
.ToList();