From f5348c3ccd2821c2392829829abb354559a8076c Mon Sep 17 00:00:00 2001 From: pavelbannov Date: Mon, 31 Aug 2020 15:41:28 +0300 Subject: [PATCH 1/6] Files: settings. Added settings, forcesave, thirdparty --- .../Server/Controllers/FilesController.cs | 43 ++++++++++++++++++- 1 file changed, 41 insertions(+), 2 deletions(-) diff --git a/products/ASC.Files/Server/Controllers/FilesController.cs b/products/ASC.Files/Server/Controllers/FilesController.cs index d438755d5c..dd512afa18 100644 --- a/products/ASC.Files/Server/Controllers/FilesController.cs +++ b/products/ASC.Files/Server/Controllers/FilesController.cs @@ -1392,6 +1392,24 @@ namespace ASC.Api.Documents return FileStorageService.StoreOriginal(model.Set); } + /// + /// + /// + /// + [Read(@"settings")] + public object GetFilesSettings() + { + return new + { + FilesSettingsHelper.StoreOriginalFiles, + FilesSettingsHelper.ConfirmDelete, + FilesSettingsHelper.UpdateIfExist, + FilesSettingsHelper.Forcesave, + FilesSettingsHelper.StoreForcesave, + FilesSettingsHelper.EnableThirdParty + }; + } + /// /// /// @@ -1401,7 +1419,6 @@ namespace ASC.Api.Documents [Update(@"hideconfirmconvert")] public bool HideConfirmConvert(bool save) { - return FileStorageService.HideConfirmConvert(save); } @@ -1425,7 +1442,7 @@ namespace ASC.Api.Documents [Update(@"changedeleteconfrim")] public bool ChangeDeleteConfrim(SettingsModel model) { - return FileStorageService.HideConfirmConvert(model.Set); + return FileStorageService.ChangeDeleteConfrim(model.Set); } /// @@ -1439,6 +1456,28 @@ namespace ASC.Api.Documents return FileStorageService.StoreForcesave(model.Set); } + /// + /// + /// + /// + /// + [Update(@"forcesave")] + public bool Forcesave(SettingsModel model) + { + return FileStorageService.Forcesave(model.Set); + } + + /// + /// + /// + /// + /// + [Update(@"thirdparty")] + public bool ChangeAccessToThirdparty(SettingsModel model) + { + return FileStorageService.ChangeAccessToThirdparty(model.Set); + } + /// /// Checking document service location /// From 4fc7427aeda2a6880289ebe7879d87b62eea5ab8 Mon Sep 17 00:00:00 2001 From: pavelbannov Date: Thu, 3 Sep 2020 11:43:13 +0300 Subject: [PATCH 2/6] AuthService: added description --- web/ASC.Web.Api/Models/AuthServiceModel.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/web/ASC.Web.Api/Models/AuthServiceModel.cs b/web/ASC.Web.Api/Models/AuthServiceModel.cs index dc1c78a583..faa905d104 100644 --- a/web/ASC.Web.Api/Models/AuthServiceModel.cs +++ b/web/ASC.Web.Api/Models/AuthServiceModel.cs @@ -9,6 +9,7 @@ namespace ASC.Web.Api.Models { public string Name { get; set; } public string Title { get; set; } + public string Description { get; set; } public string Instruction { get; set; } public bool CanSet { get; set; } public List Props { get; set; } @@ -24,6 +25,7 @@ namespace ASC.Web.Api.Models Name = authService.Name; Title = authService.Title; + Description = authService.Description; Instruction = authService.Instruction; CanSet = authService.CanSet; From 0f4877b541392afde0874056bb708feae481d2dd Mon Sep 17 00:00:00 2001 From: pavelbannov Date: Thu, 3 Sep 2020 12:12:03 +0300 Subject: [PATCH 3/6] AuthService: selectel instruction fix --- .../PublicResources/Resource.Designer.cs | 18 +++--- .../PublicResources/Resource.de.resx | 61 ++++++++++++++++++- .../PublicResources/Resource.es.resx | 61 ++++++++++++++++++- .../PublicResources/Resource.fr.resx | 61 ++++++++++++++++++- .../PublicResources/Resource.it.resx | 61 ++++++++++++++++++- .../PublicResources/Resource.resx | 61 ++++++++++++++++++- .../PublicResources/Resource.ru.resx | 61 ++++++++++++++++++- 7 files changed, 369 insertions(+), 15 deletions(-) diff --git a/web/ASC.Web.Core/PublicResources/Resource.Designer.cs b/web/ASC.Web.Core/PublicResources/Resource.Designer.cs index 827a3f8c71..135b40f73d 100644 --- a/web/ASC.Web.Core/PublicResources/Resource.Designer.cs +++ b/web/ASC.Web.Core/PublicResources/Resource.Designer.cs @@ -897,15 +897,6 @@ namespace ASC.Web.Core.PublicResources { } } - /// - /// Looks up a localized string similar to When you add Selectel Cloud Storage service to your portal, you can use it to create backups of your portal making sure no data will be ever lost. Use it also to store data and static content from your portal.. - /// - public static string ConsumersSelectelCloudInstruction { - get { - return ResourceManager.GetString("ConsumersSelectelCloudInstruction", resourceCulture); - } - } - /// /// Looks up a localized string similar to Connect Selectel Cloud Storage service to backup and store data from your portal.. /// @@ -915,6 +906,15 @@ namespace ASC.Web.Core.PublicResources { } } + /// + /// Looks up a localized string similar to When you add Selectel Cloud Storage service to your portal, you can use it to create backups of your portal making sure no data will be ever lost. Use it also to store data and static content from your portal.. + /// + public static string ConsumersSelectelInstruction { + get { + return ResourceManager.GetString("ConsumersSelectelInstruction", resourceCulture); + } + } + /// /// Looks up a localized string similar to Private container. /// diff --git a/web/ASC.Web.Core/PublicResources/Resource.de.resx b/web/ASC.Web.Core/PublicResources/Resource.de.resx index 39e88c59ce..ad2f0269aa 100644 --- a/web/ASC.Web.Core/PublicResources/Resource.de.resx +++ b/web/ASC.Web.Core/PublicResources/Resource.de.resx @@ -1,5 +1,64 @@  + @@ -326,7 +385,7 @@ Auth Benutzer - + Wenn Sie den Selectel Cloud Storage-Service Ihrem Portal hinzufügen, können Sie mit ihm Backups Ihres Portals erstellen, um sicherzustellen, dass keine Daten verloren gehen. Verwenden Sie es auch zum Speichern von Daten und statischen Inhalten aus Ihrem Portal. diff --git a/web/ASC.Web.Core/PublicResources/Resource.es.resx b/web/ASC.Web.Core/PublicResources/Resource.es.resx index 54b1497593..6cc00e6a81 100644 --- a/web/ASC.Web.Core/PublicResources/Resource.es.resx +++ b/web/ASC.Web.Core/PublicResources/Resource.es.resx @@ -1,5 +1,64 @@  + @@ -295,7 +354,7 @@ Nombre de usuario para autorización - + Cuando Usted agrega el servicio Selectel Cloud Storage a su portal, puede usarlo para crear copias de seguridad de su portal asegurándose de que no se perderá ningún dato. También úselo para almacenar datos y contenido estático de su portal. diff --git a/web/ASC.Web.Core/PublicResources/Resource.fr.resx b/web/ASC.Web.Core/PublicResources/Resource.fr.resx index cbbc90de27..563b833db9 100644 --- a/web/ASC.Web.Core/PublicResources/Resource.fr.resx +++ b/web/ASC.Web.Core/PublicResources/Resource.fr.resx @@ -1,5 +1,64 @@  + @@ -322,7 +381,7 @@ Authentification d'utilisateur - + Quand vous ajoutez le service Selectel à votre portail, vous pourrez l'utiliser pour créer des copies de sauvegarde de votre portail en vous assurant qu'aucune donnée ne sera jamais perdue. Utilisez-le aussi pour stocker les données et le contenu statique de votre portail. diff --git a/web/ASC.Web.Core/PublicResources/Resource.it.resx b/web/ASC.Web.Core/PublicResources/Resource.it.resx index 23dc754527..bf111ca08b 100644 --- a/web/ASC.Web.Core/PublicResources/Resource.it.resx +++ b/web/ASC.Web.Core/PublicResources/Resource.it.resx @@ -1,5 +1,64 @@  + @@ -337,7 +396,7 @@ Auth User - + Quando aggiungi il servizio Selectel Cloud Storage al tuo portale, puoi utilizzarlo per creare copie di backup del tuo portale assicurandoti così che nessun dato sia perso. Usalo anche per memorizzare dati e contenuti statici dal tuo portale. diff --git a/web/ASC.Web.Core/PublicResources/Resource.resx b/web/ASC.Web.Core/PublicResources/Resource.resx index 7e38e583b0..7bebc7f3da 100644 --- a/web/ASC.Web.Core/PublicResources/Resource.resx +++ b/web/ASC.Web.Core/PublicResources/Resource.resx @@ -1,5 +1,64 @@  + @@ -337,7 +396,7 @@ Auth User - + When you add Selectel Cloud Storage service to your portal, you can use it to create backups of your portal making sure no data will be ever lost. Use it also to store data and static content from your portal. diff --git a/web/ASC.Web.Core/PublicResources/Resource.ru.resx b/web/ASC.Web.Core/PublicResources/Resource.ru.resx index 91da18e740..5e6ffb3784 100644 --- a/web/ASC.Web.Core/PublicResources/Resource.ru.resx +++ b/web/ASC.Web.Core/PublicResources/Resource.ru.resx @@ -1,5 +1,64 @@  + @@ -337,7 +396,7 @@ Имя пользователя для авторизации - + Добавив сервис Selectel, вы сможете использовать его для создания резервных копий портала, чтобы предотвратить потерю данных. Также используйте его для хранения данных и статического содержимого портала. From 5271c7f2f53cff1780f04d4b5dd6a8a3e5fcb253 Mon Sep 17 00:00:00 2001 From: pavelbannov Date: Thu, 3 Sep 2020 12:38:13 +0300 Subject: [PATCH 4/6] Api: fix error response --- common/ASC.Api.Core/Middleware/ResponseWrapper.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/common/ASC.Api.Core/Middleware/ResponseWrapper.cs b/common/ASC.Api.Core/Middleware/ResponseWrapper.cs index a69059c78c..8ab251cae0 100644 --- a/common/ASC.Api.Core/Middleware/ResponseWrapper.cs +++ b/common/ASC.Api.Core/Middleware/ResponseWrapper.cs @@ -9,7 +9,18 @@ namespace ASC.Api.Core.Middleware { public override void OnException(ExceptionContext context) { - context.Result = new ObjectResult(new ErrorApiResponse((HttpStatusCode)context.HttpContext.Response.StatusCode, context.Exception)); + var status = (HttpStatusCode)context.HttpContext.Response.StatusCode; + if (status == HttpStatusCode.OK) + { + status = HttpStatusCode.InternalServerError; + } + + var result = new ObjectResult(new ErrorApiResponse(status, context.Exception)) + { + StatusCode = (int)status + }; + + context.Result = result; ; } } From 82dd4a8828d51d561b0158880b438d273a78b258 Mon Sep 17 00:00:00 2001 From: pavelbannov Date: Thu, 3 Sep 2020 18:30:14 +0300 Subject: [PATCH 5/6] Settings: fix timeZones for unix --- .../TimeZoneConverter/TimeZoneConverter.cs | 28 +++++++++++++++++-- .../Controllers/SettingsController.cs | 18 +++--------- 2 files changed, 29 insertions(+), 17 deletions(-) diff --git a/common/ASC.Common/Utils/TimeZoneConverter/TimeZoneConverter.cs b/common/ASC.Common/Utils/TimeZoneConverter/TimeZoneConverter.cs index 6ce9e178c7..bde8cd77f1 100644 --- a/common/ASC.Common/Utils/TimeZoneConverter/TimeZoneConverter.cs +++ b/common/ASC.Common/Utils/TimeZoneConverter/TimeZoneConverter.cs @@ -47,7 +47,8 @@ namespace ASC.Common.Utils private IEnumerable _mapZones; - private bool _customMode; + private bool _customMode; + private bool _isMono; private Dictionary _translations; @@ -87,6 +88,26 @@ namespace ASC.Common.Utils Log.Error(error); } } + + public string GetTimeZoneDisplayName(TimeZoneInfo tz) + { + var displayName = GetTimeZoneName(tz); + if (!displayName.StartsWith("(UTC") && !displayName.StartsWith("UTC")) + { + if (tz.BaseUtcOffset != TimeSpan.Zero) + { + var offSet = tz.BaseUtcOffset < TimeSpan.Zero ? "-" : "+"; + var name = tz.BaseUtcOffset.ToString(@"hh\:mm"); + displayName = $"(UTC{offSet}{name}) {displayName}"; + } + else + { + displayName = "(UTC) " + displayName; + } + } + + return displayName; + } public string OlsonTzId2WindowsTzId(string olsonTimeZoneId, bool defaultIfNoMatch = true) { @@ -231,7 +252,7 @@ namespace ASC.Common.Utils public string GetTimeZoneName(TimeZoneInfo timeZone) { if (!_customMode) - return timeZone.DisplayName; + return _isMono ? timeZone.Id : timeZone.DisplayName; return _translations.ContainsKey(timeZone.Id) ? _translations[timeZone.Id] : timeZone.DisplayName; } @@ -253,7 +274,8 @@ namespace ASC.Common.Utils { var id = string.Empty; if (File.Exists("/etc/timezone")) - { + { + _isMono = true; id = File.ReadAllText("/etc/timezone").Trim(); } diff --git a/web/ASC.Web.Api/Controllers/SettingsController.cs b/web/ASC.Web.Api/Controllers/SettingsController.cs index 37a9320e5d..95a9ce0913 100644 --- a/web/ASC.Web.Api/Controllers/SettingsController.cs +++ b/web/ASC.Web.Api/Controllers/SettingsController.cs @@ -560,21 +560,11 @@ namespace ASC.Api.Settings foreach (var tz in timeZones.OrderBy(z => z.BaseUtcOffset)) { - var displayName = tz.DisplayName; - if (!displayName.StartsWith("(UTC") && !displayName.StartsWith("UTC")) + listOfTimezones.Add(new TimezonesModel { - if (tz.BaseUtcOffset != TimeSpan.Zero) - { - displayName = string.Format("(UTC{0}{1}) ", tz.BaseUtcOffset < TimeSpan.Zero ? "-" : "+", tz.BaseUtcOffset.ToString(@"hh\:mm")) + displayName; - } - else - { - displayName = "(UTC) " + displayName; - } - } - - listOfTimezones.Add(new TimezonesModel { Id = tz.Id, DisplayName = displayName }); - + Id = tz.Id, + DisplayName = TimeZoneConverter.GetTimeZoneDisplayName(tz) + }); } return listOfTimezones; From e6f9e88bb8fd22731f9c85593449af968f87e0f7 Mon Sep 17 00:00:00 2001 From: pavelbannov Date: Thu, 3 Sep 2020 18:49:43 +0300 Subject: [PATCH 6/6] new jenkins server --- build/Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/Jenkinsfile b/build/Jenkinsfile index 09b2b3bf6d..7403dc15ca 100644 --- a/build/Jenkinsfile +++ b/build/Jenkinsfile @@ -29,7 +29,7 @@ pipeline { } } stage('Windows') { - agent { label 'master' } + agent { label 'win-core' } stages { stage('Components') { steps {