From f9da8e402619fa5e4cab70c4d45a091606dbacab Mon Sep 17 00:00:00 2001 From: SuhorukovAnton Date: Thu, 7 Apr 2022 13:19:30 +0300 Subject: [PATCH 01/10] iprestrictions fix Verify add check enable add api method --- .../Middleware/IpSecurityFilter.cs | 8 +++- .../ASC.IPSecurity/IPRestrictionsService.cs | 2 +- common/ASC.IPSecurity/IPSecurity.cs | 45 +++++++++++++++++++ .../Controllers/SettingsController.cs | 7 +++ web/ASC.Web.Core/Users/UserManagerWrapper.cs | 5 ++- 5 files changed, 63 insertions(+), 4 deletions(-) diff --git a/common/ASC.Api.Core/Middleware/IpSecurityFilter.cs b/common/ASC.Api.Core/Middleware/IpSecurityFilter.cs index 0b8741c2e5..dfd0547a58 100644 --- a/common/ASC.Api.Core/Middleware/IpSecurityFilter.cs +++ b/common/ASC.Api.Core/Middleware/IpSecurityFilter.cs @@ -3,6 +3,7 @@ using ASC.Common; using ASC.Common.Logging; using ASC.Core; +using ASC.Core.Common.Settings; using ASC.IPSecurity; using Microsoft.AspNetCore.Mvc; @@ -19,9 +20,11 @@ namespace ASC.Api.Core.Middleware public IpSecurityFilter( IOptionsMonitor options, AuthContext authContext, - IPSecurity.IPSecurity IPSecurity) + IPSecurity.IPSecurity IPSecurity, + SettingsManager settingsManager) { log = options.CurrentValue; + IPRestrictionsSettings = settingsManager.Load(); AuthContext = authContext; this.IPSecurity = IPSecurity; } @@ -36,7 +39,8 @@ namespace ASC.Api.Core.Middleware public void OnResourceExecuting(ResourceExecutingContext context) { - if (AuthContext.IsAuthenticated && !IPSecurity.Verify()) + + if (IPRestrictionsSettings.Enable && AuthContext.IsAuthenticated && !IPSecurity.Verify()) { context.Result = new StatusCodeResult((int)HttpStatusCode.Forbidden); log.WarnFormat("IPSecurity: user {0}", AuthContext.CurrentAccount.ID); diff --git a/common/ASC.IPSecurity/IPRestrictionsService.cs b/common/ASC.IPSecurity/IPRestrictionsService.cs index 3f459bf4df..57bbf57b00 100644 --- a/common/ASC.IPSecurity/IPRestrictionsService.cs +++ b/common/ASC.IPSecurity/IPRestrictionsService.cs @@ -75,7 +75,7 @@ namespace ASC.IPSecurity { var key = IPRestrictionsServiceCache.GetCacheKey(tenant); var restrictions = cache.Get>(key); - if (restrictions == null) + if (restrictions == null || restrictions.Count == 0) { restrictions = IPRestrictionsRepository.Get(tenant); cache.Insert(key, restrictions, timeout); diff --git a/common/ASC.IPSecurity/IPSecurity.cs b/common/ASC.IPSecurity/IPSecurity.cs index 0153b97949..33faa8e7e9 100644 --- a/common/ASC.IPSecurity/IPSecurity.cs +++ b/common/ASC.IPSecurity/IPSecurity.cs @@ -25,8 +25,10 @@ using System; +using System.Collections.Generic; using System.Linq; using System.Net; +using System.Net.Sockets; using System.Web; using ASC.Common; @@ -55,6 +57,7 @@ namespace ASC.IPSecurity private SettingsManager SettingsManager { get; } private readonly string CurrentIpForTest; + private readonly string MyNetworks; public IPSecurity( IConfiguration configuration, @@ -72,6 +75,7 @@ namespace ASC.IPSecurity IPRestrictionsService = iPRestrictionsService; SettingsManager = settingsManager; CurrentIpForTest = configuration["ipsecurity:test"]; + MyNetworks = configuration["ipsecurity.mynetworks"]; var hideSettings = (configuration["web:hide-settings"] ?? "").Split(new[] { ',', ';', ' ' }); IpSecurityEnabled = !hideSettings.Contains("IpSecurity", StringComparer.CurrentCultureIgnoreCase); } @@ -109,6 +113,10 @@ namespace ASC.IPSecurity { return true; } + if (IsMyNetwork(ips)) + { + return true; + } } catch (Exception ex) { @@ -140,5 +148,42 @@ namespace ASC.IPSecurity var portIdx = ip.IndexOf(':'); return portIdx > 0 ? ip.Substring(0, portIdx) : ip; } + + private bool IsMyNetwork(string[] ips) + { + try + { + if (!string.IsNullOrEmpty(MyNetworks)) + { + var myNetworkIps = MyNetworks.Split(new[] { ",", " " }, StringSplitOptions.RemoveEmptyEntries); + + if (ips.Any(requestIp => myNetworkIps.Any(ipAddress => MatchIPs(GetIpWithoutPort(requestIp), ipAddress)))) + { + return true; + } + } + + var hostName = Dns.GetHostName(); + var hostAddresses = Dns.GetHostAddresses(Dns.GetHostName()); + + var localIPs = new List { IPAddress.IPv6Loopback, IPAddress.Loopback }; + + localIPs.AddRange(hostAddresses.Where(ip => ip.AddressFamily == AddressFamily.InterNetwork || ip.AddressFamily == AddressFamily.InterNetworkV6)); + + foreach (var ipAddress in localIPs) + { + if (ips.Contains(ipAddress.ToString())) + { + return true; + } + } + } + catch (Exception ex) + { + Log.ErrorFormat("Can't verify local network from request with IP-address: {0}", string.Join(",", ips), ex); + } + + return false; + } } } \ No newline at end of file diff --git a/web/ASC.Web.Api/Controllers/SettingsController.cs b/web/ASC.Web.Api/Controllers/SettingsController.cs index 4021d0b1ce..096d8d8e19 100644 --- a/web/ASC.Web.Api/Controllers/SettingsController.cs +++ b/web/ASC.Web.Api/Controllers/SettingsController.cs @@ -1341,6 +1341,13 @@ namespace ASC.Api.Settings return IPRestrictionsService.Save(model.Ips, Tenant.TenantId); } + [Read("iprestrictions/settings")] + public IPRestrictionsSettings GetIpRestrictionsSettings() + { + PermissionContext.DemandPermissions(SecutiryConstants.EditPortalSettings); + return SettingsManager.Load(); + } + [Update("iprestrictions/settings")] public IPRestrictionsSettings UpdateIpRestrictionsSettingsFromBody([FromBody] IpRestrictionsModel model) { diff --git a/web/ASC.Web.Core/Users/UserManagerWrapper.cs b/web/ASC.Web.Core/Users/UserManagerWrapper.cs index ba9c0fee41..89a21abd36 100644 --- a/web/ASC.Web.Core/Users/UserManagerWrapper.cs +++ b/web/ASC.Web.Core/Users/UserManagerWrapper.cs @@ -36,6 +36,7 @@ using ASC.Core; using ASC.Core.Common.Settings; using ASC.Core.Tenants; using ASC.Core.Users; +using ASC.IPSecurity; using ASC.MessagingSystem; using ASC.Web.Core.PublicResources; using ASC.Web.Core.Utility; @@ -259,7 +260,9 @@ namespace ASC.Web.Core.Users email = (email ?? "").Trim(); if (!email.TestEmailRegex()) throw new ArgumentNullException(nameof(email), Resource.ErrorNotCorrectEmail); - if (!IPSecurity.Verify()) + var settings = SettingsManager.Load(); + + if (settings.Enable && !IPSecurity.Verify()) { throw new Exception(Resource.ErrorAccessRestricted); } From 1b8be6f95c1846f63ad86298204ba73681f6490d Mon Sep 17 00:00:00 2001 From: SuhorukovAnton Date: Thu, 7 Apr 2022 14:41:37 +0300 Subject: [PATCH 02/10] fix --- common/ASC.IPSecurity/IPSecurity.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/ASC.IPSecurity/IPSecurity.cs b/common/ASC.IPSecurity/IPSecurity.cs index 33faa8e7e9..24e803d78b 100644 --- a/common/ASC.IPSecurity/IPSecurity.cs +++ b/common/ASC.IPSecurity/IPSecurity.cs @@ -75,7 +75,7 @@ namespace ASC.IPSecurity IPRestrictionsService = iPRestrictionsService; SettingsManager = settingsManager; CurrentIpForTest = configuration["ipsecurity:test"]; - MyNetworks = configuration["ipsecurity.mynetworks"]; + MyNetworks = configuration["ipsecurity:mynetworks"]; var hideSettings = (configuration["web:hide-settings"] ?? "").Split(new[] { ',', ';', ' ' }); IpSecurityEnabled = !hideSettings.Contains("IpSecurity", StringComparer.CurrentCultureIgnoreCase); } From 16d4e1565a6307922c7bed34aef76cdc60776de1 Mon Sep 17 00:00:00 2001 From: SuhorukovAnton Date: Thu, 7 Apr 2022 14:53:40 +0300 Subject: [PATCH 03/10] fix --- .../ASC.Api.Core/Middleware/IpSecurityFilter.cs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/common/ASC.Api.Core/Middleware/IpSecurityFilter.cs b/common/ASC.Api.Core/Middleware/IpSecurityFilter.cs index dfd0547a58..d919640712 100644 --- a/common/ASC.Api.Core/Middleware/IpSecurityFilter.cs +++ b/common/ASC.Api.Core/Middleware/IpSecurityFilter.cs @@ -24,14 +24,14 @@ namespace ASC.Api.Core.Middleware SettingsManager settingsManager) { log = options.CurrentValue; - IPRestrictionsSettings = settingsManager.Load(); AuthContext = authContext; this.IPSecurity = IPSecurity; + SettingsManager = settingsManager; } private AuthContext AuthContext { get; } - public IPRestrictionsSettings IPRestrictionsSettings { get; } private IPSecurity.IPSecurity IPSecurity { get; } + private SettingsManager SettingsManager { get; } public void OnResourceExecuted(ResourceExecutedContext context) { @@ -40,11 +40,16 @@ namespace ASC.Api.Core.Middleware public void OnResourceExecuting(ResourceExecutingContext context) { - if (IPRestrictionsSettings.Enable && AuthContext.IsAuthenticated && !IPSecurity.Verify()) + if (AuthContext.IsAuthenticated) { - context.Result = new StatusCodeResult((int)HttpStatusCode.Forbidden); - log.WarnFormat("IPSecurity: user {0}", AuthContext.CurrentAccount.ID); - return; + var enable = SettingsManager.Load().Enable; + + if (enable && !IPSecurity.Verify()) + { + context.Result = new StatusCodeResult((int)HttpStatusCode.Forbidden); + log.WarnFormat("IPSecurity: user {0}", AuthContext.CurrentAccount.ID); + return; + } } } } From 4012a9b713b4f7d4354e08fcda982d7cf8967fde Mon Sep 17 00:00:00 2001 From: Eugene Kozyrev <67453079+EugeneKozyrev@users.noreply.github.com> Date: Fri, 8 Apr 2022 13:04:51 +0300 Subject: [PATCH 04/10] Add ZooKeeper and Kafka connection check on Windows installation (#610) * Add zookeeper/kafka connection check * Edit build script --- build/install/win/Apache Kafka.aip | 43 ++++- build/install/win/Apache ZooKeeper.aip | 43 ++++- build/install/win/AppServer.aip | 153 ++++++++++++++---- .../C#/Utils/CustomAction.config | 7 + .../CustomActions/C#/Utils/CustomAction.cs | 20 +++ .../C#/Utils/Properties/AssemblyInfo.cs | 34 ++++ .../win/CustomActions/C#/Utils/Utils.csproj | 53 ++++++ build/install/win/build-batch.bat | 10 ++ 8 files changed, 323 insertions(+), 40 deletions(-) create mode 100644 build/install/win/CustomActions/C#/Utils/CustomAction.config create mode 100644 build/install/win/CustomActions/C#/Utils/CustomAction.cs create mode 100644 build/install/win/CustomActions/C#/Utils/Properties/AssemblyInfo.cs create mode 100644 build/install/win/CustomActions/C#/Utils/Utils.csproj diff --git a/build/install/win/Apache Kafka.aip b/build/install/win/Apache Kafka.aip index 58d6315394..117fdc8e45 100644 --- a/build/install/win/Apache Kafka.aip +++ b/build/install/win/Apache Kafka.aip @@ -1,11 +1,15 @@ - + + + - + + + @@ -33,6 +37,8 @@ + + @@ -128,6 +134,7 @@ + @@ -157,6 +164,8 @@ + + @@ -171,7 +180,7 @@ - + @@ -191,8 +200,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/install/win/Apache ZooKeeper.aip b/build/install/win/Apache ZooKeeper.aip index 264faa65a4..dd628c7f37 100644 --- a/build/install/win/Apache ZooKeeper.aip +++ b/build/install/win/Apache ZooKeeper.aip @@ -1,10 +1,14 @@ - + + + - + + + @@ -29,6 +33,8 @@ + + @@ -99,6 +105,7 @@ + @@ -116,6 +123,8 @@ + + @@ -126,7 +135,7 @@ - + @@ -144,8 +153,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/install/win/AppServer.aip b/build/install/win/AppServer.aip index 66777e5387..24380fca8b 100644 --- a/build/install/win/AppServer.aip +++ b/build/install/win/AppServer.aip @@ -28,6 +28,10 @@ + + + + @@ -74,6 +78,10 @@ + + + + @@ -243,6 +251,7 @@ + @@ -254,9 +263,9 @@ - + - + @@ -265,7 +274,23 @@ + + + + + + + + + + + + + + + + @@ -297,14 +322,29 @@ + + + + + + + + + + + + + + + - - + + - + @@ -325,40 +365,75 @@ - - + + - + - - + + - - - + + + - + - - + + - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -369,18 +444,22 @@ - - - - - + + + + + + + + + @@ -427,13 +506,19 @@ - + + + + + + + @@ -654,10 +739,10 @@ - - - - + + + + @@ -665,7 +750,7 @@ - + diff --git a/build/install/win/CustomActions/C#/Utils/CustomAction.config b/build/install/win/CustomActions/C#/Utils/CustomAction.config new file mode 100644 index 0000000000..07a5c9baa3 --- /dev/null +++ b/build/install/win/CustomActions/C#/Utils/CustomAction.config @@ -0,0 +1,7 @@ + + + + + + + diff --git a/build/install/win/CustomActions/C#/Utils/CustomAction.cs b/build/install/win/CustomActions/C#/Utils/CustomAction.cs new file mode 100644 index 0000000000..45b43184c3 --- /dev/null +++ b/build/install/win/CustomActions/C#/Utils/CustomAction.cs @@ -0,0 +1,20 @@ +using System; +using System.Net.Sockets; +using Microsoft.Deployment.WindowsInstaller; + +namespace Utils +{ + public class CustomActions + { + [CustomAction] + public static ActionResult CheckTCPAvailability(Session session) + { + string HOST = session.CustomActionData["HOST"]; + string PORT = session.CustomActionData["PORT"]; + string OUTPUT = session.CustomActionData["OUTPUT"]; + var success = new TcpClient().BeginConnect(HOST, Convert.ToInt32(PORT), null, null).AsyncWaitHandle.WaitOne(TimeSpan.FromSeconds(1)); + session[OUTPUT] = success.ToString(); + return ActionResult.Success; + } + } +} diff --git a/build/install/win/CustomActions/C#/Utils/Properties/AssemblyInfo.cs b/build/install/win/CustomActions/C#/Utils/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..1c22b2f432 --- /dev/null +++ b/build/install/win/CustomActions/C#/Utils/Properties/AssemblyInfo.cs @@ -0,0 +1,34 @@ +using System.Reflection; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Utils")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Utils")] +[assembly: AssemblyCopyright("Copyright © 2016")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("31f44d45-4371-4b33-a846-2e3b78131469")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/build/install/win/CustomActions/C#/Utils/Utils.csproj b/build/install/win/CustomActions/C#/Utils/Utils.csproj new file mode 100644 index 0000000000..2506c1d8be --- /dev/null +++ b/build/install/win/CustomActions/C#/Utils/Utils.csproj @@ -0,0 +1,53 @@ + + + + Debug + x86 + 8.0.30703 + 2.0 + {F149436D-C079-4011-88D2-B45167C81595} + Library + Properties + Utils + Utils + v4.5 + 512 + $(MSBuildExtensionsPath)\Microsoft\WiX\v3.x\Wix.CA.targets + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + True + + + + + + + + + + \ No newline at end of file diff --git a/build/install/win/build-batch.bat b/build/install/win/build-batch.bat index e3bbbf6f2d..1ef7d11794 100644 --- a/build/install/win/build-batch.bat +++ b/build/install/win/build-batch.bat @@ -1,3 +1,6 @@ +REM echo ######## Set variables ######## +set "msbuild4="C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe"" + REM echo ######## Extracting and preparing files to build ######## %sevenzip% x build\install\win\nginx-1.21.1.zip -o"build\install\win\Files" -y xcopy "build\install\win\Files\nginx-1.21.1" "build\install\win\Files\nginx" /s /y /b /i @@ -25,6 +28,12 @@ copy "build\install\win\kafka-zookeeper\zookeeper\conf\zoo_sample.cfg" "build\in del /f /q "build\install\win\kafka-zookeeper\zookeeper\conf\zoo_sample.cfg" rmdir build\install\win\publish /s /q +REM echo ######## Build Utils ######## +%msbuild4% build\install\win\CustomActions\C#\Utils\Utils.csproj +copy build\install\win\CustomActions\C#\Utils\bin\Debug\Utils.CA.dll build\install\win\Utils.CA.dll /y +rmdir build\install\win\CustomActions\C#\Utils\bin /s /q +rmdir build\install\win\CustomActions\C#\Utils\obj /s /q + REM echo ######## Edit zookeeper/kafka cfg and proprties files ######## %sed% -i "s/\(dataDir\).*/\1=.\/..\/zookeeper\/Data/g" build/install/win/kafka-zookeeper/zookeeper/conf/zoo.cfg %sed% -i "s/\(log.dirs\)=.*/\1=kafka-logs/g" build/install/win/kafka-zookeeper/kafka/config/server.properties @@ -74,4 +83,5 @@ REM echo ######## Build MySQL Server Installer ######## iscc "build\install\win\MySQL Server Installer Runner.iss" REM echo ######## Build AppServer package ######## +%AdvancedInstaller% /edit build\install\win\AppServer.aip /SetVersion %BUILD_VERSION%.%BUILD_NUMBER% %AdvancedInstaller% /rebuild build\install\win\AppServer.aip From 542df3d84788410a8a0498213a2b25d93635c66c Mon Sep 17 00:00:00 2001 From: Eugene Kozyrev <67453079+EugeneKozyrev@users.noreply.github.com> Date: Fri, 8 Apr 2022 16:04:09 +0300 Subject: [PATCH 05/10] Change project language (#612) --- build/install/win/AppServer.aip | 56 ++++++++++++++++----------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/build/install/win/AppServer.aip b/build/install/win/AppServer.aip index 24380fca8b..0cf77b63e8 100644 --- a/build/install/win/AppServer.aip +++ b/build/install/win/AppServer.aip @@ -1,9 +1,9 @@ - + - + @@ -40,8 +40,8 @@ - - + + @@ -184,11 +184,11 @@ - + - + @@ -221,22 +221,22 @@ - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + @@ -612,12 +612,12 @@ - - - - - - + + + + + + From a2995f37e693868f9baaef16855bfc6484c98099 Mon Sep 17 00:00:00 2001 From: gazizova-vlada Date: Sun, 10 Apr 2022 18:23:21 +0300 Subject: [PATCH 06/10] Web:Common:Added article loader. --- .../components/Article/index.js | 9 ++++- .../components/Article/styled-article.js | 12 ++++++ .../sub-components/article-body-loader.js | 40 +++++++++++++++++++ .../Article/sub-components/article-body.js | 8 ++-- .../Article/sub-components/article-header.js | 19 ++++++++- 5 files changed, 81 insertions(+), 7 deletions(-) create mode 100644 packages/asc-web-common/components/Article/sub-components/article-body-loader.js diff --git a/packages/asc-web-common/components/Article/index.js b/packages/asc-web-common/components/Article/index.js index 02c51adc93..81770240c9 100644 --- a/packages/asc-web-common/components/Article/index.js +++ b/packages/asc-web-common/components/Article/index.js @@ -31,6 +31,7 @@ const Article = ({ toggleShowText, toggleArticleOpen, setIsMobileArticle, + isLoading, children, ...rest }) => { @@ -115,7 +116,11 @@ const Article = ({ className="resizable-block" handleWrapperClass="resizable-border not-selectable" > - + {articleHeaderContent ? articleHeaderContent.props.children : null} {articleMainButtonContent && !isMobileOnly && !isMobileUtils() ? ( @@ -123,7 +128,7 @@ const Article = ({ {articleMainButtonContent.props.children} ) : null} - + {articleBodyContent ? articleBodyContent.props.children : null} diff --git a/packages/asc-web-common/components/Article/styled-article.js b/packages/asc-web-common/components/Article/styled-article.js index 4937e7b46b..246309a5e3 100644 --- a/packages/asc-web-common/components/Article/styled-article.js +++ b/packages/asc-web-common/components/Article/styled-article.js @@ -142,10 +142,18 @@ const StyledArticleHeader = styled.div` justify-content: flex-start; align-items: center; + .loader { + padding-top: 2px; + } + @media ${tablet} { padding: 16px 16px 17px; margin: 0; justify-content: ${(props) => (props.showText ? "flex-start" : "center")}; + .loader { + padding-top: 5px; + padding-bottom: 7px; + } } @media ${mobile} { @@ -159,6 +167,10 @@ const StyledArticleHeader = styled.div` padding: 16px 16px 17px; justify-content: ${(props) => (props.showText ? "flex-start" : "center")}; margin: 0; + .loader { + padding-top: 5px; + padding-bottom: 7px; + } `} ${isMobileOnly && diff --git a/packages/asc-web-common/components/Article/sub-components/article-body-loader.js b/packages/asc-web-common/components/Article/sub-components/article-body-loader.js new file mode 100644 index 0000000000..af4ef2c62b --- /dev/null +++ b/packages/asc-web-common/components/Article/sub-components/article-body-loader.js @@ -0,0 +1,40 @@ +import React from "react"; +import styled from "styled-components"; +import Loaders from "@appserver/common/components/Loaders"; +import { isTablet as isTabletUtils } from "@appserver/components/utils/device"; +import { isTablet } from "react-device-detect"; + +const StyledLoader = styled.div` + padding: 0px 16px 0px; + + .loader { + display: block; + width: 20px; + padding-bottom: 16px; + } + + @media (min-width: 1024px) { + padding: 0px 20px 0px; + margin-top: -7px; + + .loader { + width: 216px; + padding-bottom: 12px; + } + } +`; + +const LoaderArticleBody = () => { + const heightLoader = isTabletUtils() || isTablet ? "20px" : "24px"; + return ( + + + + + + + + ); +}; + +export default LoaderArticleBody; diff --git a/packages/asc-web-common/components/Article/sub-components/article-body.js b/packages/asc-web-common/components/Article/sub-components/article-body.js index 7e2bbb5397..66320eb02c 100644 --- a/packages/asc-web-common/components/Article/sub-components/article-body.js +++ b/packages/asc-web-common/components/Article/sub-components/article-body.js @@ -1,8 +1,10 @@ import React from "react"; import Scrollbar from "@appserver/components/scrollbar"; - -const ArticleBody = ({ children }) => { - return ( +import LoaderArticleBody from "./article-body-loader"; +const ArticleBody = ({ children, isLoading = false }) => { + return isLoading ? ( + + ) : ( {children} diff --git a/packages/asc-web-common/components/Article/sub-components/article-header.js b/packages/asc-web-common/components/Article/sub-components/article-header.js index 88020dfca7..501b7211ee 100644 --- a/packages/asc-web-common/components/Article/sub-components/article-header.js +++ b/packages/asc-web-common/components/Article/sub-components/article-header.js @@ -1,5 +1,8 @@ import React from "react"; import PropTypes from "prop-types"; +import Loaders from "@appserver/common/components/Loaders"; +import { isTablet as isTabletUtils } from "@appserver/components/utils/device"; +import { isTablet } from "react-device-detect"; import { StyledArticleHeader, @@ -8,8 +11,20 @@ import { StyledMenuIcon, } from "../styled-article"; -const ArticleHeader = ({ showText, children, onClick, ...rest }) => { - return ( +const ArticleHeader = ({ + showText, + children, + onClick, + isLoading = false, + ...rest +}) => { + const heightLoader = isTabletUtils() || isTablet ? "20px" : "32px"; + + return isLoading ? ( + + + + ) : ( From 34f223d67c75b8c064091267704fc872994d19a0 Mon Sep 17 00:00:00 2001 From: gazizova-vlada Date: Sun, 10 Apr 2022 19:24:05 +0300 Subject: [PATCH 07/10] Web:Studio:Added LoaderSectionHeader. --- .../Layout/Section/loaderSectionHeader.js | 45 +++++++++++++++++++ .../components/pages/Settings/Layout/index.js | 1 + 2 files changed, 46 insertions(+) create mode 100644 web/ASC.Web.Client/src/components/pages/Settings/Layout/Section/loaderSectionHeader.js diff --git a/web/ASC.Web.Client/src/components/pages/Settings/Layout/Section/loaderSectionHeader.js b/web/ASC.Web.Client/src/components/pages/Settings/Layout/Section/loaderSectionHeader.js new file mode 100644 index 0000000000..89430b6c0e --- /dev/null +++ b/web/ASC.Web.Client/src/components/pages/Settings/Layout/Section/loaderSectionHeader.js @@ -0,0 +1,45 @@ +import React from "react"; +import styled from "styled-components"; +import Loaders from "@appserver/common/components/Loaders"; +import { isDesktop as isDesktopUtils } from "@appserver/components/utils/device"; +import { isTablet } from "react-device-detect"; + +const StyledLoader = styled.div` + padding-top: 8px; + + .loader { + width: 273px; + } + + @media (min-width: 600px) { + padding-top: 12px; + .loader { + width: 184px; + } + } + + ${isTablet && + css` + padding-top: 12px; + .loader { + width: 184px; + } + `} + + @media (min-width: 1025px) { + .loader { + width: 296px; + } + } +`; + +const LoaderSectionHeader = () => { + const heightLoader = isDesktopUtils() ? "29px" : "37px"; + return ( + + + + ); +}; + +export default LoaderSectionHeader; diff --git a/web/ASC.Web.Client/src/components/pages/Settings/Layout/index.js b/web/ASC.Web.Client/src/components/pages/Settings/Layout/index.js index 30a7025ea0..6a6dadd596 100644 --- a/web/ASC.Web.Client/src/components/pages/Settings/Layout/index.js +++ b/web/ASC.Web.Client/src/components/pages/Settings/Layout/index.js @@ -4,6 +4,7 @@ import { ArticleHeaderContent, ArticleBodyContent } from "./Article"; import { SectionHeaderContent, SectionPagingContent } from "./Section"; import { inject, observer } from "mobx-react"; import Section from "@appserver/common/components/Section"; +import LoaderSectionHeader from "./Section/loaderSectionHeader"; const ArticleSettings = React.memo(() => { return ( From a2c1e836c0e73d753c3be27c3c3a81630155cd0a Mon Sep 17 00:00:00 2001 From: gazizova-vlada Date: Sun, 10 Apr 2022 19:57:43 +0300 Subject: [PATCH 08/10] Web:Studio:Added LoaderSubmenu. --- .../pages/Settings/categories/common/index.js | 10 +++--- .../common/sub-components/loaderSubmenu.js | 32 +++++++++++++++++++ 2 files changed, 37 insertions(+), 5 deletions(-) create mode 100644 web/ASC.Web.Client/src/components/pages/Settings/categories/common/sub-components/loaderSubmenu.js diff --git a/web/ASC.Web.Client/src/components/pages/Settings/categories/common/index.js b/web/ASC.Web.Client/src/components/pages/Settings/categories/common/index.js index 20f9fa65a2..df8aa31da5 100644 --- a/web/ASC.Web.Client/src/components/pages/Settings/categories/common/index.js +++ b/web/ASC.Web.Client/src/components/pages/Settings/categories/common/index.js @@ -8,7 +8,7 @@ import config from "../../../../../../package.json"; import Customization from "./customization"; import WhiteLabel from "./whitelabel"; -import AppLoader from "@appserver/common/components/AppLoader"; +import LoaderSubmenu from "./sub-components/loaderSubmenu"; const SubmenuCommon = (props) => { const { t, history } = props; @@ -34,7 +34,7 @@ const SubmenuCommon = (props) => { if (currentTab !== -1) { setCurrentTab(currentTab); } - setIsLoading(true); + //setIsLoading(true); }, []); const onSelect = (e) => { @@ -46,9 +46,9 @@ const SubmenuCommon = (props) => { ) ); }; - //TODO: Loader - return !isLoading ? ( - + //TODO: isLoading + return isLoading ? ( + ) : ( { + return ( + + + + + ); +}; + +export default LoaderSubmenu; From 95959317a255a231cc281fe90e2e0d758df31c72 Mon Sep 17 00:00:00 2001 From: SuhorukovAnton Date: Mon, 11 Apr 2022 10:38:00 +0300 Subject: [PATCH 09/10] fix --- common/ASC.IPSecurity/IPRestrictionsService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/ASC.IPSecurity/IPRestrictionsService.cs b/common/ASC.IPSecurity/IPRestrictionsService.cs index 57bbf57b00..3f459bf4df 100644 --- a/common/ASC.IPSecurity/IPRestrictionsService.cs +++ b/common/ASC.IPSecurity/IPRestrictionsService.cs @@ -75,7 +75,7 @@ namespace ASC.IPSecurity { var key = IPRestrictionsServiceCache.GetCacheKey(tenant); var restrictions = cache.Get>(key); - if (restrictions == null || restrictions.Count == 0) + if (restrictions == null) { restrictions = IPRestrictionsRepository.Get(tenant); cache.Insert(key, restrictions, timeout); From 002a432b4dc0484e5450ef66ae9f71a5d1c0611b Mon Sep 17 00:00:00 2001 From: gopienkonikita Date: Mon, 11 Apr 2022 11:11:44 +0300 Subject: [PATCH 10/10] Web: fixed info-panel icon --- .../components/Navigation/sub-components/control-btn.js | 2 +- .../asc-web-components/table-container/StyledTableContainer.js | 2 ++ packages/asc-web-components/table-container/TableGroupMenu.js | 2 +- products/ASC.Files/Client/public/images/panel.react.svg | 3 +++ products/ASC.Files/Client/public/images/panel.svg | 3 --- 5 files changed, 7 insertions(+), 5 deletions(-) create mode 100644 products/ASC.Files/Client/public/images/panel.react.svg delete mode 100644 products/ASC.Files/Client/public/images/panel.svg diff --git a/packages/asc-web-common/components/Navigation/sub-components/control-btn.js b/packages/asc-web-common/components/Navigation/sub-components/control-btn.js index c5c22cc3c2..d2abd45fc9 100644 --- a/packages/asc-web-common/components/Navigation/sub-components/control-btn.js +++ b/packages/asc-web-common/components/Navigation/sub-components/control-btn.js @@ -135,7 +135,7 @@ const ControlButtons = ({
{
+ + diff --git a/products/ASC.Files/Client/public/images/panel.svg b/products/ASC.Files/Client/public/images/panel.svg deleted file mode 100644 index 8da7c48595..0000000000 --- a/products/ASC.Files/Client/public/images/panel.svg +++ /dev/null @@ -1,3 +0,0 @@ - - -