diff --git a/products/ASC.Files/Core/ApiModels/RequestDto/CreateRoomRequestDto.cs b/products/ASC.Files/Core/ApiModels/RequestDto/CreateRoomRequestDto.cs index c299b6fa45..dc88c7a53a 100644 --- a/products/ASC.Files/Core/ApiModels/RequestDto/CreateRoomRequestDto.cs +++ b/products/ASC.Files/Core/ApiModels/RequestDto/CreateRoomRequestDto.cs @@ -43,6 +43,14 @@ public enum RoomFilterType ReadOnlyRoomOnly = 4, CustomRoomOnly = 5, FoldersOnly = 6, + BoxOnly = 7, + DropboxV2Only = 8, + GoogleDriveOnly = 9, + OneDriveOnly = 10, + SharePointOnly = 11, + WebDavOnly = 12, + kDriveOnly = 13, + YandexOnly = 14, } public class CreateRoomRequestDto diff --git a/products/ASC.Files/Core/Core/Dao/TeamlabDao/DaoFactory.cs b/products/ASC.Files/Core/Core/Dao/TeamlabDao/DaoFactory.cs index 84f1ccb47c..1ff06b4851 100644 --- a/products/ASC.Files/Core/Core/Dao/TeamlabDao/DaoFactory.cs +++ b/products/ASC.Files/Core/Core/Dao/TeamlabDao/DaoFactory.cs @@ -9,7 +9,7 @@ // // This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty // of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see -// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html +// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.htm // // You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021. // diff --git a/products/ASC.Files/Core/Core/Dao/TeamlabDao/FolderDao.cs b/products/ASC.Files/Core/Core/Dao/TeamlabDao/FolderDao.cs index 1777df47f5..061edcf6de 100644 --- a/products/ASC.Files/Core/Core/Dao/TeamlabDao/FolderDao.cs +++ b/products/ASC.Files/Core/Core/Dao/TeamlabDao/FolderDao.cs @@ -1566,7 +1566,15 @@ internal class FolderDao : AbstractDao, IFolderDao FilterType.PresentationsOnly or FilterType.SpreadsheetsOnly or FilterType.ArchiveOnly or - FilterType.MediaOnly; + FilterType.MediaOnly or + FilterType.BoxOnly or + FilterType.DropboxV2Only or + FilterType.GoogleDriveOnly or + FilterType.OneDriveOnly or + FilterType.SharePointOnly or + FilterType.WebDavOnly or + FilterType.kDriveOnly or + FilterType.YandexOnly; } private FolderType GetRoomTypeFilter(FilterType filterType) diff --git a/products/ASC.Files/Core/Core/FilterTypeEnum.cs b/products/ASC.Files/Core/Core/FilterTypeEnum.cs index 68f8072a3c..1e1c814d13 100644 --- a/products/ASC.Files/Core/Core/FilterTypeEnum.cs +++ b/products/ASC.Files/Core/Core/FilterTypeEnum.cs @@ -46,5 +46,13 @@ public enum FilterType [EnumMember] ReadOnlyRooms = 16, [EnumMember] CustomRooms = 17, [EnumMember] OFormTemplateOnly = 18, - [EnumMember] OFormOnly = 19, + [EnumMember] OFormOnly = 19, + [EnumMember] BoxOnly = 20, + [EnumMember] DropboxV2Only = 21, + [EnumMember] GoogleDriveOnly = 22, + [EnumMember] OneDriveOnly = 23, + [EnumMember] SharePointOnly = 24, + [EnumMember] WebDavOnly = 25, + [EnumMember] kDriveOnly = 26, + [EnumMember] YandexOnly = 27, } \ No newline at end of file diff --git a/products/ASC.Files/Core/Core/Thirdparty/Box/BoxFolderDao.cs b/products/ASC.Files/Core/Core/Thirdparty/Box/BoxFolderDao.cs index 4563300965..5de183b8d6 100644 --- a/products/ASC.Files/Core/Core/Thirdparty/Box/BoxFolderDao.cs +++ b/products/ASC.Files/Core/Core/Thirdparty/Box/BoxFolderDao.cs @@ -529,4 +529,10 @@ internal class BoxFolderDao : BoxDaoBase, IFolderDao return chunkedUpload ? storageMaxUploadSize : Math.Min(storageMaxUploadSize, _setupInfo.AvailableFileSize); } + + public override bool CheckInvalidFilter(FilterType filterType) + { + return base.CheckInvalidFilter(filterType) || filterType is FilterType.GoogleDriveOnly or FilterType.DropboxV2Only or FilterType.kDriveOnly or FilterType.SharePointOnly + or FilterType.YandexOnly or FilterType.WebDavOnly or FilterType.OneDriveOnly; + } } diff --git a/products/ASC.Files/Core/Core/Thirdparty/Dropbox/DropboxFolderDao.cs b/products/ASC.Files/Core/Core/Thirdparty/Dropbox/DropboxFolderDao.cs index 7e07c5b4a7..6acf436deb 100644 --- a/products/ASC.Files/Core/Core/Thirdparty/Dropbox/DropboxFolderDao.cs +++ b/products/ASC.Files/Core/Core/Thirdparty/Dropbox/DropboxFolderDao.cs @@ -519,4 +519,10 @@ internal class DropboxFolderDao : DropboxDaoBase, IFolderDao return chunkedUpload ? storageMaxUploadSize : Math.Min(storageMaxUploadSize, _setupInfo.AvailableFileSize); } + + public override bool CheckInvalidFilter(FilterType filterType) + { + return base.CheckInvalidFilter(filterType) || filterType is FilterType.BoxOnly or FilterType.GoogleDriveOnly or FilterType.kDriveOnly or FilterType.SharePointOnly + or FilterType.YandexOnly or FilterType.WebDavOnly or FilterType.OneDriveOnly; + } } diff --git a/products/ASC.Files/Core/Core/Thirdparty/GoogleDrive/GoogleDriveFolderDao.cs b/products/ASC.Files/Core/Core/Thirdparty/GoogleDrive/GoogleDriveFolderDao.cs index 2e7b8b9c06..142eaf9f9a 100644 --- a/products/ASC.Files/Core/Core/Thirdparty/GoogleDrive/GoogleDriveFolderDao.cs +++ b/products/ASC.Files/Core/Core/Thirdparty/GoogleDrive/GoogleDriveFolderDao.cs @@ -520,4 +520,10 @@ internal class GoogleDriveFolderDao : GoogleDriveDaoBase, IFolderDao return chunkedUpload ? storageMaxUploadSize : Math.Min(storageMaxUploadSize, _setupInfo.AvailableFileSize); } + + public override bool CheckInvalidFilter(FilterType filterType) + { + return base.CheckInvalidFilter(filterType) || filterType is FilterType.BoxOnly or FilterType.DropboxV2Only or FilterType.kDriveOnly or FilterType.SharePointOnly + or FilterType.YandexOnly or FilterType.WebDavOnly or FilterType.OneDriveOnly; + } } diff --git a/products/ASC.Files/Core/Core/Thirdparty/IThirdPartyProviderDao.cs b/products/ASC.Files/Core/Core/Thirdparty/IThirdPartyProviderDao.cs index 6490176de6..432c978ecc 100644 --- a/products/ASC.Files/Core/Core/Thirdparty/IThirdPartyProviderDao.cs +++ b/products/ASC.Files/Core/Core/Thirdparty/IThirdPartyProviderDao.cs @@ -466,7 +466,7 @@ internal abstract class ThirdPartyProviderDao : ThirdPartyProviderDao, IDispo return rooms; } - protected bool CheckInvalidFilter(FilterType filterType) + public virtual bool CheckInvalidFilter(FilterType filterType) { return filterType is FilterType.FilesOnly or diff --git a/products/ASC.Files/Core/Core/Thirdparty/OneDrive/OneDriveFolderDao.cs b/products/ASC.Files/Core/Core/Thirdparty/OneDrive/OneDriveFolderDao.cs index 4c2ee44d79..f806fb6b52 100644 --- a/products/ASC.Files/Core/Core/Thirdparty/OneDrive/OneDriveFolderDao.cs +++ b/products/ASC.Files/Core/Core/Thirdparty/OneDrive/OneDriveFolderDao.cs @@ -532,4 +532,10 @@ internal class OneDriveFolderDao : OneDriveDaoBase, IFolderDao return chunkedUpload ? storageMaxUploadSize : Math.Min(storageMaxUploadSize, _setupInfo.AvailableFileSize); } + + public override bool CheckInvalidFilter(FilterType filterType) + { + return base.CheckInvalidFilter(filterType) || filterType is FilterType.BoxOnly or FilterType.DropboxV2Only or FilterType.kDriveOnly or FilterType.SharePointOnly + or FilterType.YandexOnly or FilterType.WebDavOnly or FilterType.GoogleDriveOnly; + } } diff --git a/products/ASC.Files/Core/Core/Thirdparty/ProviderDao/ProviderFolderDao.cs b/products/ASC.Files/Core/Core/Thirdparty/ProviderDao/ProviderFolderDao.cs index d594c18641..99c3dc1c09 100644 --- a/products/ASC.Files/Core/Core/Thirdparty/ProviderDao/ProviderFolderDao.cs +++ b/products/ASC.Files/Core/Core/Thirdparty/ProviderDao/ProviderFolderDao.cs @@ -95,7 +95,8 @@ internal class ProviderFolderDao : ProviderDaoBase, IFolderDao var selector = GetSelector(parentId); var folderDao = selector.GetFolderDao(parentId); var rooms = folderDao.GetRoomsAsync(selector.ConvertId(parentId), filterType, tags, subjectId, searchText, withSubfolders, withoutTags, excludeSubject); - var result = await rooms.Where(r => r != null).ToListAsync(); + + var result = await FilterByProviders(rooms.Where(r => r != null), filterType).ToListAsync(); await SetSharedPropertyAsync(result); @@ -130,6 +131,8 @@ internal class ProviderFolderDao : ProviderDaoBase, IFolderDao .Where(r => r != null)); } + result = FilterByProviders(result, filterType); + return result.Distinct(); } @@ -435,4 +438,22 @@ internal class ProviderFolderDao : ProviderDaoBase, IFolderDao return storageMaxUploadSize; } + + private IAsyncEnumerable> FilterByProviders(IAsyncEnumerable> folders, FilterType filterType) + { + if (filterType != FilterType.WebDavOnly && filterType != FilterType.YandexOnly && filterType != FilterType.kDriveOnly) + { + return folders; + } + + var providerKey = filterType switch + { + FilterType.YandexOnly => ProviderTypes.Yandex.ToStringFast(), + FilterType.WebDavOnly => ProviderTypes.WebDav.ToStringFast(), + FilterType.kDriveOnly => ProviderTypes.kDrive.ToStringFast(), + _ => throw new NotImplementedException(), + }; + + return folders.Where(x => providerKey == x.ProviderKey); + } } diff --git a/products/ASC.Files/Core/Core/Thirdparty/SharePoint/SharePointFolderDao.cs b/products/ASC.Files/Core/Core/Thirdparty/SharePoint/SharePointFolderDao.cs index 482af24032..027bd20634 100644 --- a/products/ASC.Files/Core/Core/Thirdparty/SharePoint/SharePointFolderDao.cs +++ b/products/ASC.Files/Core/Core/Thirdparty/SharePoint/SharePointFolderDao.cs @@ -455,4 +455,10 @@ internal class SharePointFolderDao : SharePointDaoBase, IFolderDao { return Task.FromResult(2L * 1024L * 1024L * 1024L); } + + public override bool CheckInvalidFilter(FilterType filterType) + { + return base.CheckInvalidFilter(filterType) || filterType is FilterType.BoxOnly or FilterType.DropboxV2Only or FilterType.kDriveOnly or FilterType.GoogleDriveOnly + or FilterType.YandexOnly or FilterType.WebDavOnly or FilterType.OneDriveOnly; + } } diff --git a/products/ASC.Files/Core/Core/Thirdparty/Sharpbox/SharpBoxFolderDao.cs b/products/ASC.Files/Core/Core/Thirdparty/Sharpbox/SharpBoxFolderDao.cs index 8714e9e6ee..fc2374f9ad 100644 --- a/products/ASC.Files/Core/Core/Thirdparty/Sharpbox/SharpBoxFolderDao.cs +++ b/products/ASC.Files/Core/Core/Thirdparty/Sharpbox/SharpBoxFolderDao.cs @@ -521,4 +521,10 @@ internal class SharpBoxFolderDao : SharpBoxDaoBase, IFolderDao return Task.FromResult(chunkedUpload ? storageMaxUploadSize : Math.Min(storageMaxUploadSize, _setupInfo.AvailableFileSize)); } + + public override bool CheckInvalidFilter(FilterType filterType) + { + return base.CheckInvalidFilter(filterType) || filterType is FilterType.BoxOnly or FilterType.DropboxV2Only or FilterType.SharePointOnly + or FilterType.GoogleDriveOnly or FilterType.OneDriveOnly; + } } diff --git a/products/ASC.Files/Server/Api/VirtualRoomsController.cs b/products/ASC.Files/Server/Api/VirtualRoomsController.cs index c06bd309bb..0ff50ff466 100644 --- a/products/ASC.Files/Server/Api/VirtualRoomsController.cs +++ b/products/ASC.Files/Server/Api/VirtualRoomsController.cs @@ -670,6 +670,14 @@ public class VirtualRoomsCommonController : ApiControllerBase RoomFilterType.ReviewRoomOnly => FilterType.ReviewRooms, RoomFilterType.CustomRoomOnly => FilterType.CustomRooms, RoomFilterType.FoldersOnly => FilterType.FoldersOnly, + RoomFilterType.GoogleDriveOnly => FilterType.GoogleDriveOnly, + RoomFilterType.BoxOnly => FilterType.BoxOnly, + RoomFilterType.DropboxV2Only => FilterType.DropboxV2Only, + RoomFilterType.OneDriveOnly => FilterType.OneDriveOnly, + RoomFilterType.SharePointOnly => FilterType.SharePointOnly, + RoomFilterType.YandexOnly => FilterType.YandexOnly, + RoomFilterType.kDriveOnly => FilterType.kDriveOnly, + RoomFilterType.WebDavOnly => FilterType.WebDavOnly, _ => FilterType.None };