Files: added root folders filter

This commit is contained in:
Maksim Chegulov 2022-04-10 15:30:46 +03:00
parent e78253a6b9
commit 8292795d8c
4 changed files with 73 additions and 4 deletions

View File

@ -26,7 +26,7 @@
"test": true
},
"personal": false,
"docspace": false,
"docspace": true,
"products": {
"folder": "../../products",
"subfolder": "Server"

View File

@ -459,6 +459,11 @@ public class FileSecurity : IFileSecurity
// Templates folder read-only
continue;
}
if (folder.FolderType == FolderType.VirtualRooms)
{
continue;
}
}
if (isVisitor && e.ProviderEntry)

View File

@ -0,0 +1,61 @@
// (c) Copyright Ascensio System SIA 2010-2022
//
// This program is a free software product.
// You can redistribute it and/or modify it under the terms
// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software
// Foundation. In accordance with Section 7(a) of the GNU AGPL its Section 15 shall be amended
// to the effect that Ascensio System SIA expressly excludes the warranty of non-infringement of
// any third-party rights.
//
// 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
//
// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021.
//
// The interactive user interfaces in modified source and object code versions of the Program must
// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3.
//
// Pursuant to Section 7(b) of the License you must retain the original Product logo when
// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under
// trademark law for use of our trademarks.
//
// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
namespace ASC.Files.Api;
[ConstraintRoute("int")]
public class VirtulaRoomsControllerInternal : VirtualRoomsController<int>
{
public VirtulaRoomsControllerInternal(
FoldersControllerHelper<int> foldersControllerHelperInt,
GlobalFolderHelper globalFolderHelper)
: base(foldersControllerHelperInt, globalFolderHelper)
{
}
}
public class VirtualRoomsThirdparty
{
}
public class VirtualRoomsController<T> : ApiControllerBase
{
private readonly FoldersControllerHelper<int> _foldersControllerHelperInt;
private readonly GlobalFolderHelper _globalFolderHelper;
public VirtualRoomsController(FoldersControllerHelper<int> foldersControllerHelperInt, GlobalFolderHelper globalFolderHelper)
{
_foldersControllerHelperInt = foldersControllerHelperInt;
_globalFolderHelper = globalFolderHelper;
}
[Read("@virtualrooms")]
public async Task<FolderContentDto<int>> GetVirtualRoomsFolderAsync(bool withSubfolders)
{
return await _foldersControllerHelperInt.GetFolderAsync(await _globalFolderHelper.FolderVirtualRoomsAsync, Guid.Empty, FilterType.None, withSubfolders);
}
}

View File

@ -158,7 +158,8 @@ public class FoldersControllerHelper<T> : FilesHelperBase<T>
folders.Add(_globalFolderHelper.FolderMy);
}
if (!_coreBaseSettings.Personal && !_userManager.GetUsers(_securityContext.CurrentAccount.ID).IsOutsider(_userManager))
if (!_coreBaseSettings.Personal && !_coreBaseSettings.DocSpace
&& !_userManager.GetUsers(_securityContext.CurrentAccount.ID).IsOutsider(_userManager))
{
folders.Add(await _globalFolderHelper.FolderShareAsync);
}
@ -174,18 +175,20 @@ public class FoldersControllerHelper<T> : FilesHelperBase<T>
folders.Add(await _globalFolderHelper.FolderRecentAsync);
}
if (!_coreBaseSettings.Personal && PrivacyRoomSettings.IsAvailable(_tenantManager))
if (!_coreBaseSettings.Personal && !_coreBaseSettings.DocSpace
&& PrivacyRoomSettings.IsAvailable(_tenantManager))
{
folders.Add(await _globalFolderHelper.FolderPrivacyAsync);
}
}
if (!_coreBaseSettings.Personal)
if (!_coreBaseSettings.Personal && !_coreBaseSettings.DocSpace)
{
folders.Add(await _globalFolderHelper.FolderCommonAsync);
}
if (!IsVisitor
&& !_coreBaseSettings.DocSpace
&& !withoutAdditionalFolder
&& _fileUtility.ExtsWebTemplate.Count > 0
&& _filesSettingsHelper.TemplatesSection)