2022-03-15 18:00:53 +00:00
|
|
|
|
// (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
|
|
|
|
|
|
|
|
|
|
using Module = ASC.Api.Core.Module;
|
2022-03-03 18:15:48 +00:00
|
|
|
|
|
|
|
|
|
namespace ASC.Files.Api;
|
2022-03-03 17:33:11 +00:00
|
|
|
|
|
|
|
|
|
public class SettingsController : ApiControllerBase
|
|
|
|
|
{
|
|
|
|
|
private readonly FileStorageService<string> _fileStorageServiceString;
|
|
|
|
|
private readonly FilesSettingsHelper _filesSettingsHelper;
|
|
|
|
|
private readonly TenantManager _tenantManager;
|
|
|
|
|
private readonly ProductEntryPoint _productEntryPoint;
|
|
|
|
|
|
|
|
|
|
public SettingsController(
|
|
|
|
|
FileStorageService<string> fileStorageServiceString,
|
|
|
|
|
FilesSettingsHelper filesSettingsHelper,
|
|
|
|
|
TenantManager tenantManager,
|
2022-03-08 17:37:23 +00:00
|
|
|
|
ProductEntryPoint productEntryPoint)
|
2022-03-03 17:33:11 +00:00
|
|
|
|
{
|
|
|
|
|
_fileStorageServiceString = fileStorageServiceString;
|
|
|
|
|
_filesSettingsHelper = filesSettingsHelper;
|
|
|
|
|
_tenantManager = tenantManager;
|
|
|
|
|
_productEntryPoint = productEntryPoint;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="set"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[Update(@"thirdparty")]
|
2022-03-05 14:41:47 +00:00
|
|
|
|
public bool ChangeAccessToThirdpartyFromBody([FromBody] SettingsRequestDto inDto)
|
2022-03-03 17:33:11 +00:00
|
|
|
|
{
|
2022-03-05 14:41:47 +00:00
|
|
|
|
return _fileStorageServiceString.ChangeAccessToThirdparty(inDto.Set);
|
2022-03-03 17:33:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Update(@"thirdparty")]
|
|
|
|
|
[Consumes("application/x-www-form-urlencoded")]
|
2022-03-05 14:41:47 +00:00
|
|
|
|
public bool ChangeAccessToThirdpartyFromForm([FromForm] SettingsRequestDto inDto)
|
2022-03-03 17:33:11 +00:00
|
|
|
|
{
|
2022-03-05 14:41:47 +00:00
|
|
|
|
return _fileStorageServiceString.ChangeAccessToThirdparty(inDto.Set);
|
2022-03-03 17:33:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="set"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[Update(@"changedeleteconfrim")]
|
2022-03-05 14:41:47 +00:00
|
|
|
|
public bool ChangeDeleteConfrimFromBody([FromBody] SettingsRequestDto inDto)
|
2022-03-03 17:33:11 +00:00
|
|
|
|
{
|
2022-03-05 14:41:47 +00:00
|
|
|
|
return _fileStorageServiceString.ChangeDeleteConfrim(inDto.Set);
|
2022-03-03 17:33:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Update(@"changedeleteconfrim")]
|
|
|
|
|
[Consumes("application/x-www-form-urlencoded")]
|
2022-03-05 14:41:47 +00:00
|
|
|
|
public bool ChangeDeleteConfrimFromForm([FromForm] SettingsRequestDto inDto)
|
2022-03-03 17:33:11 +00:00
|
|
|
|
{
|
2022-03-05 14:41:47 +00:00
|
|
|
|
return _fileStorageServiceString.ChangeDeleteConfrim(inDto.Set);
|
2022-03-03 17:33:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="set"></param>
|
|
|
|
|
/// <category>Settings</category>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[Update(@"settings/downloadtargz")]
|
2022-03-05 14:41:47 +00:00
|
|
|
|
public ICompress ChangeDownloadZipFromBody([FromBody] DisplayRequestDto inDto)
|
2022-03-03 17:33:11 +00:00
|
|
|
|
{
|
2022-03-05 14:41:47 +00:00
|
|
|
|
return _fileStorageServiceString.ChangeDownloadTarGz(inDto.Set);
|
2022-03-03 17:33:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Update(@"settings/downloadtargz")]
|
2022-03-05 14:41:47 +00:00
|
|
|
|
public ICompress ChangeDownloadZipFromForm([FromForm] DisplayRequestDto inDto)
|
2022-03-03 17:33:11 +00:00
|
|
|
|
{
|
2022-03-05 14:41:47 +00:00
|
|
|
|
return _fileStorageServiceString.ChangeDownloadTarGz(inDto.Set);
|
2022-03-03 17:33:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Display favorite folder
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="set"></param>
|
|
|
|
|
/// <category>Settings</category>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[Update(@"settings/favorites")]
|
2022-03-05 14:41:47 +00:00
|
|
|
|
public bool DisplayFavoriteFromBody([FromBody] DisplayRequestDto inDto)
|
2022-03-03 17:33:11 +00:00
|
|
|
|
{
|
2022-03-05 14:41:47 +00:00
|
|
|
|
return _fileStorageServiceString.DisplayFavorite(inDto.Set);
|
2022-03-03 17:33:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Update(@"settings/favorites")]
|
|
|
|
|
[Consumes("application/x-www-form-urlencoded")]
|
2022-03-05 14:41:47 +00:00
|
|
|
|
public bool DisplayFavoriteFromForm([FromForm] DisplayRequestDto inDto)
|
2022-03-03 17:33:11 +00:00
|
|
|
|
{
|
2022-03-05 14:41:47 +00:00
|
|
|
|
return _fileStorageServiceString.DisplayFavorite(inDto.Set);
|
2022-03-03 17:33:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Display recent folder
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="set"></param>
|
|
|
|
|
/// <category>Settings</category>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[Update(@"displayRecent")]
|
2022-03-05 14:41:47 +00:00
|
|
|
|
public bool DisplayRecentFromBody([FromBody] DisplayRequestDto inDto)
|
2022-03-03 17:33:11 +00:00
|
|
|
|
{
|
2022-03-05 14:41:47 +00:00
|
|
|
|
return _fileStorageServiceString.DisplayRecent(inDto.Set);
|
2022-03-03 17:33:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Update(@"displayRecent")]
|
|
|
|
|
[Consumes("application/x-www-form-urlencoded")]
|
2022-03-05 14:41:47 +00:00
|
|
|
|
public bool DisplayRecentFromForm([FromForm] DisplayRequestDto inDto)
|
2022-03-03 17:33:11 +00:00
|
|
|
|
{
|
2022-03-05 14:41:47 +00:00
|
|
|
|
return _fileStorageServiceString.DisplayRecent(inDto.Set);
|
2022-03-03 17:33:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Display template folder
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="set"></param>
|
|
|
|
|
/// <category>Settings</category>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[Update(@"settings/templates")]
|
2022-03-05 14:41:47 +00:00
|
|
|
|
public bool DisplayTemplatesFromBody([FromBody] DisplayRequestDto inDto)
|
2022-03-03 17:33:11 +00:00
|
|
|
|
{
|
2022-03-05 14:41:47 +00:00
|
|
|
|
return _fileStorageServiceString.DisplayTemplates(inDto.Set);
|
2022-03-03 17:33:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Update(@"settings/templates")]
|
|
|
|
|
[Consumes("application/x-www-form-urlencoded")]
|
2022-03-05 14:41:47 +00:00
|
|
|
|
public bool DisplayTemplatesFromForm([FromForm] DisplayRequestDto inDto)
|
2022-03-03 17:33:11 +00:00
|
|
|
|
{
|
2022-03-05 14:41:47 +00:00
|
|
|
|
return _fileStorageServiceString.DisplayTemplates(inDto.Set);
|
2022-03-03 17:33:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="set"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[Update(@"forcesave")]
|
2022-03-05 14:41:47 +00:00
|
|
|
|
public bool ForcesaveFromBody([FromBody] SettingsRequestDto inDto)
|
2022-03-03 17:33:11 +00:00
|
|
|
|
{
|
2022-03-05 14:41:47 +00:00
|
|
|
|
return _fileStorageServiceString.Forcesave(inDto.Set);
|
2022-03-03 17:33:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Update(@"forcesave")]
|
|
|
|
|
[Consumes("application/x-www-form-urlencoded")]
|
2022-03-05 14:41:47 +00:00
|
|
|
|
public bool ForcesaveFromForm([FromForm] SettingsRequestDto inDto)
|
2022-03-03 17:33:11 +00:00
|
|
|
|
{
|
2022-03-05 14:41:47 +00:00
|
|
|
|
return _fileStorageServiceString.Forcesave(inDto.Set);
|
2022-03-03 17:33:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[Read(@"settings")]
|
|
|
|
|
public FilesSettingsHelper GetFilesSettings()
|
|
|
|
|
{
|
|
|
|
|
return _filesSettingsHelper;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Read("info")]
|
|
|
|
|
public Module GetModule()
|
|
|
|
|
{
|
|
|
|
|
_productEntryPoint.Init();
|
|
|
|
|
return new Module(_productEntryPoint);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="save"></param>
|
|
|
|
|
/// <visible>false</visible>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[Update(@"hideconfirmconvert")]
|
2022-03-05 14:41:47 +00:00
|
|
|
|
public bool HideConfirmConvertFromBody([FromBody] HideConfirmConvertRequestDto inDto)
|
2022-03-03 17:33:11 +00:00
|
|
|
|
{
|
2022-03-05 14:41:47 +00:00
|
|
|
|
return _fileStorageServiceString.HideConfirmConvert(inDto.Save);
|
2022-03-03 17:33:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Update(@"hideconfirmconvert")]
|
|
|
|
|
[Consumes("application/x-www-form-urlencoded")]
|
2022-03-05 14:41:47 +00:00
|
|
|
|
public bool HideConfirmConvertFromForm([FromForm] HideConfirmConvertRequestDto inDto)
|
2022-03-03 17:33:11 +00:00
|
|
|
|
{
|
2022-03-05 14:41:47 +00:00
|
|
|
|
return _fileStorageServiceString.HideConfirmConvert(inDto.Save);
|
2022-03-03 17:33:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Read("@privacy/available")]
|
|
|
|
|
public bool IsAvailablePrivacyRoomSettings()
|
|
|
|
|
{
|
|
|
|
|
return PrivacyRoomSettings.IsAvailable(_tenantManager);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="set"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[Update(@"storeforcesave")]
|
2022-03-05 14:41:47 +00:00
|
|
|
|
public bool StoreForcesaveFromBody([FromBody] SettingsRequestDto inDto)
|
2022-03-03 17:33:11 +00:00
|
|
|
|
{
|
2022-03-05 14:41:47 +00:00
|
|
|
|
return _fileStorageServiceString.StoreForcesave(inDto.Set);
|
2022-03-03 17:33:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Update(@"storeforcesave")]
|
|
|
|
|
[Consumes("application/x-www-form-urlencoded")]
|
2022-03-05 14:41:47 +00:00
|
|
|
|
public bool StoreForcesaveFromForm([FromForm] SettingsRequestDto inDto)
|
2022-03-03 17:33:11 +00:00
|
|
|
|
{
|
2022-03-05 14:41:47 +00:00
|
|
|
|
return _fileStorageServiceString.StoreForcesave(inDto.Set);
|
2022-03-03 17:33:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="set"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[Update(@"storeoriginal")]
|
2022-03-05 14:41:47 +00:00
|
|
|
|
public bool StoreOriginalFromBody([FromBody] SettingsRequestDto inDto)
|
2022-03-03 17:33:11 +00:00
|
|
|
|
{
|
2022-03-05 14:41:47 +00:00
|
|
|
|
return _fileStorageServiceString.StoreOriginal(inDto.Set);
|
2022-03-03 17:33:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Update(@"storeoriginal")]
|
|
|
|
|
[Consumes("application/x-www-form-urlencoded")]
|
2022-03-05 14:41:47 +00:00
|
|
|
|
public bool StoreOriginalFromForm([FromForm] SettingsRequestDto inDto)
|
2022-03-03 17:33:11 +00:00
|
|
|
|
{
|
2022-03-05 14:41:47 +00:00
|
|
|
|
return _fileStorageServiceString.StoreOriginal(inDto.Set);
|
2022-03-03 17:33:11 +00:00
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="set"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[Update(@"updateifexist")]
|
2022-03-05 14:41:47 +00:00
|
|
|
|
public bool UpdateIfExistFromBody([FromBody] SettingsRequestDto inDto)
|
2022-03-03 17:33:11 +00:00
|
|
|
|
{
|
2022-03-05 14:41:47 +00:00
|
|
|
|
return _fileStorageServiceString.UpdateIfExist(inDto.Set);
|
2022-03-03 17:33:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Update(@"updateifexist")]
|
|
|
|
|
[Consumes("application/x-www-form-urlencoded")]
|
2022-03-05 14:41:47 +00:00
|
|
|
|
public bool UpdateIfExistFromForm([FromForm] SettingsRequestDto inDto)
|
2022-03-03 17:33:11 +00:00
|
|
|
|
{
|
2022-03-05 14:41:47 +00:00
|
|
|
|
return _fileStorageServiceString.UpdateIfExist(inDto.Set);
|
2022-03-03 17:33:11 +00:00
|
|
|
|
}
|
|
|
|
|
}
|