Merge branch 'develop' into feature/fix-hide/show-header

# Conflicts:
#	products/ASC.Files/Client/src/App.js
#	products/ASC.Files/Client/src/components/pages/Home/Section/Body/index.js
#	products/ASC.Files/Client/src/components/pages/Home/index.js
#	web/ASC.Web.Common/src/components/Layout/index.js
#	web/ASC.Web.Common/src/components/NavMenu/index.js
#	web/ASC.Web.Common/src/components/PageLayout/index.js
#	web/ASC.Web.Common/src/components/PageLayout/sub-components/section-header.js
#	web/ASC.Web.Common/src/store/auth/actions.js
#	web/ASC.Web.Common/src/store/auth/reducer.js
#	web/ASC.Web.Common/src/store/auth/selectors.js
This commit is contained in:
TatianaLopaeva 2021-01-13 13:27:55 +03:00
commit 9bcb922c1a
243 changed files with 20800 additions and 9826 deletions

193
ASC.Tests.sln Normal file
View File

@ -0,0 +1,193 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30413.136
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.Files.Tests", "products\ASC.Files\Tests\ASC.Files.Tests.csproj", "{EFB99A37-EF25-4A0F-8D7A-786402B1554C}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.Api.Core", "common\ASC.Api.Core\ASC.Api.Core.csproj", "{CAA6EED2-094A-42AE-81B6-3FDF142EC277}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.Common", "common\ASC.Common\ASC.Common.csproj", "{19FFE246-4270-41A6-AA8D-FB961715FB21}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.Core.Common", "common\ASC.Core.Common\ASC.Core.Common.csproj", "{A51D0454-4AFA-46DE-89D4-B03D37E1816C}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.Data.Storage", "common\ASC.Data.Storage\ASC.Data.Storage.csproj", "{D7F459CE-9EAF-423A-B3DC-EFD107007BCE}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.FederatedLogin", "common\ASC.FederatedLogin\ASC.FederatedLogin.csproj", "{484E9663-B9B7-40CA-B600-D5FDCD7CB862}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.MessagingSystem", "common\ASC.MessagingSystem\ASC.MessagingSystem.csproj", "{AB0EFA45-1DAF-42F4-9EE1-4A8EC497DE35}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.ElasticSearch", "common\services\ASC.ElasticSearch\ASC.ElasticSearch.csproj", "{AE1A0E06-6CD4-4E1D-8209-22BBBD6D5652}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.Files.Core", "products\ASC.Files\Core\ASC.Files.Core.csproj", "{C277388C-E19E-4A62-A895-8AAB322A4004}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.Files", "products\ASC.Files\Server\ASC.Files.csproj", "{77BA2F61-6155-4283-BB39-F8E42F46A0B0}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.People", "products\ASC.People\Server\ASC.People.csproj", "{DB492BA0-B072-4056-8A3D-032CD108CD82}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.Web.Core", "web\ASC.Web.Core\ASC.Web.Core.csproj", "{9A703423-594E-4851-8A0D-FF582BAF9FC9}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.Data.Reassigns", "common\ASC.Data.Reassigns\ASC.Data.Reassigns.csproj", "{8682FCD3-C5C5-4946-99FA-B900E9CB68C3}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.Feed", "common\ASC.Feed\ASC.Feed.csproj", "{5A0DF88C-45C8-4FE2-8144-88E8AC8B7C45}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.IPSecurity", "common\ASC.IPSecurity\ASC.IPSecurity.csproj", "{5E5496B5-5686-4415-B3E0-5F61FCD146A3}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.Notify.Textile", "common\ASC.Notify.Textile\ASC.Notify.Textile.csproj", "{5FE0EDA2-1FD7-4D43-885E-DBDD858DCC86}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.Textile", "common\ASC.Textile\ASC.Textile.csproj", "{1A82BE07-0836-4620-A95D-C6D1E9327589}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.VoipService", "common\ASC.VoipService\ASC.VoipService.csproj", "{664031A4-1652-4B68-8168-FD18998700EE}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.UrlShortener.Svc", "common\services\ASC.UrlShortener.Svc\ASC.UrlShortener.Svc.csproj", "{7DC27057-7B61-4381-BF35-ACED2C9987BC}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.Thumbnails.Svc", "common\services\ASC.Thumbnails.Svc\ASC.Thumbnails.Svc.csproj", "{920A59BF-8EFC-4E0F-82D8-935CC6FD570A}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.Studio.Notify", "common\services\ASC.Studio.Notify\ASC.Studio.Notify.csproj", "{C024C35A-D0F0-42D6-86B2-64ABF7513C4A}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.Socket.IO.Svc", "common\services\ASC.Socket.IO.Svc\ASC.Socket.IO.Svc.csproj", "{60CB362A-72F4-426E-BBAE-9A9B7426ED04}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.Notify", "common\services\ASC.Notify\ASC.Notify.csproj", "{B30A0D35-7B32-4E13-9F37-B8BC59F839E5}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.Feed.Aggregator", "common\services\ASC.Feed.Aggregator\ASC.Feed.Aggregator.csproj", "{8ACDEBBD-12DD-43DC-86CF-D66E37528ACC}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.Data.Storage.Migration", "common\services\ASC.Data.Storage.Migration\ASC.Data.Storage.Migration.csproj", "{1E2A4FE7-5B61-4E76-B62A-3E9CC9FA647C}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.Data.Backup", "common\services\ASC.Data.Backup\ASC.Data.Backup.csproj", "{630E2649-71B6-4C07-A2FC-C0BC05D77A78}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.ApiSystem", "common\services\ASC.ApiSystem\ASC.ApiSystem.csproj", "{053AFC13-8EF6-43B6-9514-ED9DBBDC3093}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.Web.Api", "web\ASC.Web.Api\ASC.Web.Api.csproj", "{D7C5E8A0-0A5E-4BC4-9946-B43D6682D421}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.Web.Studio", "web\ASC.Web.Studio\ASC.Web.Studio.csproj", "{9BF17F6E-04A9-4597-9273-21AD09600329}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{EFB99A37-EF25-4A0F-8D7A-786402B1554C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EFB99A37-EF25-4A0F-8D7A-786402B1554C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EFB99A37-EF25-4A0F-8D7A-786402B1554C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EFB99A37-EF25-4A0F-8D7A-786402B1554C}.Release|Any CPU.Build.0 = Release|Any CPU
{CAA6EED2-094A-42AE-81B6-3FDF142EC277}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CAA6EED2-094A-42AE-81B6-3FDF142EC277}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CAA6EED2-094A-42AE-81B6-3FDF142EC277}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CAA6EED2-094A-42AE-81B6-3FDF142EC277}.Release|Any CPU.Build.0 = Release|Any CPU
{19FFE246-4270-41A6-AA8D-FB961715FB21}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{19FFE246-4270-41A6-AA8D-FB961715FB21}.Debug|Any CPU.Build.0 = Debug|Any CPU
{19FFE246-4270-41A6-AA8D-FB961715FB21}.Release|Any CPU.ActiveCfg = Release|Any CPU
{19FFE246-4270-41A6-AA8D-FB961715FB21}.Release|Any CPU.Build.0 = Release|Any CPU
{A51D0454-4AFA-46DE-89D4-B03D37E1816C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A51D0454-4AFA-46DE-89D4-B03D37E1816C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A51D0454-4AFA-46DE-89D4-B03D37E1816C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A51D0454-4AFA-46DE-89D4-B03D37E1816C}.Release|Any CPU.Build.0 = Release|Any CPU
{D7F459CE-9EAF-423A-B3DC-EFD107007BCE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D7F459CE-9EAF-423A-B3DC-EFD107007BCE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D7F459CE-9EAF-423A-B3DC-EFD107007BCE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D7F459CE-9EAF-423A-B3DC-EFD107007BCE}.Release|Any CPU.Build.0 = Release|Any CPU
{484E9663-B9B7-40CA-B600-D5FDCD7CB862}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{484E9663-B9B7-40CA-B600-D5FDCD7CB862}.Debug|Any CPU.Build.0 = Debug|Any CPU
{484E9663-B9B7-40CA-B600-D5FDCD7CB862}.Release|Any CPU.ActiveCfg = Release|Any CPU
{484E9663-B9B7-40CA-B600-D5FDCD7CB862}.Release|Any CPU.Build.0 = Release|Any CPU
{AB0EFA45-1DAF-42F4-9EE1-4A8EC497DE35}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AB0EFA45-1DAF-42F4-9EE1-4A8EC497DE35}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AB0EFA45-1DAF-42F4-9EE1-4A8EC497DE35}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AB0EFA45-1DAF-42F4-9EE1-4A8EC497DE35}.Release|Any CPU.Build.0 = Release|Any CPU
{AE1A0E06-6CD4-4E1D-8209-22BBBD6D5652}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AE1A0E06-6CD4-4E1D-8209-22BBBD6D5652}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AE1A0E06-6CD4-4E1D-8209-22BBBD6D5652}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AE1A0E06-6CD4-4E1D-8209-22BBBD6D5652}.Release|Any CPU.Build.0 = Release|Any CPU
{C277388C-E19E-4A62-A895-8AAB322A4004}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C277388C-E19E-4A62-A895-8AAB322A4004}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C277388C-E19E-4A62-A895-8AAB322A4004}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C277388C-E19E-4A62-A895-8AAB322A4004}.Release|Any CPU.Build.0 = Release|Any CPU
{77BA2F61-6155-4283-BB39-F8E42F46A0B0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{77BA2F61-6155-4283-BB39-F8E42F46A0B0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{77BA2F61-6155-4283-BB39-F8E42F46A0B0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{77BA2F61-6155-4283-BB39-F8E42F46A0B0}.Release|Any CPU.Build.0 = Release|Any CPU
{DB492BA0-B072-4056-8A3D-032CD108CD82}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DB492BA0-B072-4056-8A3D-032CD108CD82}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DB492BA0-B072-4056-8A3D-032CD108CD82}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DB492BA0-B072-4056-8A3D-032CD108CD82}.Release|Any CPU.Build.0 = Release|Any CPU
{9A703423-594E-4851-8A0D-FF582BAF9FC9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9A703423-594E-4851-8A0D-FF582BAF9FC9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9A703423-594E-4851-8A0D-FF582BAF9FC9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9A703423-594E-4851-8A0D-FF582BAF9FC9}.Release|Any CPU.Build.0 = Release|Any CPU
{8682FCD3-C5C5-4946-99FA-B900E9CB68C3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8682FCD3-C5C5-4946-99FA-B900E9CB68C3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8682FCD3-C5C5-4946-99FA-B900E9CB68C3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8682FCD3-C5C5-4946-99FA-B900E9CB68C3}.Release|Any CPU.Build.0 = Release|Any CPU
{5A0DF88C-45C8-4FE2-8144-88E8AC8B7C45}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5A0DF88C-45C8-4FE2-8144-88E8AC8B7C45}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5A0DF88C-45C8-4FE2-8144-88E8AC8B7C45}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5A0DF88C-45C8-4FE2-8144-88E8AC8B7C45}.Release|Any CPU.Build.0 = Release|Any CPU
{5E5496B5-5686-4415-B3E0-5F61FCD146A3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5E5496B5-5686-4415-B3E0-5F61FCD146A3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5E5496B5-5686-4415-B3E0-5F61FCD146A3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5E5496B5-5686-4415-B3E0-5F61FCD146A3}.Release|Any CPU.Build.0 = Release|Any CPU
{5FE0EDA2-1FD7-4D43-885E-DBDD858DCC86}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5FE0EDA2-1FD7-4D43-885E-DBDD858DCC86}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5FE0EDA2-1FD7-4D43-885E-DBDD858DCC86}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5FE0EDA2-1FD7-4D43-885E-DBDD858DCC86}.Release|Any CPU.Build.0 = Release|Any CPU
{1A82BE07-0836-4620-A95D-C6D1E9327589}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1A82BE07-0836-4620-A95D-C6D1E9327589}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1A82BE07-0836-4620-A95D-C6D1E9327589}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1A82BE07-0836-4620-A95D-C6D1E9327589}.Release|Any CPU.Build.0 = Release|Any CPU
{664031A4-1652-4B68-8168-FD18998700EE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{664031A4-1652-4B68-8168-FD18998700EE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{664031A4-1652-4B68-8168-FD18998700EE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{664031A4-1652-4B68-8168-FD18998700EE}.Release|Any CPU.Build.0 = Release|Any CPU
{7DC27057-7B61-4381-BF35-ACED2C9987BC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7DC27057-7B61-4381-BF35-ACED2C9987BC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7DC27057-7B61-4381-BF35-ACED2C9987BC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7DC27057-7B61-4381-BF35-ACED2C9987BC}.Release|Any CPU.Build.0 = Release|Any CPU
{920A59BF-8EFC-4E0F-82D8-935CC6FD570A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{920A59BF-8EFC-4E0F-82D8-935CC6FD570A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{920A59BF-8EFC-4E0F-82D8-935CC6FD570A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{920A59BF-8EFC-4E0F-82D8-935CC6FD570A}.Release|Any CPU.Build.0 = Release|Any CPU
{C024C35A-D0F0-42D6-86B2-64ABF7513C4A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C024C35A-D0F0-42D6-86B2-64ABF7513C4A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C024C35A-D0F0-42D6-86B2-64ABF7513C4A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C024C35A-D0F0-42D6-86B2-64ABF7513C4A}.Release|Any CPU.Build.0 = Release|Any CPU
{60CB362A-72F4-426E-BBAE-9A9B7426ED04}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{60CB362A-72F4-426E-BBAE-9A9B7426ED04}.Debug|Any CPU.Build.0 = Debug|Any CPU
{60CB362A-72F4-426E-BBAE-9A9B7426ED04}.Release|Any CPU.ActiveCfg = Release|Any CPU
{60CB362A-72F4-426E-BBAE-9A9B7426ED04}.Release|Any CPU.Build.0 = Release|Any CPU
{B30A0D35-7B32-4E13-9F37-B8BC59F839E5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B30A0D35-7B32-4E13-9F37-B8BC59F839E5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B30A0D35-7B32-4E13-9F37-B8BC59F839E5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B30A0D35-7B32-4E13-9F37-B8BC59F839E5}.Release|Any CPU.Build.0 = Release|Any CPU
{8ACDEBBD-12DD-43DC-86CF-D66E37528ACC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8ACDEBBD-12DD-43DC-86CF-D66E37528ACC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8ACDEBBD-12DD-43DC-86CF-D66E37528ACC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8ACDEBBD-12DD-43DC-86CF-D66E37528ACC}.Release|Any CPU.Build.0 = Release|Any CPU
{1E2A4FE7-5B61-4E76-B62A-3E9CC9FA647C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1E2A4FE7-5B61-4E76-B62A-3E9CC9FA647C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1E2A4FE7-5B61-4E76-B62A-3E9CC9FA647C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1E2A4FE7-5B61-4E76-B62A-3E9CC9FA647C}.Release|Any CPU.Build.0 = Release|Any CPU
{630E2649-71B6-4C07-A2FC-C0BC05D77A78}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{630E2649-71B6-4C07-A2FC-C0BC05D77A78}.Debug|Any CPU.Build.0 = Debug|Any CPU
{630E2649-71B6-4C07-A2FC-C0BC05D77A78}.Release|Any CPU.ActiveCfg = Release|Any CPU
{630E2649-71B6-4C07-A2FC-C0BC05D77A78}.Release|Any CPU.Build.0 = Release|Any CPU
{053AFC13-8EF6-43B6-9514-ED9DBBDC3093}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{053AFC13-8EF6-43B6-9514-ED9DBBDC3093}.Debug|Any CPU.Build.0 = Debug|Any CPU
{053AFC13-8EF6-43B6-9514-ED9DBBDC3093}.Release|Any CPU.ActiveCfg = Release|Any CPU
{053AFC13-8EF6-43B6-9514-ED9DBBDC3093}.Release|Any CPU.Build.0 = Release|Any CPU
{D7C5E8A0-0A5E-4BC4-9946-B43D6682D421}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D7C5E8A0-0A5E-4BC4-9946-B43D6682D421}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D7C5E8A0-0A5E-4BC4-9946-B43D6682D421}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D7C5E8A0-0A5E-4BC4-9946-B43D6682D421}.Release|Any CPU.Build.0 = Release|Any CPU
{9BF17F6E-04A9-4597-9273-21AD09600329}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9BF17F6E-04A9-4597-9273-21AD09600329}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9BF17F6E-04A9-4597-9273-21AD09600329}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9BF17F6E-04A9-4597-9273-21AD09600329}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {73201867-1BA9-4F5E-AA69-AFA74662FFFC}
EndGlobalSection
EndGlobal

View File

@ -68,13 +68,15 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.Data.Storage.Encryption
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.TelegramService", "common\services\ASC.TelegramService\ASC.TelegramService.csproj", "{95CE7371-17B6-4EEE-8E38-2FDE6347E955}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ASC.AuditTrail", "common\services\ASC.AuditTrail\ASC.AuditTrail.csproj", "{2C111161-B7C5-4869-9F52-EA725E64BA40}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.AuditTrail", "common\services\ASC.AuditTrail\ASC.AuditTrail.csproj", "{2C111161-B7C5-4869-9F52-EA725E64BA40}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{0E35EB77-EC53-44C2-99EB-3D845C79675D}"
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ASC.Data.Encryption", "common\ASC.Data.Encryption\ASC.Data.Encryption.csproj", "{C4DF1A63-C9EB-4D8F-A4E5-4FD9249A5089}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -209,6 +211,10 @@ Global
{2C111161-B7C5-4869-9F52-EA725E64BA40}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2C111161-B7C5-4869-9F52-EA725E64BA40}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2C111161-B7C5-4869-9F52-EA725E64BA40}.Release|Any CPU.Build.0 = Release|Any CPU
{C4DF1A63-C9EB-4D8F-A4E5-4FD9249A5089}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C4DF1A63-C9EB-4D8F-A4E5-4FD9249A5089}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C4DF1A63-C9EB-4D8F-A4E5-4FD9249A5089}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C4DF1A63-C9EB-4D8F-A4E5-4FD9249A5089}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

75
build/install/docker/.env Normal file
View File

@ -0,0 +1,75 @@
# docker-compose tags #
PRODUCT=onlyoffice
REPO=${PRODUCT}
STATUS=""
SRV_VERSION=0.0.0
MYSQL_VERSION=8.0.18
ELK_VERSION=7.8.1
SERVICE_PORT=5050
CONTAINER_PREFIX=${PRODUCT}-
# zookeeper #
ZOO_PORT=2181
ZOO_HOST=${CONTAINER_PREFIX}zookeeper
ZOO_SERVER=server.1=${ZOO_HOST}:2888:3888
# kafka #
KAFKA_HOST=${CONTAINER_PREFIX}kafka
KAFKA_ADVERTISED_LISTENERS=LISTENER_DOCKER_INTERNAL://${KAFKA_HOST}:9092
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP=LISTENER_DOCKER_INTERNAL:PLAINTEXT,LISTENER_DOCKER_EXTERNAL:PLAINTEXT
KAFKA_INTER_BROKER_LISTENER_NAME=LISTENER_DOCKER_INTERNAL
KAFKA_ZOOKEEPER_CONNECT=${ZOO_HOST}:2181
KAFKA_BROKER_ID=1
KAFKA_LOG4J_LOGGERS=kafka.controller=INFO,kafka.producer.async.DefaultEventHandler=INFO,state.change.logger=INFO
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR=1
# elasticsearch #
ELK_HOST=${CONTAINER_PREFIX}elasticsearch
# app service environment #
APP_DOTNET_ENV=test
APP_CORE_BASE_DOMAIN=localhost
APP_CORE_MACHINEKEY=your_core_machinekey
DOCUMENT_SERVER_JWT_SECRET=your_jwt_secret
DOCUMENT_SERVER_JWT_HEADER=AuthorizationJwt
DOCUMENT_SERVER_URL_PUBLIC=/ds-vpath/
DOCUMENT_SERVER_URL_CONVERTER=/ds-vpath/ConvertService.ashx
DOCUMENT_SERVER_HOST=${CONTAINER_PREFIX}document-server
DOCUMENT_SERVER_URL_INTERNAL=http://${DOCUMENT_SERVER_HOST}/
MYSQL_ROOT_PASSWORD=my-secret-pw
MYSQL_DATABASE=${PRODUCT}
MYSQL_USER=${PRODUCT}_user
MYSQL_PASSWORD=${PRODUCT}_pass
MYSQL_HOST=${CONTAINER_PREFIX}mysql-server
# service host #
API_HOST=${CONTAINER_PREFIX}api
API_SYSTEM_HOST=${CONTAINER_PREFIX}api_system
URLSHORTENER_HOST=${CONTAINER_PREFIX}urlshortener
STUDIO_NOYIFY_HOST=${CONTAINER_PREFIX}studio.notify
NOTIFY_HOST=${CONTAINER_PREFIX}notify
PEOPLE_SERVER_HOST=${CONTAINER_PREFIX}people.server
FILES_HOST=${CONTAINER_PREFIX}files
FILES_SERVICES_HOST=${CONTAINER_PREFIX}files_services
STUDIO_HOST=${CONTAINER_PREFIX}studio
BACKUP_HOST=${CONTAINER_PREFIX}backup
THUMBNAILS_HOST=${CONTAINER_PREFIX}thumbnails
SOCKET_HOST=${CONTAINER_PREFIX}socket
PROXY_HOST=${CONTAINER_PREFIX}proxy
# proxy upstream environment #
SERVICE_API=${API_HOST}:${SERVICE_PORT}
SERVICE_API_SYSTEM=${API_SYSTEM_HOST}:${SERVICE_PORT}
SERVICE_URLSHORTENER=${URLSHORTENER_HOST}:${SERVICE_PORT}
SERVICE_STUDIO_NOTIFY=${STUDIO_NOYIFY_HOST}:${SERVICE_PORT}
SERVICE_PEOPLE_SERVER=${PEOPLE_SERVER_HOST}:${SERVICE_PORT}
SERVICE_FILES=${FILES_HOST}:${SERVICE_PORT}
SERVICE_FILES_SERVICES=${FILES_SERVICES_HOST}:${SERVICE_PORT}
SERVICE_STUDIO=${STUDIO_HOST}:${SERVICE_PORT}
SERVICE_BACKUP=${BACKUP_HOST}:${SERVICE_PORT}
SERVICE_THUMBNAILS=${THUMBNAILS_HOST}:${SERVICE_PORT}
SERVICE_SH=${URLSHORTENER_HOST}:9999
NETWORK_NAME=${PRODUCT}

View File

@ -5,7 +5,7 @@ ARG RELEASE_DATE_SIGN=""
ARG VERSION="8.9.0.190"
ARG SOURCE_REPO_URL="deb http://static.teamlab.com.s3.amazonaws.com/repo/debian squeeze main"
ARG DEBIAN_FRONTEND=noninteractive
ARG GIT_BRANCH="master"
ARG GIT_BRANCH="develop"
LABEL onlyoffice.community.release-date="${RELEASE_DATE}" \
onlyoffice.community.version="${VERSION}" \
@ -182,7 +182,11 @@ RUN cd /app/onlyoffice/src/ && \
COPY config/mysql/conf.d/mysql.cnf /etc/mysql/conf.d/mysql.cnf
COPY config/supervisor/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY config/mysql/dotnet_dump.sql /app/onlyoffice/dotnet_dump.sql
COPY config/createdb.sql /app/onlyoffice/createdb.sql
COPY config/onlyoffice.sql /app/onlyoffice/onlyoffice.sql
COPY config/onlyoffice.data.sql /app/onlyoffice/onlyoffice.data.sql
COPY config/onlyoffice.resources.sql /app/onlyoffice/onlyoffice.resources.sql
RUN sed -i 's/Server=.*;Port=/Server=127.0.0.1;Port=/' /app/onlyoffice/config/appsettings.test.json
@ -191,7 +195,10 @@ RUN mkdir -p /var/mysqld/ && \
sudo -u mysql bash -c "/usr/bin/pidproxy /var/mysqld/mysqld.pid /usr/bin/mysqld_safe --pid-file=/var/mysqld/mysqld.pid &" && \
sleep 5s && \
mysql -e "CREATE DATABASE IF NOT EXISTS onlyoffice CHARACTER SET utf8 COLLATE 'utf8_general_ci'" && \
mysql -D "onlyoffice" < /app/onlyoffice/dotnet_dump.sql && \
mysql -D "onlyoffice" < /app/onlyoffice/createdb.sql && \
mysql -D "onlyoffice" < /app/onlyoffice/onlyoffice.sql && \
mysql -D "onlyoffice" < /app/onlyoffice/onlyoffice.data.sql && \
mysql -D "onlyoffice" < /app/onlyoffice/onlyoffice.resources.sql && \
mysql -D "onlyoffice" -e 'CREATE USER IF NOT EXISTS "onlyoffice_user"@"localhost" IDENTIFIED WITH mysql_native_password BY "onlyoffice_pass";' && \
mysql -D "onlyoffice" -e 'GRANT ALL PRIVILEGES ON *.* TO 'onlyoffice_user'@'localhost';' && \
killall -u mysql -n mysql

View File

@ -0,0 +1,366 @@
### STAGE 1: Develop ######
FROM ubuntu:18.04 AS develop
ARG RELEASE_DATE="2016-06-21"
ARG VERSION="8.9.0.190"
ARG DEBIAN_FRONTEND=noninteractive
ARG GIT_BRANCH="master"
LABEL onlyoffice.appserver.release-date="${RELEASE_DATE}" \
onlyoffice.appserver.version="${VERSION}" \
maintainer="Ascensio System SIA <support@onlyoffice.com>"
ENV LANG=en_US.UTF-8 \
LANGUAGE=en_US:en \
LC_ALL=en_US.UTF-8
RUN echo "nameserver 8.8.8.8" | tee /etc/resolv.conf > /dev/null && \
apt-get -y update && \
apt-get -y upgrade && \
apt-get -y dist-upgrade && \
apt-get install -yq sudo locales && \
addgroup --system --gid 107 onlyoffice && \
adduser -uid 104 --quiet --home /var/www/onlyoffice --system --gid 107 onlyoffice && \
locale-gen en_US.UTF-8 && \
apt-get -y update && \
apt-get install -yq software-properties-common wget curl && \
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash - && \
apt-get install -y nodejs && \
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - && \
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list && \
wget -q https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb && \
dpkg -i packages-microsoft-prod.deb && \
apt-get -y update && \
cd ~ && \
echo "#!/bin/sh\nexit 0" > /usr/sbin/policy-rc.d && \
apt-get install -yq git \
yarn \
dotnet-sdk-3.1
RUN echo "nameserver 8.8.8.8" | tee /etc/resolv.conf > /dev/null && \
git clone --depth 1 -b ${GIT_BRANCH} https://github.com/ONLYOFFICE/AppServer.git /app/onlyoffice/src/
RUN echo "nameserver 8.8.8.8" | tee /etc/resolv.conf > /dev/null && \
cd /app/onlyoffice/src/ && \
yarn install --cwd web/ASC.Web.Components --frozen-lockfile > build/ASC.Web.Components.log && \
yarn pack --cwd web/ASC.Web.Components
RUN echo "nameserver 8.8.8.8" | tee /etc/resolv.conf > /dev/null && \
cd /app/onlyoffice/src/ && \
component=$(ls web/ASC.Web.Components/asc-web-components-v1.*.tgz) && \
yarn remove asc-web-components --cwd web/ASC.Web.Common --peer && \
yarn add file:../../$component --cwd web/ASC.Web.Common --cache-folder ../../yarn --peer && \
yarn install --cwd web/ASC.Web.Common --frozen-lockfile > build/ASC.Web.Common.log && \
yarn pack --cwd web/ASC.Web.Common
RUN echo "nameserver 8.8.8.8" | tee /etc/resolv.conf > /dev/null && \
cd /app/onlyoffice/src/ && \
npm run build:storybook --prefix web/ASC.Web.Components && \
mkdir -p /var/www/story/ && \
cp -Rf web/ASC.Web.Components/storybook-static/* /var/www/story/
RUN echo "nameserver 8.8.8.8" | tee /etc/resolv.conf > /dev/null && \
cd /app/onlyoffice/src/ && \
component=$(ls web/ASC.Web.Components/asc-web-components-v1.*.tgz) && \
common=$(ls web/ASC.Web.Common/asc-web-common-v1.*.tgz) && \
yarn remove asc-web-components asc-web-common --cwd web/ASC.Web.Client && \
yarn add ../../$component --cwd web/ASC.Web.Client --cache-folder ../../yarn && \
yarn add ../../$common --cwd web/ASC.Web.Client --cache-folder ../../yarn && \
yarn install --cwd web/ASC.Web.Client --frozen-lockfile || (cd web/ASC.Web.Client && npm i && cd ../../) && \
npm run build --prefix web/ASC.Web.Client && \
rm -rf /var/www/studio/client/* && \
mkdir -p /var/www/studio/client && \
cp -rf web/ASC.Web.Client/build/* /var/www/studio/client
RUN echo "nameserver 8.8.8.8" | tee /etc/resolv.conf > /dev/null && \
cd /app/onlyoffice/src/ && \
component=$(ls web/ASC.Web.Components/asc-web-components-v1.*.tgz) && \
common=$(ls web/ASC.Web.Common/asc-web-common-v1.*.tgz) && \
yarn remove asc-web-components asc-web-common --cwd products/ASC.Files/Client && \
yarn add ../../../$component --cwd products/ASC.Files/Client --cache-folder ../../../yarn && \
yarn add ../../../$common --cwd products/ASC.Files/Client --cache-folder ../../../yarn && \
yarn install --cwd products/ASC.Files/Client --frozen-lockfile || (cd products/ASC.Files/Client && npm i && cd ../../../) && \
npm run build --prefix products/ASC.Files/Client && \
mkdir -p /var/www/products/ASC.Files/client && \
cp -Rf products/ASC.Files/Client/build/* /var/www/products/ASC.Files/client && \
mkdir -p /var/www/products/ASC.Files/client/products/files
RUN echo "nameserver 8.8.8.8" | tee /etc/resolv.conf > /dev/null && \
cd /app/onlyoffice/src/ && \
component=$(ls web/ASC.Web.Components/asc-web-components-v1.*.tgz) && \
common=$(ls web/ASC.Web.Common/asc-web-common-v1.*.tgz) && \
yarn remove asc-web-components asc-web-common --cwd products/ASC.People/Client && \
yarn add ../../../$component --cwd products/ASC.People/Client --cache-folder ../../../yarn && \
yarn add ../../../$common --cwd products/ASC.People/Client --cache-folder ../../../yarn && \
yarn install --cwd products/ASC.People/Client --frozen-lockfile || (cd products/ASC.People/Client && npm i && cd ../../../) && \
npm run build --prefix products/ASC.People/Client && \
mkdir -p /var/www/products/ASC.People/client && \
cp -Rf products/ASC.People/Client/build/* /var/www/products/ASC.People/client && \
mkdir -p /var/www/products/ASC.People/client/products/people
RUN echo "nameserver 8.8.8.8" | tee /etc/resolv.conf > /dev/null && \
cd /app/onlyoffice/src/ && \
#rm -f /etc/nginx/conf.d/* && \
mkdir -p /etc/nginx/conf.d/ && \
mkdir -p /var/www/public/ && cp -f public/* /var/www/public/ && \
mkdir -p /app/onlyoffice/config/ && cp -rf config/* /app/onlyoffice/config/ && \
cp -f config/nginx/onlyoffice*.conf /etc/nginx/conf.d/ && \
mkdir -p /etc/nginx/includes/ && cp -f config/nginx/includes/onlyoffice*.conf /etc/nginx/includes/ && \
sed -e 's/#//' -i /etc/nginx/conf.d/onlyoffice.conf && \
dotnet restore ASC.Web.sln --configfile .nuget/NuGet.Config && \
dotnet build -r linux-x64 ASC.Web.sln && \
cd products/ASC.People/Server && \
dotnet -d publish --no-build --self-contained -r linux-x64 -o /var/www/products/ASC.People/server && \
cd ../../../ && \
cd products/ASC.Files/Server && \
dotnet -d publish --no-build --self-contained -r linux-x64 -o /var/www/products/ASC.Files/server && \
cp -avrf DocStore /var/www/products/ASC.Files/server/ && \
cd ../../../ && \
cd products/ASC.Files/Service && \
dotnet add ASC.Files.Service.csproj reference ../../ASC.People/Server/ASC.People.csproj ../Server/ASC.Files.csproj && \
dotnet -d publish --no-build --self-contained -r linux-x64 -o /var/www/products/ASC.Files/service && \
cd ../../../ && \
cd web/ASC.Web.Api && \
dotnet -d publish --no-build --self-contained -r linux-x64 -o /var/www/studio/api && \
cd ../../ && \
cd web/ASC.Web.Studio && \
dotnet -d publish --no-build --self-contained -r linux-x64 -o /var/www/studio/server && \
cd ../../ && \
cd common/services/ASC.Data.Backup && \
dotnet -d publish --no-build --self-contained -r linux-x64 -o /var/www/services/backup && \
cd ../../../ && \
cd common/services/ASC.Notify && \
dotnet -d publish --no-build --self-contained -r linux-x64 -o /var/www/services/notify && \
cd ../../../ && \
cd common/services/ASC.ApiSystem && \
dotnet -d publish --no-build --self-contained -r linux-x64 -o /var/www/services/apisystem && \
cd ../../../ && \
cd common/services/ASC.Thumbnails.Svc && \
dotnet -d publish --no-build --self-contained -r linux-x64 -o /services/thumb/service && \
cd ../../../ && \
yarn install --cwd common/ASC.Thumbnails --frozen-lockfile && \
mkdir -p /var/www/services/thumb/client && cp -Rf common/ASC.Thumbnails/* /var/www/services/thumb/client && \
cd common/services/ASC.UrlShortener.Svc && \
dotnet -d publish --no-build --self-contained -r linux-x64 -o /services/urlshortener/service && \
cd ../../../ && \
yarn install --cwd common/ASC.UrlShortener --frozen-lockfile && \
mkdir -p /var/www/services/urlshortener/client && cp -Rf common/ASC.UrlShortener/* /var/www/services/urlshortener/client && \
cd common/services/ASC.Socket.IO.Svc && \
dotnet -d publish --no-build --self-contained -r linux-x64 -o /services/socket/service && \
cd ../../../ && \
yarn install --cwd common/ASC.Socket.IO --frozen-lockfile && \
mkdir -p /var/www/services/socket/client && cp -Rf common/ASC.Socket.IO/* /var/www/services/socket/client && \
cd common/services/ASC.Studio.Notify && \
dotnet add ASC.Studio.Notify.csproj reference ../../../products/ASC.People/Server/ASC.People.csproj ../../../products/ASC.Files/Server/ASC.Files.csproj && \
dotnet -d publish --no-build --self-contained -r linux-x64 -o /var/www/services/studio.notify
COPY config/mysql/conf.d/mysql.cnf /etc/mysql/conf.d/mysql.cnf
COPY config/supervisor/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
RUN sed -i 's/Server=.*;Port=/Server=127.0.0.1;Port=/' /app/onlyoffice/config/appsettings.test.json
RUN rm -rf /var/lib/apt/lists/*
### STAGE 2: Build ###
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1 as builder
COPY --from=develop /app/onlyoffice/config/ /app/onlyoffice/config/
# add defualt user and group for no-root run
RUN mkdir -p /var/log/onlyoffice && \
mkdir -p /app/onlyoffice/data && \
mkdir -p /var/www/services/backup && \
addgroup --system --gid 107 onlyoffice && \
adduser -uid 104 --quiet --home /var/www/onlyoffice --system --gid 107 onlyoffice && \
chown onlyoffice:onlyoffice /app/onlyoffice -R && \
chown onlyoffice:onlyoffice /var/log -R && \
chown onlyoffice:onlyoffice /var/www -R
RUN echo "nameserver 8.8.8.8" | tee /etc/resolv.conf > /dev/null && \
apt-get -y update && \
apt-get -y upgrade && \
apt-get install -yq nano &&\
apt-get install -yq jq &&\
apt-get install -yq nodejs &&\
apt-get install -yq libgdiplus
#USER onlyoffice
EXPOSE 5050
ENTRYPOINT ["./docker-entrypoint.sh"]
### STAGE 3: Run ###
## NGINX ##
FROM nginx:stable-alpine AS web
# Remove default nginx website
RUN rm -rf /usr/share/nginx/html/*
# copy artefacts and config values for nginx
COPY --from=develop /etc/nginx/conf.d /etc/nginx/conf.d
COPY --from=develop /etc/nginx/includes /etc/nginx/includes
COPY --from=develop /var/www/story /var/www/story
COPY --from=develop /var/www/products/ASC.Files/client /var/www/products/ASC.Files/client
COPY --from=develop /var/www/products/ASC.People/client /var/www/products/ASC.People/client
COPY --from=develop /var/www/public /var/www/public
COPY --from=develop /var/www/studio/client /var/www/studio/client
COPY /config/nginx/templates/upstream.conf.template /etc/nginx/templates/upstream.conf.template
# add defualt user and group for no-root run
RUN chown nginx:nginx /etc/nginx/* -R &&\
chown nginx:nginx /docker-entrypoint.d/* &&\
# changes for upstream configure
sed -i 's/localhost:5000/$service_api/' /etc/nginx/conf.d/onlyoffice.conf && \
sed -i 's/localhost:5010/$service_api_system/' /etc/nginx/conf.d/onlyoffice.conf && \
sed -i 's/localhost:5004/$service_people_server/' /etc/nginx/conf.d/onlyoffice.conf && \
sed -i 's/localhost:5007/$service_files/' /etc/nginx/conf.d/onlyoffice.conf && \
sed -i 's/localhost:5003/$service_studio/' /etc/nginx/conf.d/onlyoffice.conf && \
sed -i 's/localhost:5012/$service_backup/' /etc/nginx/conf.d/onlyoffice.conf && \
sed -i 's/localhost:9999/$service_sh/' /etc/nginx/conf.d/onlyoffice.conf && \
sed -i 's/172.*/$document_server;/' /etc/nginx/conf.d/onlyoffice.conf && \
# configute the image nginx whith less privileged https://hub.docker.com/_/nginx
sed -i 's/pid.*nginx.pid;/pid \/tmp\/nginx.pid;/' /etc/nginx/nginx.conf && \
sed -i 's/http.*{/http {\n client_body_temp_path \/tmp\/client_temp;\n proxy_temp_path \/tmp\/proxy_temp_path;\n fastcgi_temp_path \/tmp\/fastcgi_temp;\n uwsgi_temp_path \/tmp\/uwsgi_temp;\n scgi_temp_path \/tmp\/scgi_temp;/' /etc/nginx/nginx.conf
## backup ##
FROM builder AS backup
WORKDIR /var/www/services/backup/
COPY --chown=onlyoffice:onlyoffice docker-entrypoint.sh .
COPY --from=develop --chown=onlyoffice:onlyoffice /var/www/services/backup/ .
COPY --from=develop --chown=onlyoffice:onlyoffice /var/www/products/ASC.People/server/ASC.People.dll /var/www/products/ASC.People/server/
COPY --from=develop --chown=onlyoffice:onlyoffice /var/www/products/ASC.Files/server/ASC.Files*.dll /var/www/products/ASC.Files/server/
CMD ["ASC.Data.Backup.dll", "backup", "core:products:folder=/var/www/products/", "core:products:subfolder=server"]
## api ##
FROM builder AS api
WORKDIR /var/www/studio/api/
COPY --chown=onlyoffice:onlyoffice docker-entrypoint.sh .
COPY --from=develop --chown=onlyoffice:onlyoffice /var/www/studio/api .
COPY --from=develop --chown=onlyoffice:onlyoffice /var/www/products/ASC.People/server/ASC.People.dll /var/www/products/ASC.People/server/
COPY --from=develop --chown=onlyoffice:onlyoffice /var/www/products/ASC.Files/server/ASC.Files*.dll /var/www/products/ASC.Files/server/
CMD ["ASC.Web.Api.dll", "api"]
## api_system ##
FROM builder AS api_system
WORKDIR /var/www/services/apisystem/
COPY --chown=onlyoffice:onlyoffice docker-entrypoint.sh .
COPY --from=develop --chown=onlyoffice:onlyoffice /var/www/services/apisystem/ .
CMD ["ASC.ApiSystem.dll", "api_system"]
## urlshortener ##
FROM builder AS urlshortener
WORKDIR /services/urlshortener/service/
COPY --chown=onlyoffice:onlyoffice docker-entrypoint.sh .
COPY --from=develop --chown=onlyoffice:onlyoffice /services/urlshortener/service/ .
COPY --from=develop --chown=onlyoffice:onlyoffice /var/www/services/urlshortener/client /services/urlshortener/client
CMD ["ASC.UrlShortener.Svc.dll", "urlshortener"]
## studio.notify ##
FROM builder AS studio.notify
WORKDIR /var/www/services/studio.notify/
COPY --chown=onlyoffice:onlyoffice docker-entrypoint.sh .
COPY --from=develop /var/www/services/studio.notify/ .
COPY --from=develop --chown=onlyoffice:onlyoffice /var/www/products/ASC.People/server/ASC.People.dll /var/www/products/ASC.People/server/
COPY --from=develop --chown=onlyoffice:onlyoffice /var/www/products/ASC.Files/server/ASC.Files*.dll /var/www/products/ASC.Files/server/
CMD ["ASC.Studio.Notify.dll", "studio.notify", "core:products:folder=/var/www/products/", "core:products:subfolder=server"]
## notify ##
FROM builder AS notify
WORKDIR /var/www/services/notify/
COPY --chown=onlyoffice:onlyoffice docker-entrypoint.sh .
COPY --from=develop /var/www/services/notify/ .
COPY --from=develop --chown=onlyoffice:onlyoffice /var/www/products/ASC.People/server/ASC.People.dll /var/www/products/ASC.People/server/
COPY --from=develop --chown=onlyoffice:onlyoffice /var/www/products/ASC.Files/server/ASC.Files*.dll /var/www/products/ASC.Files/server/
CMD ["ASC.Notify.dll", "notify", "core:products:folder=/var/www/products/", "core:products:subfolder=server"]
## people.server ##
FROM builder AS people.server
WORKDIR /var/www/products/ASC.People/server/
COPY --chown=onlyoffice:onlyoffice docker-entrypoint.sh .
COPY --from=develop --chown=onlyoffice:onlyoffice /var/www/products/ASC.People/server/ .
COPY --from=develop --chown=onlyoffice:onlyoffice /var/www/products/ASC.Files/server/ASC.Files*.dll /var/www/products/ASC.Files/server/
CMD ["ASC.People.dll", "people.server"]
## files ##
FROM builder AS files
WORKDIR /var/www/products/ASC.Files/server/
COPY --chown=onlyoffice:onlyoffice docker-entrypoint.sh .
COPY --from=develop --chown=onlyoffice:onlyoffice /var/www/products/ASC.Files/server/ .
COPY --from=develop --chown=onlyoffice:onlyoffice /var/www/products/ASC.People/server/ASC.People.dll /var/www/products/ASC.People/server/
CMD ["ASC.Files.dll", "files"]
## files_services ##
FROM builder AS files_services
WORKDIR /var/www/products/ASC.Files/service/
COPY --chown=onlyoffice:onlyoffice docker-entrypoint.sh .
COPY --from=develop --chown=onlyoffice:onlyoffice /var/www/products/ASC.Files/service/ .
COPY --from=develop --chown=onlyoffice:onlyoffice /var/www/products/ASC.Files/server/ASC.Files*.dll /var/www/products/ASC.Files/server/
COPY --from=develop --chown=onlyoffice:onlyoffice /var/www/products/ASC.People/server/ASC.People*.dll /var/www/products/ASC.People/server/
CMD ["ASC.Files.Service.dll", "files_services", "core:products:folder=/var/www/products/", "core:products:subfolder=server"]
## studio ##
FROM builder AS studio
WORKDIR /var/www/studio/server/
COPY --chown=onlyoffice:onlyoffice docker-entrypoint.sh .
COPY --from=develop --chown=onlyoffice:onlyoffice /var/www/studio/server/ .
COPY --from=develop --chown=onlyoffice:onlyoffice /var/www/products/ASC.Files/server/ASC.Files*.dll /var/www/products/ASC.Files/server/
COPY --from=develop --chown=onlyoffice:onlyoffice /var/www/products/ASC.People/server/ASC.People.dll /var/www/products/ASC.People/server/
CMD ["ASC.Web.Studio.dll", "studio"]
## thumbnails ##
FROM builder AS thumbnails
WORKDIR /services/thumbnails/service
COPY --chown=onlyoffice:onlyoffice docker-entrypoint.sh .
COPY --from=develop --chown=onlyoffice:onlyoffice /services/thumb/service/ .
COPY --from=develop --chown=onlyoffice:onlyoffice /var/www/services/thumb/client /services/thumbnails/client
CMD ["ASC.Thumbnails.Svc.dll", "thumbnails"]
## socket ##
FROM builder AS socket
WORKDIR /services/socket/service
COPY --chown=onlyoffice:onlyoffice docker-entrypoint.sh .
COPY --from=develop --chown=onlyoffice:onlyoffice /services/socket/service/ .
COPY --from=develop --chown=onlyoffice:onlyoffice /var/www/services/socket/client /services/ASC.Socket.IO
CMD ["ASC.Socket.IO.Svc.dll", "socket"]

View File

@ -0,0 +1,27 @@
# Getting Started
* Download App run: git clone git clone https://github.com/ONLYOFFICE/AppServer.git
* cd ./AppServer/build/install/docker/
# Installation
* Build Appserver docker microservices run: docker-compose -f build.yml build
* In file .env check values and if it needs modify for JSON Web Token validation:
- list of values:
- DOCUMENT_SERVER_JWT_SECRET
- APP_CORE_MACHINEKEY
- DOCUMENT_SERVER_JWT_HEADER
* Run Appserver with Community Server:
- check file appserver.yml before running:
- app_data:/app/onlyoffice/data should be commented,
- /app/onlyoffice CommunityServer/data:/app/onlyoffice/data should be uncommented
- docker-compose -f appserver.yml up -d
* Run standlone Appserver:
- check file appserver.yml before running:
- app_data:/app/onlyoffice/data should be uncommented,
- /app/onlyoffice CommunityServer/data:/app/onlyoffice/data should be commented
- docker-compose -f db.yml up -d
- docker-compose -f ds.yml -f appserver.yml up -d

View File

@ -0,0 +1,196 @@
version: "3.6"
x-service:
&x-service-base
container_name: base
restart: always
expose:
- ${SERVICE_PORT}
environment:
MYSQL_HOST: ${MYSQL_HOST}
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
MYSQL_DATABASE: ${MYSQL_DATABASE}
MYSQL_USER: ${MYSQL_USER}
MYSQL_PASSWORD: ${MYSQL_PASSWORD}
APP_DOTNET_ENV: ${APP_DOTNET_ENV}
APP_CORE_BASE_DOMAIN: ${APP_CORE_BASE_DOMAIN}
APP_CORE_MACHINEKEY: ${APP_CORE_MACHINEKEY}
DOCUMENT_SERVER_JWT_SECRET: ${DOCUMENT_SERVER_JWT_SECRET}
DOCUMENT_SERVER_JWT_HEADER: ${DOCUMENT_SERVER_JWT_HEADER}
DOCUMENT_SERVER_URL_PUBLIC: ${DOCUMENT_SERVER_URL_PUBLIC}
DOCUMENT_SERVER_URL_INTERNAL: ${DOCUMENT_SERVER_URL_INTERNAL}
DOCUMENT_SERVER_URL_CONVERTER: ${DOCUMENT_SERVER_URL_CONVERTER}
KAFKA_HOST: ${KAFKA_HOST}
ELK_HOST: ${ELK_HOST}
PROXY_HOST: ${PROXY_HOST}
volumes:
#- /app/onlyoffice/CommunityServer/data:/app/onlyoffice/data
- app_data:/app/onlyoffice/data
services:
onlyoffice-elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:${ELK_VERSION}
container_name: ${ELK_HOST}
restart: always
environment:
- discovery.type=single-node
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
ulimits:
memlock:
soft: -1
hard: -1
nofile:
soft: 65535
hard: 65535
volumes:
- es_data:/usr/share/elasticsearch/data
expose:
- "9200"
- "9300"
onlyoffice-zookeeper:
image: zookeeper:latest
container_name: ${ZOO_HOST}
restart: always
expose:
- "2181"
environment:
ZOO_MY_ID: 1
ZOO_PORT: ${ZOO_PORT:-2181}
ZOO_SERVER: ${ZOO_SERVER}
volumes:
- zoo_data:/data
- zoo_log:/datalog
onlyoffice-kafka:
image: confluentinc/cp-kafka:latest
container_name: ${KAFKA_HOST}
restart: always
expose:
- "9092"
depends_on:
- onlyoffice-zookeeper
environment:
KAFKA_ADVERTISED_LISTENERS: ${KAFKA_ADVERTISED_LISTENERS}
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: ${KAFKA_LISTENER_SECURITY_PROTOCOL_MAP}
KAFKA_INTER_BROKER_LISTENER_NAME: ${KAFKA_INTER_BROKER_LISTENER_NAME}
KAFKA_ZOOKEEPER_CONNECT: ${KAFKA_ZOOKEEPER_CONNECT}
KAFKA_BROKER_ID: ${KAFKA_BROKER_ID}
KAFKA_LOG4J_LOGGERS: ${KAFKA_LOG4J_LOGGERS}
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: ${KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR}
volumes:
- kafka_data:/var/lib/kafka/data
onlyoffice-api:
<<: *x-service-base
image: "${REPO}/${STATUS}appserver-api:${SRV_VERSION}"
container_name: ${API_HOST}
onlyoffice-api_system:
<<: *x-service-base
image: "${REPO}/${STATUS}appserver-api_system:${SRV_VERSION}"
container_name: ${API_SYSTEM_HOST}
onlyoffice-urlshortener:
<<: *x-service-base
image: "${REPO}/${STATUS}appserver-urlshortener:${SRV_VERSION}"
container_name: ${URLSHORTENER_HOST}
expose:
- "9999"
- ${SERVICE_PORT}
onlyoffice-studio.notify:
<<: *x-service-base
image: "${REPO}/${STATUS}appserver-studio.notify:${SRV_VERSION}"
container_name: ${STUDIO_NOYIFY_HOST}
onlyoffice-notify:
<<: *x-service-base
image: "${REPO}/${STATUS}appserver-notify:${SRV_VERSION}"
container_name: ${NOTIFY_HOST}
onlyoffice-people.server:
<<: *x-service-base
image: "${REPO}/${STATUS}appserver-people.server:${SRV_VERSION}"
container_name: ${PEOPLE_SERVER_HOST}
onlyoffice-files:
<<: *x-service-base
image: "${REPO}/${STATUS}appserver-files:${SRV_VERSION}"
container_name: ${FILES_HOST}
onlyoffice-files_services:
<<: *x-service-base
image: "${REPO}/${STATUS}appserver-files_services:${SRV_VERSION}"
container_name: ${FILES_SERVICES_HOST}
onlyoffice-studio:
<<: *x-service-base
image: "${REPO}/${STATUS}appserver-studio:${SRV_VERSION}"
container_name: ${STUDIO_HOST}
onlyoffice-backup:
<<: *x-service-base
image: "${REPO}/${STATUS}appserver-backup:${SRV_VERSION}"
container_name: ${BACKUP_HOST}
onlyoffice-thumbnails:
<<: *x-service-base
image: "${REPO}/${STATUS}appserver-thumbnails:${SRV_VERSION}"
container_name: ${THUMBNAILS_HOST}
onlyoffice-socket:
<<: *x-service-base
image: "${REPO}/${STATUS}appserver-socket:${SRV_VERSION}"
container_name: ${SOCKET_HOST}
onlyoffice-proxy:
image: "${REPO}/${STATUS}appserver-proxy:${SRV_VERSION}"
container_name: ${PROXY_HOST}
restart: always
expose:
- "8081"
- "8099"
ports:
- 8092:8092
depends_on:
- onlyoffice-api
- onlyoffice-api_system
- onlyoffice-urlshortener
- onlyoffice-studio.notify
- onlyoffice-notify
- onlyoffice-people.server
- onlyoffice-files
- onlyoffice-files_services
- onlyoffice-studio
- onlyoffice-backup
- onlyoffice-thumbnails
environment:
- SERVICE_API=${SERVICE_API}
- SERVICE_API_SYSTEM=${SERVICE_API_SYSTEM}
- SERVICE_URLSHORTENER=${SERVICE_URLSHORTENER}
- SERVICE_STUDIO_NOTIFY=${SERVICE_STUDIO_NOTIFY}
- SERVICE_PEOPLE_SERVER=${SERVICE_PEOPLE_SERVER}
- SERVICE_FILES=${SERVICE_FILES}
- SERVICE_FILES_SERVICES=${SERVICE_FILES_SERVICES}
- SERVICE_STUDIO=${SERVICE_STUDIO}
- SERVICE_BACKUP=${SERVICE_BACKUP}
- SERVICE_THUMBNAILS=${SERVICE_THUMBNAILS}
- SERVICE_SH=${SERVICE_SH}
- DOCUMENT_SERVER=${DOCUMENT_SERVER_HOST}
- SERVICE_PORT=${SERVICE_PORT}
volumes:
- proxy_log:/var/log/nginx
networks:
default:
external:
name: ${NETWORK_NAME}
volumes:
kafka_data:
zoo_data:
zoo_log:
proxy_log:
app_data:
es_data:

View File

@ -0,0 +1,93 @@
version: "3.6"
services:
onlyoffice-api:
build:
context: ./
dockerfile: Dockerfile-app
target: api
image: "${REPO}/${STATUS}appserver-api:${SRV_VERSION}"
onlyoffice-api_system:
build:
context: ./
dockerfile: Dockerfile-app
target: api_system
image: "${REPO}/${STATUS}appserver-api_system:${SRV_VERSION}"
onlyoffice-urlshortener:
build:
context: ./
dockerfile: Dockerfile-app
target: urlshortener
image: "${REPO}/${STATUS}appserver-urlshortener:${SRV_VERSION}"
onlyoffice-studio.notify:
build:
context: ./
dockerfile: Dockerfile-app
target: studio.notify
image: "${REPO}/${STATUS}appserver-studio.notify:${SRV_VERSION}"
onlyoffice-notify:
build:
context: ./
dockerfile: Dockerfile-app
target: notify
image: "${REPO}/${STATUS}appserver-notify:${SRV_VERSION}"
onlyoffice-people.server:
build:
context: ./
dockerfile: Dockerfile-app
target: people.server
image: "${REPO}/${STATUS}appserver-people.server:${SRV_VERSION}"
onlyoffice-files:
build:
context: ./
dockerfile: Dockerfile-app
target: files
image: "${REPO}/${STATUS}appserver-files:${SRV_VERSION}"
onlyoffice-files_services:
build:
context: ./
dockerfile: Dockerfile-app
target: files_services
image: "${REPO}/${STATUS}appserver-files_services:${SRV_VERSION}"
onlyoffice-studio:
build:
context: ./
dockerfile: Dockerfile-app
target: studio
image: "${REPO}/${STATUS}appserver-studio:${SRV_VERSION}"
onlyoffice-backup:
build:
context: ./
dockerfile: Dockerfile-app
target: backup
image: "${REPO}/${STATUS}appserver-backup:${SRV_VERSION}"
onlyoffice-thumbnails:
build:
context: ./
dockerfile: Dockerfile-app
target: thumbnails
image: "${REPO}/${STATUS}appserver-thumbnails:${SRV_VERSION}"
onlyoffice-proxy:
build:
context: ./
dockerfile: Dockerfile-app
target: web
image: "${REPO}/${STATUS}appserver-proxy:${SRV_VERSION}"
onlyoffice-socket:
build:
context: ./
dockerfile: Dockerfile-app
target: socket
image: "${REPO}/${STATUS}appserver-socket:${SRV_VERSION}"

View File

@ -0,0 +1,4 @@
CREATE DATABASE IF NOT EXISTS `DB_NAME` CHARACTER SET utf8 COLLATE 'utf8_general_ci';
use `DB_NAME`;
set @@global.max_allowed_packet = 104857600;
set @@global.group_concat_max_len = 20971520;

View File

@ -0,0 +1,61 @@
resolver 127.0.0.11 valid=30s;
map $DOCUMENT_SERVER $document_server {
volatile;
$DOCUMENT_SERVER $DOCUMENT_SERVER;
}
map $SERVICE_API $service_api {
volatile;
$SERVICE_API $SERVICE_API;
}
map $SERVICE_API_SYSTEM $service_api_system {
volatile;
$SERVICE_API_SYSTEM $SERVICE_API_SYSTEM;
}
map $SERVICE_URLSHORTENER $service_urlshortener {
volatile;
$SERVICE_URLSHORTENER $SERVICE_URLSHORTENER;
}
map $SERVICE_THUMBNAILS $service_thumbnails {
volatile;
$SERVICE_THUMBNAILS $SERVICE_THUMBNAILS;
}
map $SERVICE_STUDIO_NOTIFY $service_studio_notify {
volatile;
$SERVICE_STUDIO_NOTIFY $SERVICE_STUDIO_NOTIFY;
}
map $SERVICE_PEOPLE_SERVER $service_people_server {
volatile;
$SERVICE_PEOPLE_SERVER $SERVICE_PEOPLE_SERVER;
}
map $SERVICE_FILES $service_files {
volatile;
$SERVICE_FILES $SERVICE_FILES;
}
map $SERVICE_FILES_SERVICES $service_files_services {
volatile;
$SERVICE_FILES_SERVICES $SERVICE_FILES_SERVICES;
}
map $SERVICE_STUDIO $service_studio {
volatile;
$SERVICE_STUDIO $SERVICE_STUDIO;
}
map $SERVICE_BACKUP $service_backup {
volatile;
$SERVICE_BACKUP $SERVICE_BACKUP;
}
map $SERVICE_SH $service_sh {
volatile;
$SERVICE_SH $SERVICE_SH;
}

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,39 @@
version: "3.6"
services:
onlyoffice-mysql-server:
image: mysql:${MYSQL_VERSION}
command: --default-authentication-plugin=mysql_native_password
cap_add:
- SYS_NICE
container_name: ${MYSQL_HOST}
restart: always
tty: true
user: mysql
expose:
- "3306"
environment:
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
MYSQL_DATABASE: ${MYSQL_DATABASE}
MYSQL_USER: ${MYSQL_USER}
MYSQL_PASSWORD: ${MYSQL_PASSWORD}
volumes:
- mysql_data:/var/lib/mysql
- ./config/mysql/conf.d/:/etc/mysql/conf.d
- ./config/createdb.sql:/docker-entrypoint-initdb.d/01_createdb.sql
- ./config/onlyoffice.sql:/docker-entrypoint-initdb.d/02_onlyoffice.sql
- ./config/onlyoffice.data.sql:/docker-entrypoint-initdb.d/03_onlyoffice.data.sql
- ./config/onlyoffice.resources.sql:/docker-entrypoint-initdb.d/04_onlyoffice.resources.sql
networks:
- ${NETWORK_NAME}
tmpfs: /var/log/mysql/
networks:
onlyoffice:
name: ${NETWORK_NAME}
driver: 'bridge'
volumes:
mysql_data:

View File

@ -0,0 +1,75 @@
#!/bin/bash
echo "##########################################################"
echo "############## Run App Service ####################"
echo "##########################################################"
PRODUCT=${PRODUCT:-"onlyoffice"}
BASE_DIR="/app/${PRODUCT}"
PARAMETERS=""
PROXY_HOST=${PROXY_HOST:-"proxy"}
SHEME=${SHEME:-"http"}
SERVICE_PORT=${SERVICE_PORT:-"5050"}
URLS=${URLS:-"${SHEME}://0.0.0.0:${SERVICE_PORT}"}
PATH_TO_CONF=${PATH_TO_CONF:-"${BASE_DIR}/config"}
LOG_DIR=${LOG_DIR:-"/var/log/${PRODUCT}"}
MYSQL_HOST=${MYSQL_HOST:-"mysql-server"}
MYSQL_DATABASE=${MYSQL_DATABASE:-${PRODUCT}}
MYSQL_USER=${MYSQL_USER:-"${PRODUCT}_user"}
MYSQL_PASSWORD=${MYSQL_PASSWORD:-"${PRODUCT}_pass"}
APP_DOTNET_ENV=${APP_DOTNET_ENV:-"test"}
APP_CORE_BASE_DOMAIN=${APP_CORE_BASE_DOMAIN:-"localhost"}
APP_URL_PORTAL=${APP_URL_PORTAL:-"${SHEME}://${PROXY_HOST}:8092"}
APP_CORE_MACHINEKEY=${APP_CORE_MACHINEKEY:-"your_core_machinekey"}
DOCUMENT_SERVER_JWT_SECRET=${DOCUMENT_SERVER_JWT_SECRET:-"your_jwt_secret"}
DOCUMENT_SERVER_JWT_HEADER=${DOCUMENT_SERVER_JWT_HEADER:-"AuthorizationJwt"}
DOCUMENT_SERVER_URL_PUBLIC=${DOCUMENT_SERVER_URL_PUBLIC:-"/ds-vpath/"}
DOCUMENT_SERVER_URL_INTERNAL=${DOCUMENT_SERVER_URL_INTERNAL:-"${SHEME}://${PRODUCT}-document-server/"}
DOCUMENT_SERVER_URL_CONVERTER=${DOCUMENT_SERVER_URL_CONVERTER:-"/ds-vpath/ConvertService.ashx"}
VIEWED_MEDIA=${VIEWED_MEDIA:-'".aac",".flac",".m4a",".mp3",".oga",".ogg",".wav",".f4v",".m4v",".mov",".mp4",".ogv",".webm",".avi"'}
FFMPEG_EXTS=${FFMPEG_EXTS:-'"avi", "mpeg", "mpg", "wmv"'}
ELK_SHEME=${ELK_SHEME:-"http"}
ELK_HOST=${ELK_HOST:-"elasticsearch"}
ELK_PORT=${ELK_PORT:-"9200"}
ELK_VALUE='"elastic": { "Scheme": "'${ELK_SHEME}'", "Host": "'${ELK_HOST}'", "Port": "'${ELK_PORT}'" },'
KAFKA_HOST=${KAFKA_HOST:-"kafka"}":9092"
APP_STORAGE_ROOT=${APP_STORAGE_ROOT:-"${BASE_DIR}/data/"}
if [ -n "$1" ]; then
DOTNET_RUN="${1}";
shift
fi
if [ -n "$1" ]; then
DOTNET_LOG_NAME="${1}";
shift
fi
while [ "$1" != "" ]; do
PARAMETERS="$PARAMETERS --${1}";
shift
done
sed -i "s!Server=.*;Pooling=!Server=${MYSQL_HOST};Port=3306;Database=${MYSQL_DATABASE};User ID=${MYSQL_USER};Password=${MYSQL_PASSWORD};Pooling=!g" ${PATH_TO_CONF}/appsettings.${APP_DOTNET_ENV}.json
sed -i "s!\"base-domain\".*,!\"base-domain\": \"${APP_CORE_BASE_DOMAIN}\",!g" ${PATH_TO_CONF}/appsettings.${APP_DOTNET_ENV}.json
sed -i "s!\"machinekey\".*,!\"machinekey\": \"${APP_CORE_MACHINEKEY}\",!g" ${PATH_TO_CONF}/appsettings.${APP_DOTNET_ENV}.json
sed -i "s!\"public\".*,!\"public\": \"${DOCUMENT_SERVER_URL_PUBLIC}\",!g" ${PATH_TO_CONF}/appsettings.${APP_DOTNET_ENV}.json
sed -i "s!\"internal\".*,!\"internal\": \"${DOCUMENT_SERVER_URL_INTERNAL}\",!g" ${PATH_TO_CONF}/appsettings.${APP_DOTNET_ENV}.json
sed -i "s!\"portal\".*!\"portal\": \"${APP_URL_PORTAL}\",!g" ${PATH_TO_CONF}/appsettings.${APP_DOTNET_ENV}.json
sed -i "s!\"viewed-media\".*!\"viewed-media\": \[${VIEWED_MEDIA}\]!g" ${PATH_TO_CONF}/appsettings.${APP_DOTNET_ENV}.json
sed -i "s!\"exts\".*!\"exts\": \[ ${FFMPEG_EXTS} \]!g" ${PATH_TO_CONF}/appsettings.${APP_DOTNET_ENV}.json
sed -i "0,/\"value\"/s!\"value\".*,!\"value\": \"${DOCUMENT_SERVER_JWT_SECRET}\",!" ${PATH_TO_CONF}/appsettings.${APP_DOTNET_ENV}.json
sed -i "s!\"header\".*!\"header\": \"${DOCUMENT_SERVER_JWT_HEADER}\"!" ${PATH_TO_CONF}/appsettings.${APP_DOTNET_ENV}.json
grep -q "${ELK_VALUE}" ${PATH_TO_CONF}/appsettings.${APP_DOTNET_ENV}.json || sed -i "s!\"files\".*!${ELK_VALUE}\n\"files\": {!" ${PATH_TO_CONF}/appsettings.${APP_DOTNET_ENV}.json
sed -i "s!\"BootstrapServers\".*!\"BootstrapServers\": \"${KAFKA_HOST}\"!g" ${PATH_TO_CONF}/kafka.${APP_DOTNET_ENV}.json
dotnet ${DOTNET_RUN} --urls=${URLS} --ENVIRONMENT=${APP_DOTNET_ENV} --'$STORAGE_ROOT'=${APP_STORAGE_ROOT} --pathToConf=${PATH_TO_CONF} --log:dir=${LOG_DIR} --log:name=${DOTNET_LOG_NAME} ${PARAMETERS}

View File

@ -0,0 +1,21 @@
version: '3.6'
services:
onlyoffice-document-server:
image: "${REPO}/${STATUS}documentserver:latest"
container_name: ${DOCUMENT_SERVER_HOST}
# Strings below enable the JSON Web Token validation.
environment:
- JWT_ENABLED=true
- JWT_SECRET=${DOCUMENT_SERVER_JWT_SECRET}
- JWT_HEADER=${DOCUMENT_SERVER_JWT_HEADER}
- JWT_IN_BODY=true
expose:
- '80'
stdin_open: true
restart: always
stop_grace_period: 60s
networks:
default:
external:
name: ${NETWORK_NAME}

View File

@ -0,0 +1,3 @@
#!/bin/bash
export SRV_VERSION=$DOCKER_TAG
docker-compose -f build.yml build --build-arg GIT_BRANCH=$SOURCE_BRANCH

View File

@ -0,0 +1,3 @@
#!/bin/bash
export SRV_VERSION=$DOCKER_TAG
docker-compose -f build.yml push

View File

@ -80,5 +80,11 @@ namespace ASC.Common.Utils
{
return GetConnectionStrings()[key];
}
public string this[string key]
{
get => Configuration[key];
set => Configuration[key] = value;
}
}
}

View File

@ -32,6 +32,7 @@
<None Remove="protos\ConsumerCacheItem.proto" />
<None Remove="protos\CreateClientProto.proto" />
<None Remove="protos\DisableClientProto.proto" />
<None Remove="protos\EncryptionSettingsProto.proto" />
<None Remove="protos\GroupCacheItem.proto" />
<None Remove="protos\NotifyInvoke.proto" />
<None Remove="protos\NotifyMessage.proto" />
@ -59,12 +60,13 @@
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.1.9" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="3.1.9" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="3.1.4" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="3.2.3" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="3.2.4" />
<PackageReference Include="System.Text.Json" Version="4.7.2" />
<PackageReference Include="Telegram.Bot" Version="15.7.1" />
</ItemGroup>
<ItemGroup>
<Protobuf Include="protos\CreateClientProto.proto" />
<Protobuf Include="protos\EncryptionSettingsProto.proto" />
<Protobuf Include="protos\NotifyInvoke.proto" />
<Protobuf Include="protos\NotifyMessage.proto" />
<Protobuf Include="protos\DisableClientProto.proto" />

View File

@ -227,8 +227,8 @@ namespace ASC.Core.Billing
Support = true,
Trial = license.Trial,
CountPortals = license.PortalCount,
DiscEncryption = license.DiscEncryption ?? !license.Trial,
PrivacyRoom = !license.Trial,
DiscEncryption = true,
PrivacyRoom = true,
};
if (defaultQuota.Name != "overdue" && !defaultQuota.Trial)
@ -236,7 +236,6 @@ namespace ASC.Core.Billing
quota.WhiteLabel |= defaultQuota.WhiteLabel;
quota.Branding |= defaultQuota.Branding;
quota.SSBranding |= defaultQuota.SSBranding;
quota.DiscEncryption |= defaultQuota.DiscEncryption;
quota.CountPortals = Math.Max(defaultQuota.CountPortals, quota.CountPortals);
}

View File

@ -67,14 +67,14 @@ namespace ASC.Core.Caching
cacheNotify.Subscribe((i) =>
{
if (i.Key == KEY_QUOTA_ROWS)
{
Interval.Expire();
}
else if (i.Key == KEY_QUOTA)
if (i.Key == KEY_QUOTA)
{
Cache.Remove(KEY_QUOTA);
}
else
{
Cache.Remove(i.Key);
}
}, CacheNotifyAction.Any);
}
}
@ -168,75 +168,26 @@ namespace ASC.Core.Caching
public void SetTenantQuotaRow(TenantQuotaRow row, bool exchange)
{
Service.SetTenantQuotaRow(row, exchange);
CacheNotify.Publish(new QuotaCacheItem { Key = QuotaServiceCache.KEY_QUOTA_ROWS }, CacheNotifyAction.Any);
CacheNotify.Publish(new QuotaCacheItem { Key = GetKey(row.Tenant) }, CacheNotifyAction.InsertOrUpdate);
}
public IEnumerable<TenantQuotaRow> FindTenantQuotaRows(TenantQuotaRowQuery query)
public IEnumerable<TenantQuotaRow> FindTenantQuotaRows(int tenantId)
{
if (query == null) throw new ArgumentNullException("query");
var key = GetKey(tenantId);
var result = Cache.Get<IEnumerable<TenantQuotaRow>>(key);
var rows = Cache.Get<Dictionary<string, List<TenantQuotaRow>>>(QuotaServiceCache.KEY_QUOTA_ROWS);
if (rows == null || Interval.Expired)
if (result == null)
{
var date = rows != null ? Interval.StartTime : DateTime.MinValue;
Interval.Start(CacheExpiration);
var changes = Service.FindTenantQuotaRows(new TenantQuotaRowQuery(Tenant.DEFAULT_TENANT).WithLastModified(date))
.GroupBy(r => r.Tenant.ToString())
.ToDictionary(g => g.Key, g => g.ToList());
// merge changes from db to cache
if (rows == null)
{
rows = changes;
}
else
{
lock (rows)
{
foreach (var p in changes)
{
if (rows.ContainsKey(p.Key))
{
var cachedRows = rows[p.Key];
foreach (var r in p.Value)
{
cachedRows.RemoveAll(c => c.Path == r.Path);
cachedRows.Add(r);
}
}
else
{
rows[p.Key] = p.Value;
}
}
}
result = Service.FindTenantQuotaRows(tenantId);
Cache.Insert(key, result, DateTime.UtcNow.Add(CacheExpiration));
}
if (QuotaServiceCache.QuotaCacheEnabled)
{
Cache.Insert(QuotaServiceCache.KEY_QUOTA_ROWS, rows, DateTime.UtcNow.Add(CacheExpiration));
}
return result;
}
var quotaRows = Cache.Get<Dictionary<string, List<TenantQuotaRow>>>(QuotaServiceCache.KEY_QUOTA_ROWS);
if (quotaRows == null)
public string GetKey(int tenant)
{
return Enumerable.Empty<TenantQuotaRow>();
}
lock (quotaRows)
{
var list = quotaRows.ContainsKey(query.Tenant.ToString()) ?
quotaRows[query.Tenant.ToString()] :
new List<TenantQuotaRow>();
if (query != null && !string.IsNullOrEmpty(query.Path))
{
return list.Where(r => query.Path == r.Path);
}
return list.ToList();
}
return QuotaServiceCache.KEY_QUOTA_ROWS + tenant;
}
}
}

View File

@ -140,6 +140,16 @@ namespace ASC.Core.Caching
}
}
public string[] GetRecipients(int tenant, string sourceID, string actionID, string objectID)
{
return service.GetRecipients(tenant, sourceID, actionID, objectID);
}
public string[] GetSubscriptions(int tenant, string sourceId, string actionId, string recipientId, bool checkSubscribe)
{
return service.GetSubscriptions(tenant, sourceId, actionId, recipientId, checkSubscribe);
}
public SubscriptionRecord GetSubscription(int tenant, string sourceId, string actionId, string recipientId, string objectId)
{
var store = GetSubsciptionsStore(tenant, sourceId, actionId);
@ -195,7 +205,12 @@ namespace ASC.Core.Caching
}
return store;
}
public bool IsUnsubscribe(int tenant, string sourceId, string actionId, string recipientId, string objectId)
{
return service.IsUnsubscribe(tenant, sourceId, actionId, recipientId, objectId);
}
}
internal class SubsciptionsStore
{
private readonly List<SubscriptionRecord> records;

View File

@ -259,6 +259,12 @@ namespace ASC.Core.Caching
}
}
public UserInfo GetUser(int tenant, string email)
{
return Service.GetUser(tenant, email);
}
/// <summary>
/// For Personal only
/// </summary>

View File

@ -176,7 +176,7 @@ namespace ASC.Core.Common.Configuration
{
if (!CanSet)
{
throw new NotSupportedException("Key for read only.");
throw new NotSupportedException("Key for read only. Consumer " + Name);
}
foreach (var providerProp in Props)
@ -258,7 +258,7 @@ namespace ASC.Core.Common.Configuration
{
if (!CanSet)
{
throw new NotSupportedException("Key for read only.");
throw new NotSupportedException("Key for read only. Key " + name);
}
if (!ManagedKeys.Contains(name))

View File

@ -107,7 +107,7 @@ namespace ASC.Core.Configuration
{
throw new ArgumentException("Empty user name.", "userName");
}
if (string.IsNullOrEmpty("password"))
if (string.IsNullOrEmpty(password))
{
throw new ArgumentException("Empty password.", "password");
}

View File

@ -25,9 +25,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using ASC.Common;
using ASC.Common.Caching;
using ASC.Common.Security.Authorizing;
namespace ASC.Core
{
@ -38,10 +41,26 @@ namespace ASC.Core
private TenantManager TenantManager { get; }
private ICache Cache { get; set; }
public static readonly object CacheLocker;
public static readonly List<Guid> Groups;
static SubscriptionManager()
{
CacheLocker = new object();
Groups = new List<Guid>
{
Constants.Admin.ID,
Constants.Everyone.ID,
Constants.User.ID
};
}
public SubscriptionManager(ISubscriptionService service, TenantManager tenantManager)
{
this.service = service ?? throw new ArgumentNullException("subscriptionManager");
TenantManager = tenantManager;
Cache = AscCache.Memory;
}
@ -85,25 +104,31 @@ namespace ASC.Core
public string[] GetSubscriptionMethod(string sourceID, string actionID, string recipientID)
{
var m = service.GetSubscriptionMethods(GetTenant(), sourceID, actionID, recipientID)
IEnumerable<SubscriptionMethod> methods;
if (Groups.Any(r => r.ToString() == recipientID))
{
methods = GetDefaultSubscriptionMethodsFromCache(sourceID, actionID, recipientID);
}
else
{
methods = service.GetSubscriptionMethods(GetTenant(), sourceID, actionID, recipientID);
}
var m = methods
.FirstOrDefault(x => x.ActionId.Equals(actionID, StringComparison.OrdinalIgnoreCase));
if (m == null)
{
m = service.GetSubscriptionMethods(GetTenant(), sourceID, actionID, recipientID).FirstOrDefault();
}
if (m == null)
{
m = service.GetSubscriptionMethods(GetTenant(), sourceID, actionID, Guid.Empty.ToString()).FirstOrDefault();
m = methods.FirstOrDefault();
}
return m != null ? m.Methods : new string[0];
}
public string[] GetRecipients(string sourceID, string actionID, string objectID)
{
return service.GetSubscriptions(GetTenant(), sourceID, actionID, null, objectID)
.Where(s => s.Subscribed)
.Select(s => s.RecipientId)
.ToArray();
return service.GetRecipients(GetTenant(), sourceID, actionID, objectID);
}
public object GetSubscriptionRecord(string sourceID, string actionID, string recipientID, string objectID)
@ -113,20 +138,12 @@ namespace ASC.Core
public string[] GetSubscriptions(string sourceID, string actionID, string recipientID, bool checkSubscribe = true)
{
return service.GetSubscriptions(GetTenant(), sourceID, actionID, recipientID, null)
.Where(s => !checkSubscribe || s.Subscribed)
.Select(s => s.ObjectId)
.ToArray();
return service.GetSubscriptions(GetTenant(), sourceID, actionID, recipientID, checkSubscribe);
}
public bool IsUnsubscribe(string sourceID, string recipientID, string actionID, string objectID)
{
var s = service.GetSubscription(GetTenant(), sourceID, actionID, recipientID, objectID);
if (s == null && !string.IsNullOrEmpty(objectID))
{
s = service.GetSubscription(GetTenant(), sourceID, actionID, recipientID, null);
}
return s != null && !s.Subscribed;
return service.IsUnsubscribe(GetTenant(), sourceID, actionID, recipientID, objectID);
}
public void UpdateSubscriptionMethod(string sourceID, string actionID, string recipientID, string[] senderNames)
@ -142,6 +159,22 @@ namespace ASC.Core
service.SetSubscriptionMethod(m);
}
private IEnumerable<SubscriptionMethod> GetDefaultSubscriptionMethodsFromCache(string sourceID, string actionID, string recepient)
{
lock (CacheLocker)
{
var key = $"subs|-1{sourceID}{actionID}{recepient}";
var result = Cache.Get<IEnumerable<SubscriptionMethod>>(key);
if (result == null)
{
result = service.GetSubscriptionMethods(-1, sourceID, actionID, recepient);
Cache.Insert(key, result, DateTime.UtcNow.AddDays(1));
}
return result;
}
}
private int GetTenant()
{

View File

@ -349,9 +349,9 @@ namespace ASC.Core
QuotaService.SetTenantQuotaRow(row, exchange);
}
public List<TenantQuotaRow> FindTenantQuotaRows(TenantQuotaRowQuery query)
public List<TenantQuotaRow> FindTenantQuotaRows(int tenantId)
{
return QuotaService.FindTenantQuotaRows(query).ToList();
return QuotaService.FindTenantQuotaRows(tenantId).ToList();
}
}
}

View File

@ -66,6 +66,7 @@ namespace ASC.Core
private TenantManager TenantManager { get; }
private PermissionContext PermissionContext { get; }
private UserManagerConstants UserManagerConstants { get; }
public CoreBaseSettings CoreBaseSettings { get; }
private Constants Constants { get; }
private Tenant tenant;
@ -80,12 +81,14 @@ namespace ASC.Core
IUserService service,
TenantManager tenantManager,
PermissionContext permissionContext,
UserManagerConstants userManagerConstants)
UserManagerConstants userManagerConstants,
CoreBaseSettings coreBaseSettings)
{
UserService = service;
TenantManager = tenantManager;
PermissionContext = permissionContext;
UserManagerConstants = userManagerConstants;
CoreBaseSettings = coreBaseSettings;
Constants = UserManagerConstants.Constants;
}
@ -94,8 +97,9 @@ namespace ASC.Core
TenantManager tenantManager,
PermissionContext permissionContext,
UserManagerConstants userManagerConstants,
CoreBaseSettings coreBaseSettings,
IHttpContextAccessor httpContextAccessor)
: this(service, tenantManager, permissionContext, userManagerConstants)
: this(service, tenantManager, permissionContext, userManagerConstants, coreBaseSettings)
{
Accessor = httpContextAccessor;
}
@ -232,6 +236,13 @@ namespace ASC.Core
{
if (string.IsNullOrEmpty(email)) return Constants.LostUser;
if (CoreBaseSettings.Personal)
{
var u = UserService.GetUser(Tenant.TenantId, email);
return u != null && !u.Removed ? u : Constants.LostUser;
}
return GetUsersInternal()
.FirstOrDefault(u => string.Compare(u.Email, email, StringComparison.CurrentCultureIgnoreCase) == 0) ?? Constants.LostUser;
}

View File

@ -44,8 +44,7 @@ namespace ASC.Core
void RemoveTenantQuota(int id);
IEnumerable<TenantQuotaRow> FindTenantQuotaRows(TenantQuotaRowQuery query);
IEnumerable<TenantQuotaRow> FindTenantQuotaRows(int tenantId);
void SetTenantQuotaRow(TenantQuotaRow row, bool exchange);
}

View File

@ -27,20 +27,25 @@
using System.Collections.Generic;
using ASC.Common;
using ASC.Core.Caching;
using ASC.Core.Data;
namespace ASC.Core
{
[Scope(typeof(DbSubscriptionService), typeof(CachedSubscriptionService))]
[Scope(typeof(DbSubscriptionService))]
public interface ISubscriptionService
{
string[] GetRecipients(int tenant, string sourceID, string actionID, string objectID);
IEnumerable<SubscriptionRecord> GetSubscriptions(int tenant, string sourceId, string actionId);
IEnumerable<SubscriptionRecord> GetSubscriptions(int tenant, string sourceId, string actionId, string recipientId, string objectId);
string[] GetSubscriptions(int tenant, string sourceId, string actionId, string recipientId, bool checkSubscribe);
SubscriptionRecord GetSubscription(int tenant, string sourceId, string actionId, string recipientId, string objectId);
bool IsUnsubscribe(int tenant, string sourceId, string actionId, string recipientId, string objectId);
void SaveSubscription(SubscriptionRecord s);
void RemoveSubscriptions(int tenant, string sourceId, string actionId);

View File

@ -57,6 +57,8 @@ namespace ASC.Core
UserInfo GetUser(int tenant, Guid id);
UserInfo GetUser(int tenant, string email);
UserInfo GetUser(int tenant, Guid id, Expression<Func<User, UserInfo>> exp);
UserInfo GetUserByPasswordHash(int tenant, string login, string passwordHash);

View File

@ -182,27 +182,14 @@ namespace ASC.Core.Data
tx.Commit();
}
public IEnumerable<TenantQuotaRow> FindTenantQuotaRows(TenantQuotaRowQuery query)
public IEnumerable<TenantQuotaRow> FindTenantQuotaRows(int tenantId)
{
if (query == null) throw new ArgumentNullException("query");
IQueryable<DbQuotaRow> q = CoreDbContext.QuotaRows;
if (query.Tenant != Tenant.DEFAULT_TENANT)
if (tenantId != Tenant.DEFAULT_TENANT)
{
q = q.Where(r => r.Tenant == query.Tenant);
q = q.Where(r => r.Tenant == tenantId);
}
if (!string.IsNullOrEmpty(query.Path))
{
q = q.Where(r => r.Path == query.Path);
}
if (query.LastModified != default)
{
q = q.Where(r => r.LastModified >= query.LastModified);
}
return q.Select(FromDbQuotaRowToTenantQuotaRow).ToList();
}

View File

@ -65,6 +65,19 @@ namespace ASC.Core.Data
};
}
public string[] GetRecipients(int tenant, string sourceId, string actionId, string objectId)
{
if (sourceId == null) throw new ArgumentNullException("sourceId");
if (actionId == null) throw new ArgumentNullException("actionId");
var q = GetQuery(tenant, sourceId, actionId)
.Where(r => r.Object == (objectId ?? string.Empty))
.Where(r => !r.Unsubscribed)
.Select(r => r.Recipient)
.Distinct();
return q.ToArray();
}
public IEnumerable<SubscriptionRecord> GetSubscriptions(int tenant, string sourceId, string actionId)
{
@ -99,9 +112,53 @@ namespace ASC.Core.Data
.Where(r => r.Recipient == recipientId)
.Where(r => r.Object == (objectId ?? string.Empty));
return GetSubscriptions(q, tenant).FirstOrDefault();
return GetSubscriptions(q, tenant).Take(1).FirstOrDefault();
}
public bool IsUnsubscribe(int tenant, string sourceId, string actionId, string recipientId, string objectId)
{
if (recipientId == null) throw new ArgumentNullException("recipientId");
if (sourceId == null) throw new ArgumentNullException("sourceId");
if (actionId == null) throw new ArgumentNullException("actionId");
var q = UserDbContext.Subscriptions
.Where(r => r.Source == sourceId &&
r.Action == actionId &&
r.Tenant == tenant &&
r.Recipient == recipientId &&
r.Unsubscribed);
if (!string.IsNullOrEmpty(objectId))
{
q = q.Where(r=> r.Object == objectId || r.Object == string.Empty);
}
else
{
q = q = q.Where(r => r.Object == string.Empty);;
}
return q.Any();
}
public string[] GetSubscriptions(int tenant, string sourceId, string actionId, string recipientId, bool checkSubscribe)
{
if (recipientId == null) throw new ArgumentNullException("recipientId");
if (sourceId == null) throw new ArgumentNullException("sourceId");
if (actionId == null) throw new ArgumentNullException("actionId");
var q = GetQuery(tenant, sourceId, actionId)
.Where(r=> r.Recipient == recipientId)
.Distinct();
if (checkSubscribe)
{
q = q.Where(r=> !r.Unsubscribed);
}
return q.Select(r=> r.Object).ToArray();
}
public void SaveSubscription(SubscriptionRecord s)
{
if (s == null) throw new ArgumentNullException("s");
@ -171,24 +228,26 @@ namespace ASC.Core.Data
.Distinct();
var methods = a.Select(FromDbSubscriptionMethodToSubscriptionMethod).ToList();
var result = methods.ToList();
var methods = a.ToList();
var result = new List<SubscriptionMethod>();
var common = new Dictionary<string, SubscriptionMethod>();
foreach (var m in methods)
var conv = FromDbSubscriptionMethodToSubscriptionMethod.Compile();
foreach (var r in methods)
{
var m = conv(r);
var key = m.SourceId + m.ActionId + m.RecipientId;
if (m.Tenant == Tenant.DEFAULT_TENANT)
{
m.Tenant = tenant;
common.Add(key, m);
result.Add(m);
}
else
{
if (common.TryGetValue(key, out var r))
if (!common.TryGetValue(key, out var rec))
{
result.Remove(r);
result.Add(rec);
}
}
}
@ -250,23 +309,26 @@ namespace ASC.Core.Data
private IEnumerable<SubscriptionRecord> GetSubscriptions(IQueryable<Subscription> q, int tenant)
{
var subs = q.Select(FromSubscriptionToSubscriptionRecord).ToList();
var result = subs.ToList();
var subs = q.ToList();
var result = new List<SubscriptionRecord>();
var common = new Dictionary<string, SubscriptionRecord>();
foreach (var s in subs)
var conv = FromSubscriptionToSubscriptionRecord.Compile();
foreach (var r in subs)
{
var s = conv(r);
var key = s.SourceId + s.ActionId + s.RecipientId + s.ObjectId;
if (s.Tenant == Tenant.DEFAULT_TENANT)
{
s.Tenant = tenant;
common.Add(key, s);
result.Add(s);
}
else
{
if (common.TryGetValue(key, out var r))
if (common.TryGetValue(key, out var rec))
{
result.Remove(r);
result.Remove(rec);
}
}
}

View File

@ -223,6 +223,13 @@ namespace ASC.Core.Data
.FirstOrDefault();
}
public UserInfo GetUser(int tenant, string email)
{
return GetUserQuery(tenant, default(DateTime))
.Select(FromUserToUserInfo)
.FirstOrDefault(r=> r.Email == email && !r.Removed);
}
public UserInfo GetUserByPasswordHash(int tenant, string login, string passwordHash)
{
if (string.IsNullOrEmpty(login)) throw new ArgumentNullException("login");
@ -259,8 +266,9 @@ namespace ASC.Core.Data
.Where(r => r.Email == login)
;
var user = q.Select(FromUserToUserInfo).Take(1).FirstOrDefault();
if (user != null)
var users = q.Select(FromUserToUserInfo).ToList();
UserInfo result = null;
foreach (var user in users)
{
RegeneratePassword(tenant, user.ID);
@ -270,27 +278,40 @@ namespace ASC.Core.Data
var any = UserDbContext.UserSecurity
.Any(r => r.UserId == user.ID && (r.PwdHash == pwdHash || r.PwdHash == oldHash));//todo: remove old scheme
if (any) return user;
if (any)
{
if (tenant != Tenant.DEFAULT_TENANT) return user;
//need for regenerate all passwords only
//todo: remove with old scheme
result = user;
}
}
return null;
return result;
}
}
//todo: remove
private void RegeneratePassword(int tenant, Guid userId)
{
var h2 = UserDbContext.UserSecurity
.Where(r => r.Tenant == tenant)
.Where(r => r.UserId == userId)
.Select(r => r.PwdHashSha512)
var q = UserDbContext.UserSecurity
.Where(r => r.UserId == userId);
if (tenant != Tenant.DEFAULT_TENANT)
{
q = q.Where(r => r.Tenant == tenant);
}
var h2 = q.Select(r => new { r.Tenant, r.PwdHashSha512 })
.Take(1)
.FirstOrDefault();
if (string.IsNullOrEmpty(h2)) return;
var password = Crypto.GetV(h2, 1, false);
if (h2 == null || string.IsNullOrEmpty(h2.PwdHashSha512)) return;
var password = Crypto.GetV(h2.PwdHashSha512, 1, false);
var passwordHash = PasswordHasher.GetClientPassword(password);
SetUserPasswordHash(tenant, userId, passwordHash);
SetUserPasswordHash(h2.Tenant, userId, passwordHash);
}
public IDictionary<string, UserGroupRef> GetUserGroupRefs(int tenant, DateTime from)

View File

@ -24,6 +24,7 @@ namespace ASC.Core.Common.EF
}
internal string MigrateAssembly { get; set; }
internal ILoggerFactory LoggerFactory { get; set; }
internal ConnectionStringSettings ConnectionStringSettings { get; set; }
protected internal Provider Provider { get; set; }
@ -33,7 +34,7 @@ namespace ASC.Core.Common.EF
get { return null; }
}
internal void Migrate()
public void Migrate()
{
if (ProviderContext != null)
{
@ -42,6 +43,7 @@ namespace ASC.Core.Common.EF
using var sqlProvider = ProviderContext[provider]();
sqlProvider.ConnectionStringSettings = ConnectionStringSettings;
sqlProvider.LoggerFactory = LoggerFactory;
sqlProvider.MigrateAssembly = MigrateAssembly;
sqlProvider.Database.Migrate();
}
@ -59,12 +61,19 @@ namespace ASC.Core.Common.EF
switch (Provider)
{
case Provider.MySql:
optionsBuilder.UseMySql(ConnectionStringSettings.ConnectionString);
optionsBuilder.UseMySql(ConnectionStringSettings.ConnectionString, r=>
{
if (!string.IsNullOrEmpty(MigrateAssembly))
{
r = r.MigrationsAssembly(MigrateAssembly);
}
});
break;
case Provider.Postgre:
optionsBuilder.UseNpgsql(ConnectionStringSettings.ConnectionString);
break;
}
}
public Provider GetProviderByConnectionString()

View File

@ -26,6 +26,7 @@ namespace ASC.Core.Common.EF
{
context.LoggerFactory = LoggerFactory;
context.ConnectionStringSettings = Configuration.GetConnectionStrings(name) ?? Configuration.GetConnectionStrings(baseName);
context.MigrateAssembly = Configuration["testAssembly"];
}
public void Configure(T context)

View File

@ -99,8 +99,7 @@ namespace ASC.Core.Common.EF
ActivationStatus = 0,
WorkFromDate = DateTime.UtcNow,
LastModified = DateTime.UtcNow
}
);
});
return modelBuilder;
}

View File

@ -42,8 +42,7 @@ namespace ASC.Core.Common.EF
PwdHash = "vLFfghR5tNV3K9DKhmwArV+SbjWAcgZZzIDTnJ0JgCo=",
PwdHashSha512 = "USubvPlB+ogq0Q1trcSupg==",
LastModified = DateTime.UtcNow
}
);
});
return modelBuilder;
}

View File

@ -29,10 +29,9 @@ using System.Security.Cryptography;
using ASC.Common;
using ASC.Common.Caching;
using ASC.Core;
using ASC.Security.Cryptography;
namespace ASC.Data.Storage.Encryption
namespace ASC.Core.Encryption
{
public class EncryptionSettings
{
@ -151,7 +150,7 @@ namespace ASC.Data.Storage.Encryption
for (var i = 0; i < length; i++)
{
var num2 = (int)array[i] % 87;
var num2 = array[i] % 87;
if (num2 < 10)
{
array2[i] = (char)(48 + num2);

View File

@ -26,7 +26,7 @@
using System.IO;
namespace ASC.Data.Storage.Encryption
namespace ASC.Core.Encryption
{
public interface ICrypt
{
@ -39,5 +39,7 @@ namespace ASC.Data.Storage.Encryption
Stream GetReadStream(string filePath);
long GetFileSize(string filePath);
void Init(string storageName, EncryptionSettings encryptionSettings);
}
}

View File

@ -206,7 +206,6 @@ namespace ASC.Core
tenant.OwnerId = user.ID;
tenant = TenantService.SaveTenant(CoreSettings, tenant);
SettingsManager.SaveSettings(new TenantAnalyticsSettings() { Analytics = ri.Analytics }, tenant.TenantId);
SettingsManager.SaveSettings(new TenantControlPanelSettings { LimitedAccess = ri.LimitedControlPanel }, tenant.TenantId);
}

View File

@ -3,6 +3,7 @@ using System;
using ASC.Core.Common.EF.Context;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace ASC.Core.Common.Migrations.MySql.TenantDbContextMySql
{
@ -13,7 +14,7 @@ namespace ASC.Core.Common.Migrations.MySql.TenantDbContextMySql
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "3.1.8")
.HasAnnotation("ProductVersion", "3.1.9")
.HasAnnotation("Relational:MaxIdentifierLength", 64);
modelBuilder.Entity("ASC.Core.Common.EF.Model.DbCoreSettings", b =>
@ -49,21 +50,21 @@ namespace ASC.Core.Common.Migrations.MySql.TenantDbContextMySql
{
Tenant = -1,
Id = "CompanyWhiteLabelSettings",
LastModified = new DateTime(2020, 10, 6, 10, 14, 35, 611, DateTimeKind.Utc).AddTicks(4820),
LastModified = new DateTime(2020, 12, 22, 14, 54, 11, 757, DateTimeKind.Utc).AddTicks(3752),
Value = new byte[] { 48, 120, 70, 53, 52, 55, 48, 52, 56, 65, 52, 56, 54, 53, 49, 55, 49, 53, 56, 55, 68, 57, 67, 69, 66, 67, 56, 65, 52, 57, 54, 67, 54, 48, 49, 68, 57, 54, 48, 51, 49, 70, 50, 67, 49, 67, 51, 69, 57, 49, 54, 48, 51, 53, 51, 57, 52, 50, 69, 69, 55, 54, 53, 68, 65, 67, 68, 51, 49, 54, 70, 52, 66, 53, 70, 52, 50, 56, 57, 50, 52, 51, 54, 70, 67, 52, 65, 50, 49, 66, 57, 65, 54, 68, 70, 56, 70, 70, 68, 51, 66, 67, 52, 48, 51, 54, 66, 52, 55, 69, 51, 65, 53, 65, 49, 66, 52, 67, 56, 56, 49, 66, 50, 54, 54, 48, 57, 56, 54, 57, 70, 69, 66, 66, 54, 56, 52, 56, 66, 68, 56, 56, 67, 48, 50, 69, 69, 65, 67, 54, 65, 52, 67, 67, 66, 51, 69, 56, 70, 52, 48, 52, 50, 57, 48, 56, 49, 50, 70, 48, 69, 54, 69, 49, 50, 52, 65, 53, 53, 50, 66, 69, 56, 49, 65, 53, 56, 67, 54, 52, 66, 66, 56, 66, 68, 51, 67, 57, 65, 56, 67, 48, 69, 68, 69, 49, 70, 57, 52, 50, 49, 50, 56, 49, 68, 69, 48, 67, 55, 65, 70, 56, 50, 55, 51, 51, 67, 48, 66, 55, 53, 52, 69, 57, 55, 69, 70, 70, 70, 65, 53, 65, 55, 53, 54, 48, 55, 65, 57, 49, 57, 53, 55, 56, 57, 54, 67, 66, 69, 67, 70, 57, 53, 54, 51, 70, 67, 56, 51, 49, 51, 48, 48, 68, 67, 56, 69, 55, 67, 57, 51, 48, 65, 53, 53, 66, 50, 57, 56, 69, 66, 56, 50, 68, 54, 70, 54, 57, 69, 48, 69, 68, 54, 69, 52, 68, 56, 55, 53, 50, 54, 48, 55, 70, 49, 56, 56, 49, 70, 54, 49, 66, 48, 51, 50, 51, 48, 54, 69, 48, 70, 48, 54, 57, 65, 53, 70, 54, 57, 70, 48, 56, 54, 65, 49, 55, 55, 69, 66, 52, 49, 65, 67, 48, 54, 70, 56, 56, 57, 69, 66, 48, 66, 51, 57, 67, 66, 70, 68, 52, 66, 53, 67, 68, 66, 55, 54, 51, 69, 57, 57, 54, 53, 53, 52, 68, 69, 65, 68, 66, 57, 67, 55, 49, 67, 70, 51, 69, 70, 56, 54, 70, 52, 65, 48, 51, 53, 52, 65, 56, 54, 52, 65, 49, 48, 54, 51, 57, 68, 70, 68, 50, 57, 66, 53, 67, 54, 68, 53, 68, 67, 68, 65, 57, 68, 52, 66, 48, 57, 56, 56, 69, 69, 52, 48, 54, 57, 52, 56, 66, 67, 66, 53, 52, 67, 54, 65, 55, 48, 65, 68, 67, 54, 67, 48, 48, 53, 55, 55, 49, 55, 52, 50, 56, 53, 67, 69, 66, 67, 68, 55, 54 }
},
new
{
Tenant = -1,
Id = "FullTextSearchSettings",
LastModified = new DateTime(2020, 10, 6, 10, 14, 35, 611, DateTimeKind.Utc).AddTicks(6072),
LastModified = new DateTime(2020, 12, 22, 14, 54, 11, 757, DateTimeKind.Utc).AddTicks(4636),
Value = new byte[] { 48, 120, 48, 56, 55, 56, 67, 70, 48, 53, 57, 57, 66, 53, 49, 55, 67, 65, 65, 50, 68, 51, 68, 65, 69, 68, 57, 68, 48, 54, 52, 67, 51, 69, 68, 67, 69, 69, 65, 70, 52, 51, 49, 70, 51, 53, 65, 54, 70, 54, 52, 50, 68, 67, 65, 68, 65, 48, 52, 56, 49, 55, 69, 51, 53, 49, 51, 50, 50, 55, 66, 66, 66, 49, 68, 69, 54, 69, 50, 66, 65, 66, 69, 66, 57, 69, 49, 48, 55, 55, 66, 50, 67, 70, 51, 49, 56, 67, 52, 56, 57, 56, 49, 52, 53, 52, 53, 69, 56, 55, 55, 53, 48, 49, 70, 54, 51, 51, 70, 66, 66, 69, 57, 52, 48, 50, 50, 67, 70, 67, 68, 68, 48, 50, 53, 66, 53, 51, 57, 53, 57, 55, 51, 65, 70, 53, 49, 48, 57, 52, 51, 52, 48, 56, 66, 66, 53, 54, 57, 54, 50, 69, 69, 51, 53, 68, 65, 51, 53, 70, 50, 70, 56, 51, 55, 52, 67, 70, 53, 70, 68, 49, 50, 54, 57, 53, 51, 53, 57, 52, 52, 57, 68, 55, 67, 69, 70, 66, 67, 50, 67, 55, 66, 68, 49, 49, 50, 65, 69, 53, 56, 55, 53, 50, 49, 55, 57, 65, 65, 50, 65, 53, 57, 69, 53, 69, 49, 55, 56, 48, 49, 69, 53, 56, 48, 67, 67, 67, 54, 48, 70, 65, 69, 67, 56, 69, 66, 68, 68, 51, 68, 54, 49, 50, 67, 52, 56, 56, 54, 54, 54, 54, 68, 57, 54, 68, 54, 67, 70, 48, 54, 48, 54, 48, 53, 69, 54, 52, 67, 57, 48, 65, 49, 70, 65, 65, 56, 48, 67, 48 }
},
new
{
Tenant = -1,
Id = "SmtpSettings",
LastModified = new DateTime(2020, 10, 6, 10, 14, 35, 611, DateTimeKind.Utc).AddTicks(6099),
LastModified = new DateTime(2020, 12, 22, 14, 54, 11, 757, DateTimeKind.Utc).AddTicks(4656),
Value = new byte[] { 48, 120, 70, 48, 53, 50, 69, 48, 57, 48, 65, 49, 65, 51, 55, 53, 48, 68, 65, 68, 67, 68, 52, 69, 57, 57, 54, 49, 68, 65, 48, 52, 65, 65, 53, 49, 69, 70, 48, 49, 57, 55, 69, 50, 67, 48, 54, 50, 51, 67, 70, 49, 50, 67, 53, 56, 51, 56, 66, 70, 65, 52, 48, 65, 57, 66, 52, 56, 66, 65, 69, 70, 67, 66, 69, 51, 55, 49, 53, 56, 55, 55, 51, 49, 68, 55, 69, 51, 68, 67, 57, 69, 55, 67, 54, 48, 48, 57, 55, 52, 50, 70, 57, 69, 52, 49, 53, 68, 53, 54, 68, 66, 48, 70, 48, 65, 69, 48, 56, 69, 51, 50, 70, 56, 57, 48, 52, 66, 50, 67, 52, 52, 49, 67, 67, 54, 53, 55, 67, 54, 52, 53, 52, 51, 69, 65, 69, 69, 50, 54, 50, 48, 52, 52, 65, 50, 56, 66, 52, 51, 51, 53, 68, 67, 66, 48, 70, 48, 67, 52, 69, 57, 52, 48, 49, 68, 56, 57, 49, 70, 65, 48, 54, 51, 54, 57, 70, 57, 56, 52, 67, 65, 50, 68, 52, 55, 53, 67, 56, 54, 67, 50, 51, 55, 57, 49, 55, 57, 54, 49, 67, 53, 56, 50, 55, 55, 54, 57, 56, 51, 49, 53, 56, 53, 50, 51, 48, 65, 54, 54, 65, 67, 55, 55, 56, 55, 69, 54, 70, 66, 53, 54, 70, 68, 51, 69, 51, 55, 51, 56, 57, 50, 54, 55, 65, 52, 54, 65 }
});
});
@ -185,13 +186,10 @@ namespace ASC.Core.Common.Migrations.MySql.TenantDbContextMySql
.HasColumnType("int")
.HasDefaultValueSql("'2'");
b.Property<DateTime>("VersionChanged")
b.Property<DateTime?>("Version_Changed")
.HasColumnName("version_changed")
.HasColumnType("datetime");
b.Property<DateTime?>("Version_Changed")
.HasColumnType("datetime(6)");
b.HasKey("Id");
b.HasIndex("LastModified")
@ -203,7 +201,7 @@ namespace ASC.Core.Common.Migrations.MySql.TenantDbContextMySql
b.HasIndex("Version")
.HasName("version");
b.ToTable("tenants_tenants","onlyoffice");
b.ToTable("tenants_tenants");
b.HasData(
new
@ -211,7 +209,7 @@ namespace ASC.Core.Common.Migrations.MySql.TenantDbContextMySql
Id = 1,
Alias = "localhost",
Calls = false,
CreationDateTime = new DateTime(2020, 10, 6, 10, 14, 35, 606, DateTimeKind.Utc).AddTicks(4422),
CreationDateTime = new DateTime(2020, 12, 22, 14, 54, 11, 753, DateTimeKind.Utc).AddTicks(774),
LastModified = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
Name = "Web Office",
OwnerId = "66faa6e4-f133-11ea-b126-00ffeec8b4ef",
@ -219,8 +217,7 @@ namespace ASC.Core.Common.Migrations.MySql.TenantDbContextMySql
Spam = false,
Status = 0,
TrustedDomainsEnabled = 0,
Version = 0,
VersionChanged = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)
Version = 0
});
});
@ -251,6 +248,7 @@ namespace ASC.Core.Common.Migrations.MySql.TenantDbContextMySql
modelBuilder.Entity("ASC.Core.Common.EF.Model.DbTenantPartner", b =>
{
b.Property<int>("TenantId")
.ValueGeneratedOnAdd()
.HasColumnName("tenant_id")
.HasColumnType("int");
@ -497,14 +495,14 @@ namespace ASC.Core.Common.Migrations.MySql.TenantDbContextMySql
CreateOn = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
Email = "",
FirstName = "Administrator",
LastModified = new DateTime(2020, 10, 6, 10, 14, 35, 587, DateTimeKind.Utc).AddTicks(7841),
LastModified = new DateTime(2020, 12, 22, 14, 54, 11, 741, DateTimeKind.Utc).AddTicks(4732),
LastName = "",
PhoneActivation = 0,
Removed = false,
Status = 1,
Tenant = 1,
UserName = "administrator",
WorkFromDate = new DateTime(2020, 10, 6, 10, 14, 35, 587, DateTimeKind.Utc).AddTicks(6725)
WorkFromDate = new DateTime(2020, 12, 22, 14, 54, 11, 741, DateTimeKind.Utc).AddTicks(3715)
});
});
@ -595,22 +593,13 @@ namespace ASC.Core.Common.Migrations.MySql.TenantDbContextMySql
new
{
UserId = "66faa6e4-f133-11ea-b126-00ffeec8b4ef",
LastModified = new DateTime(2020, 10, 6, 10, 14, 35, 616, DateTimeKind.Utc).AddTicks(3267),
LastModified = new DateTime(2020, 12, 22, 14, 54, 11, 761, DateTimeKind.Utc).AddTicks(3260),
PwdHash = "vLFfghR5tNV3K9DKhmwArV+SbjWAcgZZzIDTnJ0JgCo=",
PwdHashSha512 = "USubvPlB+ogq0Q1trcSupg==",
Tenant = 1
});
});
modelBuilder.Entity("ASC.Core.Common.EF.Model.DbTenantPartner", b =>
{
b.HasOne("ASC.Core.Common.EF.Model.DbTenant", "Tenant")
.WithOne("Partner")
.HasForeignKey("ASC.Core.Common.EF.Model.DbTenantPartner", "TenantId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("ASC.Core.Common.EF.UserGroup", b =>
{
b.HasOne("ASC.Core.Common.EF.User", null)

View File

@ -44,8 +44,8 @@ namespace ASC.Notify.Engine
public SendInterceptorSkeleton(string name, InterceptorPlace preventPlace, InterceptorLifetime lifetime, Func<NotifyRequest, InterceptorPlace, IServiceScope, bool> sendInterceptor)
{
if (string.IsNullOrEmpty("name")) throw new ArgumentNullException("name");
if (string.IsNullOrEmpty("sendInterceptor")) throw new ArgumentNullException("sendInterceptor");
if (string.IsNullOrEmpty(name)) throw new ArgumentException("Empty name.", "name");
if (sendInterceptor == null) throw new ArgumentNullException("sendInterceptor");
method = sendInterceptor;
Name = name;

View File

@ -34,6 +34,9 @@ namespace ASC.Core.Notify.Jabber
[ServiceContract]
public interface IJabberService
{
[OperationContract]
string GetVersion();
[OperationContract]
byte AddXmppConnection(string connectionId, string userName, byte state, int tenantId);

View File

@ -76,6 +76,22 @@ namespace ASC.Core.Notify.Jabber
return false;
}
public string GetVersion()
{
using (var service = GetService())
{
try
{
return service.GetVersion();
}
catch (Exception error)
{
ProcessError(error);
}
}
return null;
}
public int GetNewMessagesCount()
{
var result = 0;

View File

@ -38,6 +38,11 @@ namespace ASC.Core.Notify.Jabber
{
}
public string GetVersion()
{
return Channel.GetVersion();
}
public byte AddXmppConnection(string connectionId, string userName, byte state, int tenantId)
{
return Channel.AddXmppConnection(connectionId, userName, state, tenantId);

View File

@ -1,51 +0,0 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
* In accordance with Section 7(a) of the GNU GPL 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 more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
*
* You can contact Ascensio System SIA by email at sales@onlyoffice.com
*
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
*
* Pursuant to Section 7 § 3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
* relevant author attributions when distributing the software. If the display of the logo in its graphic
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
* in every copy of the program you distribute.
* Pursuant to Section 7 § 3(e) we decline to grant you any rights under trademark law for use of our trademarks.
*
*/
using System;
using ASC.Core.Common.Settings;
namespace ASC.Core.Tenants
{
[Serializable]
public class TenantAnalyticsSettings : ISettings
{
public bool Analytics { get; set; }
public Guid ID
{
get { return new Guid("{02943039-F399-421E-A552-23D70651AEBD}"); }
}
public ISettings GetDefault(IServiceProvider serviceProvider)
{
return new TenantAnalyticsSettings
{
Analytics = true
};
}
}
}

View File

@ -1,71 +0,0 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
* In accordance with Section 7(a) of the GNU GPL 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 more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
*
* You can contact Ascensio System SIA by email at sales@onlyoffice.com
*
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
*
* Pursuant to Section 7 § 3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
* relevant author attributions when distributing the software. If the display of the logo in its graphic
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
* in every copy of the program you distribute.
* Pursuant to Section 7 § 3(e) we decline to grant you any rights under trademark law for use of our trademarks.
*
*/
using System;
namespace ASC.Core.Tenants
{
[Serializable]
public class TenantQuotaRowQuery
{
public int Tenant
{
get;
private set;
}
public string Path
{
get;
set;
}
public DateTime LastModified
{
get;
set;
}
public TenantQuotaRowQuery(int tenant)
{
Tenant = tenant;
}
public TenantQuotaRowQuery WithPath(string path)
{
Path = path;
return this;
}
public TenantQuotaRowQuery WithLastModified(DateTime lastModified)
{
LastModified = lastModified;
return this;
}
}
}

View File

@ -65,8 +65,6 @@ namespace ASC.Core.Tenants
public bool Calls { get; set; }
public bool Analytics { get; set; }
public string Campaign { get; set; }
public bool LimitedControlPanel { get; set; }

View File

@ -47,7 +47,7 @@ namespace ASC.Core.Common.Tests
public void ClearData()
{
Service.RemoveTenantQuota(Tenant);
foreach (var row in Service.FindTenantQuotaRows(new TenantQuotaRowQuery(Tenant) { Path = "path" }))
foreach (var row in Service.FindTenantQuotaRows(Tenant))
{
//DeleteQuotaRow(row);
}
@ -71,12 +71,12 @@ namespace ASC.Core.Common.Tests
var row = new TenantQuotaRow { Tenant = this.Tenant, Path = "path", Counter = 1000, Tag = "tag" };
Service.SetTenantQuotaRow(row, false);
var rows = Service.FindTenantQuotaRows(new TenantQuotaRowQuery(Tenant).WithPath("path")).ToList();
var rows = Service.FindTenantQuotaRows(Tenant).ToList();
CompareQuotaRows(row, rows.Find(r => r.Tenant == row.Tenant && r.Tag == row.Tag));
Service.SetTenantQuotaRow(row, true);
row.Counter += 1000;
rows = Service.FindTenantQuotaRows(new TenantQuotaRowQuery(Tenant).WithPath("path")).ToList();
rows = Service.FindTenantQuotaRows(Tenant).ToList();
CompareQuotaRows(row, rows.Find(r => r.Tenant == row.Tenant && r.Tag == row.Tag));
//DeleteQuotaRow(row);

View File

@ -56,7 +56,7 @@ namespace ASC.Core.Users
public string GetUserName(string firstName, string lastName)
{
if (string.IsNullOrEmpty(firstName) || string.IsNullOrEmpty("lastName")) throw new ArgumentException();
if (string.IsNullOrEmpty(firstName) || string.IsNullOrEmpty(lastName)) throw new ArgumentException();
return string.Format(GetUserDisplayFormat(DisplayUserNameFormat.Default), firstName, lastName);
}

View File

@ -1,6 +1,6 @@
syntax = "proto3";
package ASC.Data.Storage.Encryption;
package ASC.Core.Encryption;
message EncryptionSettingsProto {
string password = 1;

View File

@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\ASC.Common\ASC.Common.csproj" />
<ProjectReference Include="..\ASC.Core.Common\ASC.Core.Common.csproj" />
<ProjectReference Include="..\ASC.Data.Storage\ASC.Data.Storage.csproj" />
</ItemGroup>
</Project>

View File

@ -29,10 +29,12 @@ using System.IO;
using System.Security.Cryptography;
using ASC.Common;
using ASC.Core.Encryption;
using ASC.Data.Storage.Encryption;
using Microsoft.Extensions.Configuration;
namespace ASC.Data.Storage.Encryption
namespace ASC.Data.Encryption
{
[Transient]
public class Crypt : ICrypt
@ -42,7 +44,6 @@ namespace ASC.Data.Storage.Encryption
private string TempDir { get; set; }
private IConfiguration Configuration { get; set; }
private EncryptionFactory EncryptionFactory { get; set; }
public void Init(string storageName, EncryptionSettings encryptionSettings)
{
@ -51,10 +52,9 @@ namespace ASC.Data.Storage.Encryption
TempDir = Configuration["storage:encryption:tempdir"] ?? Path.GetTempPath();
}
public Crypt(IConfiguration configuration, EncryptionFactory encryptionFactory)
public Crypt(IConfiguration configuration)
{
Configuration = configuration;
EncryptionFactory = encryptionFactory;
}
public byte Version { get { return 1; } }
@ -63,7 +63,7 @@ namespace ASC.Data.Storage.Encryption
{
if (string.IsNullOrEmpty(Settings.Password)) return;
var metadata = EncryptionFactory.GetMetadata();
var metadata = new Metadata(Configuration);
metadata.Initialize(Settings.Password);
@ -122,7 +122,7 @@ namespace ASC.Data.Storage.Encryption
try
{
var metadata = EncryptionFactory.GetMetadata();
var metadata = new Metadata(Configuration);
metadata.Initialize(Version, password, fileInfo.Length);
@ -176,7 +176,7 @@ namespace ASC.Data.Storage.Encryption
try
{
var metadata = EncryptionFactory.GetMetadata();
var metadata = new Metadata(Configuration);
metadata.Initialize(password);
@ -221,7 +221,7 @@ namespace ASC.Data.Storage.Encryption
{
var decryptedMemoryStream = new MemoryStream(); //TODO: MemoryStream or temporary decrypted file on disk?
var metadata = EncryptionFactory.GetMetadata();
var metadata = new Metadata(Configuration);
metadata.Initialize(password);
@ -253,7 +253,7 @@ namespace ASC.Data.Storage.Encryption
private Stream GetReadStream(string filePath, string password)
{
var metadata = EncryptionFactory.GetMetadata();
var metadata = new Metadata(Configuration);
metadata.Initialize(password);
@ -274,7 +274,7 @@ namespace ASC.Data.Storage.Encryption
private long GetFileSize(string filePath, string password)
{
var metadata = EncryptionFactory.GetMetadata();
var metadata = new Metadata(Configuration);
metadata.Initialize(password);

View File

@ -27,7 +27,7 @@
using System.IO;
using System.Security.Cryptography;
namespace ASC.Data.Storage.Encryption
namespace ASC.Data.Encryption
{
//https://stackoverflow.com/a/22072068

View File

@ -26,7 +26,7 @@
using System;
namespace ASC.Data.Storage.Encryption
namespace ASC.Data.Encryption
{
public class IntegrityProtectionException : Exception
{

View File

@ -34,10 +34,10 @@ using ASC.Common;
using Microsoft.Extensions.Configuration;
namespace ASC.Data.Storage.Encryption
namespace ASC.Data.Encryption
{
[Transient]
public class Metadata : IMetadata
public class Metadata
{
private const string prefixString = "AscEncrypted";

View File

@ -28,7 +28,7 @@ using System;
using System.IO;
using System.Security.Cryptography;
namespace ASC.Data.Storage.Encryption
namespace ASC.Data.Encryption
{
internal sealed class StreamWrapper : Stream
{
@ -39,7 +39,7 @@ namespace ASC.Data.Storage.Encryption
private readonly long fileSize;
private readonly long metadataLength;
public StreamWrapper(Stream fileStream, IMetadata metadata)
public StreamWrapper(Stream fileStream, Metadata metadata)
{
stream = fileStream;
symmetricAlgorithm = metadata.GetCryptographyAlgorithm();

View File

@ -20,7 +20,6 @@
</ItemGroup>
<ItemGroup>
<None Remove="protos\EncryptionSettingsProto.proto" />
<None Remove="protos\EncryptionStop.proto" />
<None Remove="protos\MigrationCache.proto" />
<None Remove="protos\MigrationProgress.proto" />
@ -51,7 +50,6 @@
<ItemGroup>
<Protobuf Include="protos\DataStoreCacheItem.proto" />
<Protobuf Include="protos\EncryptionSettingsProto.proto" />
<Protobuf Include="protos\EncryptionStop.proto" />
<Protobuf Include="protos\MigrationCache.proto" />
<Protobuf Include="protos\MigrationProgress.proto" />

View File

@ -32,6 +32,7 @@ using System.Linq;
using ASC.Common;
using ASC.Common.Logging;
using ASC.Core;
using ASC.Core.Encryption;
using ASC.Data.Storage.Configuration;
using ASC.Data.Storage.Encryption;
using ASC.Security.Cryptography;

View File

@ -24,43 +24,36 @@
*/
using System;
using ASC.Common;
using ASC.Core.Encryption;
using Microsoft.Extensions.DependencyInjection;
using Autofac;
namespace ASC.Data.Storage.Encryption
{
[Singletone(Additional = typeof(EncryptionFactoryExtension))]
[Singletone]
public class EncryptionFactory
{
private IServiceProvider ServiceProvider { get; }
private ILifetimeScope Container { get; }
public EncryptionFactory(IServiceProvider serviceProvider)
public EncryptionFactory(ILifetimeScope container)
{
ServiceProvider = serviceProvider;
Container = container;
}
public ICrypt GetCrypt(string storageName, EncryptionSettings encryptionSettings)
{
var crypt = ServiceProvider.GetService<Crypt>();
crypt.Init(storageName, encryptionSettings);
return crypt;
ICrypt result = null;
using var scope = Container.BeginLifetimeScope();
if (scope != null)
{
result = scope.Resolve<ICrypt>();
}
public IMetadata GetMetadata()
{
return ServiceProvider.GetService<Metadata>();
}
}
public class EncryptionFactoryExtension
{
public static void Register(DIHelper services)
{
services.TryAdd<Crypt>();
services.TryAdd<Metadata>();
result ??= new FakeCrypt();
result.Init(storageName, encryptionSettings);
return result;
}
}
}

View File

@ -26,6 +26,7 @@
using ASC.Common;
using ASC.Common.Caching;
using ASC.Core.Encryption;
namespace ASC.Data.Storage.Encryption
{

View File

@ -0,0 +1,37 @@

using System.IO;
using ASC.Core.Encryption;
namespace ASC.Data.Storage.Encryption
{
public class FakeCrypt : ICrypt
{
public byte Version { get { return 1; } }
public void EncryptFile(string filePath)
{
return;
}
public void DecryptFile(string filePath)
{
return;
}
public Stream GetReadStream(string filePath)
{
return File.OpenRead(filePath);
}
public long GetFileSize(string filePath)
{
return new FileInfo(filePath).Length;
}
public void Init(string storageName, EncryptionSettings encryptionSettings)
{
}
}
}

View File

@ -23,6 +23,8 @@
*
*/
using ASC.Core.Encryption;
namespace ASC.Data.Storage.Encryption
{
public interface IEncryptionService

View File

@ -1,54 +0,0 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2020
*
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
* In accordance with Section 7(a) of the GNU GPL 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 more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
*
* You can contact Ascensio System SIA by email at sales@onlyoffice.com
*
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
*
* Pursuant to Section 7 § 3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
* relevant author attributions when distributing the software. If the display of the logo in its graphic
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
* in every copy of the program you distribute.
* Pursuant to Section 7 § 3(e) we decline to grant you any rights under trademark law for use of our trademarks.
*
*/
using System.IO;
using System.Security.Cryptography;
namespace ASC.Data.Storage.Encryption
{
public interface IMetadata
{
void Initialize(string password);
void Initialize(byte version, string password, long fileSize);
bool TryReadFromStream(Stream stream, byte cryptVersion);
void WriteToStream(Stream stream);
SymmetricAlgorithm GetCryptographyAlgorithm();
void ComputeAndWriteHmacHash(Stream stream);
void ComputeAndValidateHmacHash(Stream stream);
byte GetCryptoVersion();
long GetFileSize();
int GetMetadataLength();
}
}

View File

@ -34,8 +34,6 @@ namespace ASC.Data.Storage
void QuotaUsedSet(string module, string domain, string dataTag, long size);
long QuotaUsedGet(string module, string domain);
void QuotaUsedCheck(long size);
}
}

View File

@ -616,6 +616,7 @@ namespace ASC.Data.Storage.S3
public override string SavePrivate(string domain, string path, Stream stream, DateTime expires)
{
using var client = GetClient();
using var uploader = new TransferUtility(client);
var objectKey = MakePath(domain, path);
var buffered = stream.GetBuffered();
var request = new TransferUtilityUploadRequest
@ -636,7 +637,7 @@ namespace ASC.Data.Storage.S3
request.Metadata.Add("private-expire", expires.ToFileTimeUtc().ToString(CultureInfo.InvariantCulture));
new TransferUtility(client).Upload(request);
uploader.Upload(request);
//Get presigned url
var pUrlRequest = new GetPreSignedUrlRequest

View File

@ -60,7 +60,7 @@ namespace ASC.Data.Storage
{
this.tenant = tenant;
TenantManager = tenantManager;
lazyCurrentSize = new Lazy<long>(() => TenantManager.FindTenantQuotaRows(new TenantQuotaRowQuery(tenant))
lazyCurrentSize = new Lazy<long>(() => TenantManager.FindTenantQuotaRows(tenant)
.Where(r => UsedInQuota(r.Tag))
.Sum(r => r.Counter));
}
@ -98,14 +98,6 @@ namespace ASC.Data.Storage
SetTenantQuotaRow(module, domain, size, dataTag, false);
}
public long QuotaUsedGet(string module, string domain)
{
var path = string.IsNullOrEmpty(module) ? null : string.Format("/{0}/{1}", module, domain);
return TenantManager.FindTenantQuotaRows(new TenantQuotaRowQuery(tenant).WithPath(path))
.Where(r => UsedInQuota(r.Tag))
.Sum(r => r.Counter);
}
public void QuotaUsedCheck(long size)
{
var quota = TenantManager.GetTenantQuota(tenant);

View File

@ -93,7 +93,6 @@ namespace ASC.Notify.Textile
formatter.Format(message.Body);
var template = GetTemplate(message);
var analytics = GetAnalytics(message);
var imagePath = GetImagePath(message);
var logoImg = GetLogoImg(message, imagePath);
var logoText = GetLogoText(message);
@ -103,7 +102,7 @@ namespace ASC.Notify.Textile
InitFooter(message, mailSettings, out var footerContent, out var footerSocialContent);
message.Body = template.Replace("%ANALYTICS%", analytics)
message.Body = template
.Replace("%CONTENT%", output.GetFormattedText())
.Replace("%LOGO%", logoImg)
.Replace("%LOGOTEXT%", logoText)
@ -133,12 +132,6 @@ namespace ASC.Notify.Textile
return template;
}
private static string GetAnalytics(NoticeMessage message)
{
var analyticsTag = message.GetArgument("Analytics");
return analyticsTag == null ? string.Empty : (string)analyticsTag.Value;
}
private static string GetImagePath(NoticeMessage message)
{
var imagePathTag = message.GetArgument("ImagePath");

View File

@ -12,7 +12,6 @@ using ASC.Common.Utils;
using CommandLine;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
namespace ASC.Resource.Manager
@ -29,6 +28,7 @@ namespace ASC.Resource.Manager
var services = new ServiceCollection();
var startup = new Startup();
startup.ConfigureServices(services);
var serviceProvider = services.BuildServiceProvider();
using var scope = serviceProvider.CreateScope();
var scopeClass = scope.ServiceProvider.GetService<ProgramScope>();
@ -42,11 +42,11 @@ namespace ASC.Resource.Manager
{
var (project, module, filePath, exportPath, culture, format, key) = options;
project = "Files";
module = "Common";
filePath = "FilesCommonResource.resx";
exportPath = @"C:\Git\portals_core\products\ASC.Files\Core\Resources";
key = "AceStatusEnum_CustomFilter";
project = "WebStudio";
module = "WebStudio";
filePath = "Resource.resx";
exportPath = @"C:\Git\portals_core\web\ASC.Web.Core\PublicResources";
key = "LicenseUploadedOverdueSupport";
if (format == "json")
{
@ -192,24 +192,16 @@ namespace ASC.Resource.Manager
}
}
[Scope]
public class ProgramScope
{
internal ResourceData ResourceData { get; }
internal IConfiguration Configuration { get; }
internal ConfigurationExtension Configuration { get; }
public ProgramScope(ResourceData resourceData, IConfiguration configuration)
public ProgramScope(ResourceData resourceData, ConfigurationExtension configuration)
{
ResourceData = resourceData;
Configuration = configuration;
}
}
public static class ProgramExtension
{
public static DIHelper AddProgramService(this DIHelper services)
{
services.TryAddScoped<ProgramScope>();
return services;
}
}
}

View File

@ -29,12 +29,14 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using ASC.Common;
using ASC.Core.Common.EF;
using ASC.Core.Common.EF.Context;
using ASC.Core.Common.EF.Model.Resource;
namespace ASC.Resource.Manager
{
[Scope]
public class ResourceData
{
private const string Dbid = "tmresource";

View File

@ -1,7 +1,5 @@
using ASC.Common;
using ASC.Common.Logging;
using ASC.Core.Common.EF;
using ASC.Core.Common.EF.Context;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
@ -24,13 +22,10 @@ namespace ASC.Resource.Manager
{
var diHelper = new DIHelper(services);
services.AddLogging();
diHelper.TryAddScoped<ResourceData>();
diHelper.TryAddScoped<ProgramScope>();
diHelper.AddDbContextManagerService<ResourceDbContext>();
diHelper.AddLoggerService();
diHelper.AddNLogManager();
diHelper.TryAddSingleton(Configuration);
diHelper.Configure(services);
services.AddSingleton(Configuration);
diHelper.TryAdd<ProgramScope>();
LogNLogExtension.ConfigureLog(diHelper);
}
}
}

View File

@ -304,7 +304,7 @@ namespace ASC.ApiSystem.Controllers
try
{
var data = string.Format("secret={0}&remoteip={1}&response={2}", Configuration["recaptcha:private-key"], ip, response);
var url = Configuration["recaptcha:verify-url"] ?? "https://www.google.com/recaptcha/api/siteverify";
var url = Configuration["recaptcha:verify-url"] ?? "https://www.recaptcha.net/recaptcha/api/siteverify";
var webRequest = (HttpWebRequest)WebRequest.Create(url);
webRequest.Method = WebRequestMethods.Http.Post;

View File

@ -249,7 +249,6 @@ namespace ASC.ApiSystem.Controllers
Industry = (TenantIndustry)model.Industry,
Spam = model.Spam,
Calls = model.Calls,
Analytics = model.Analytics,
LimitedControlPanel = model.LimitedControlPanel
};

View File

@ -275,7 +275,6 @@ namespace ASC.ApiSystem.Controllers
Industry = (TenantIndustry)model.Industry,
Spam = model.Spam,
Calls = model.Calls,
Analytics = model.Analytics,
LimitedControlPanel = model.LimitedControlPanel
};

View File

@ -89,8 +89,6 @@ namespace ASC.ApiSystem.Models
public bool Calls { get; set; }
public bool Analytics { get; set; }
public string AppKey { get; set; }
public bool LimitedControlPanel { get; set; }

View File

@ -61,17 +61,18 @@ namespace ASC.ApiSystem
config.SetBasePath(path);
config
.AddInMemoryCollection(new Dictionary<string, string>
{
{"pathToConf", path}
})
.AddJsonFile("appsettings.json")
.AddJsonFile($"appsettings.{hostingContext.HostingEnvironment.EnvironmentName}.json", true)
.AddJsonFile("storage.json")
.AddJsonFile("kafka.json")
.AddJsonFile($"kafka.{hostingContext.HostingEnvironment.EnvironmentName}.json", true)
.AddEnvironmentVariables()
.AddCommandLine(args);
.AddCommandLine(args)
.AddInMemoryCollection(new Dictionary<string, string>
{
{"pathToConf", path}
});
});
}
}

View File

@ -30,6 +30,7 @@
<ProjectReference Include="..\..\..\web\ASC.Web.Core\ASC.Web.Core.csproj" />
<ProjectReference Include="..\..\ASC.Common\ASC.Common.csproj" />
<ProjectReference Include="..\..\ASC.Core.Common\ASC.Core.Common.csproj" />
<ProjectReference Include="..\..\ASC.Data.Encryption\ASC.Data.Encryption.csproj" />
<ProjectReference Include="..\..\ASC.Data.Storage\ASC.Data.Storage.csproj" />
</ItemGroup>
<ItemGroup>

View File

@ -3,7 +3,6 @@ using System.Linq;
using ASC.Common;
using ASC.Core;
using ASC.Core.Tenants;
using ASC.Web.Studio.UserControls.Statistics;
namespace ASC.Data.Backup
@ -30,7 +29,7 @@ namespace ASC.Data.Backup
if (CoreBaseSettings.Standalone)
return BackupAvailableSize.Available;
var size = TenantManager.FindTenantQuotaRows(new TenantQuotaRowQuery(tenantId))
var size = TenantManager.FindTenantQuotaRows(tenantId)
.Where(r => !string.IsNullOrEmpty(r.Tag) && new Guid(r.Tag) != Guid.Empty && !new Guid(r.Tag).Equals(mailStorageTag))
.Sum(r => r.Counter);
if (size > AvailableZipSize)

View File

@ -31,11 +31,6 @@ namespace ASC.Data.Backup
config.SetBasePath(path);
var env = hostContext.Configuration.GetValue("ENVIRONMENT", "Production");
config
.AddInMemoryCollection(new Dictionary<string, string>
{
{"pathToConf", path }
}
)
.AddJsonFile("appsettings.json")
.AddJsonFile($"appsettings.{env}.json", true)
.AddJsonFile("storage.json")
@ -43,7 +38,12 @@ namespace ASC.Data.Backup
.AddJsonFile("backup.json")
.AddJsonFile("kafka.json")
.AddJsonFile($"kafka.{env}.json", true)
.AddEnvironmentVariables();
.AddEnvironmentVariables()
.AddInMemoryCollection(new Dictionary<string, string>
{
{"pathToConf", path }
}
);
})
.UseConsoleLifetime()
.Build()

View File

@ -31,6 +31,7 @@ using System.Threading;
using ASC.Common;
using ASC.Common.Logging;
using ASC.Data.Backup.Storage;
using ASC.Files.Core;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
@ -95,9 +96,17 @@ namespace ASC.Data.Backup.Service
BackupRepository.DeleteBackupRecord(backupRecord.Id);
}
catch (ProviderInfoArgumentException error)
{
log.Warn("can't remove backup record " + backupRecord.Id, error);
if (DateTime.UtcNow > backupRecord.CreatedOn.AddMonths(6))
{
BackupRepository.DeleteBackupRecord(backupRecord.Id);
}
}
catch (Exception error)
{
log.Warn("can't remove backup record: {0}", error);
log.Warn("can't remove backup record: " + backupRecord.Id, error);
}
}
}

View File

@ -28,6 +28,7 @@ using System;
using System.Collections.Generic;
using ASC.Common;
using ASC.Common.Logging;
using ASC.Common.Utils;
using ASC.Core;
using ASC.Data.Backup.Contracts;
@ -35,6 +36,8 @@ using ASC.Data.Backup.EF.Model;
using ASC.Data.Backup.Service;
using ASC.Data.Backup.Utils;
using Microsoft.Extensions.Options;
using Newtonsoft.Json;
namespace ASC.Data.Backup.Storage
@ -45,6 +48,7 @@ namespace ASC.Data.Backup.Storage
private ConfigurationExtension Configuration { get; }
private DocumentsBackupStorage DocumentsBackupStorage { get; }
private DataStoreBackupStorage DataStoreBackupStorage { get; }
private ILog Log { get; }
private LocalBackupStorage LocalBackupStorage { get; }
private ConsumerBackupStorage ConsumerBackupStorage { get; }
private TenantManager TenantManager { get; }
@ -55,20 +59,30 @@ namespace ASC.Data.Backup.Storage
ConfigurationExtension configuration,
DocumentsBackupStorage documentsBackupStorage,
TenantManager tenantManager,
DataStoreBackupStorage dataStoreBackupStorage)
DataStoreBackupStorage dataStoreBackupStorage,
IOptionsMonitor<ILog> options)
{
Configuration = configuration;
DocumentsBackupStorage = documentsBackupStorage;
DataStoreBackupStorage = dataStoreBackupStorage;
Log = options.CurrentValue;
LocalBackupStorage = localBackupStorage;
ConsumerBackupStorage = consumerBackupStorage;
TenantManager = tenantManager;
}
public IBackupStorage GetBackupStorage(BackupRecord record)
{
try
{
return GetBackupStorage(record.StorageType, record.TenantId, JsonConvert.DeserializeObject<Dictionary<string, string>>(record.StorageParams));
}
catch (Exception error)
{
Log.Error("can't get backup storage for record " + record.Id, error);
return null;
}
}
public IBackupStorage GetBackupStorage(BackupStorageType type, int tenantId, Dictionary<string, string> storageParams)
{

View File

@ -105,7 +105,7 @@ namespace ASC.Data.Backup.Tasks.Modules
if (table.Name == "calendar_event_history")
return string.Format(
"inner join calendar_calendars as t1 on t1.id = t.calendar_id inner join calendar_events as t2 on t2.id = t.event_id where t1.tenant = {0} and t2.tenant = {0}",
"inner join calendar_calendars as t1 on t1.id = t.calendar_id and t1.tenant = t.tenant inner join calendar_events as t2 on t2.id = t.event_id where t1.tenant = {0} and t2.tenant = {0}",
tenantId);
return base.GetSelectCommandConditionText(tenantId, table);

View File

@ -31,6 +31,7 @@
<ProjectReference Include="..\..\ASC.Api.Core\ASC.Api.Core.csproj" />
<ProjectReference Include="..\..\ASC.Common\ASC.Common.csproj" />
<ProjectReference Include="..\..\ASC.Core.Common\ASC.Core.Common.csproj" />
<ProjectReference Include="..\..\ASC.Data.Encryption\ASC.Data.Encryption.csproj" />
<ProjectReference Include="..\..\ASC.Data.Storage\ASC.Data.Storage.csproj" />
</ItemGroup>

View File

@ -34,6 +34,7 @@ using ASC.Common.Caching;
using ASC.Common.Logging;
using ASC.Common.Threading.Progress;
using ASC.Core;
using ASC.Core.Encryption;
using ASC.Core.Tenants;
using ASC.Data.Storage.DiscStorage;

View File

@ -24,6 +24,7 @@
*/
using ASC.Common;
using ASC.Common.Caching;
using ASC.Core.Encryption;
namespace ASC.Data.Storage.Encryption
{

View File

@ -30,6 +30,7 @@ using System.Threading.Tasks;
using ASC.Common;
using ASC.Common.Caching;
using ASC.Core.Encryption;
using Microsoft.Extensions.DependencyInjection;

View File

@ -7,6 +7,7 @@
<ItemGroup>
<ProjectReference Include="..\..\ASC.Common\ASC.Common.csproj" />
<ProjectReference Include="..\..\ASC.Core.Common\ASC.Core.Common.csproj" />
<ProjectReference Include="..\..\ASC.Data.Encryption\ASC.Data.Encryption.csproj" />
<ProjectReference Include="..\..\ASC.Data.Storage\ASC.Data.Storage.csproj" />
</ItemGroup>

View File

@ -33,11 +33,6 @@ namespace ASC.Data.Storage.Migration
config.SetBasePath(path);
var env = hostContext.Configuration.GetValue("ENVIRONMENT", "Production");
config
.AddInMemoryCollection(new Dictionary<string, string>
{
{"pathToConf", path }
}
)
.AddJsonFile("appsettings.json")
.AddJsonFile($"appsettings.{env}.json", true)
.AddJsonFile($"appsettings.services.json", true)
@ -46,7 +41,12 @@ namespace ASC.Data.Storage.Migration
.AddJsonFile("kafka.json")
.AddJsonFile($"kafka.{env}.json", true)
.AddEnvironmentVariables()
.AddCommandLine(args);
.AddCommandLine(args)
.AddInMemoryCollection(new Dictionary<string, string>
{
{"pathToConf", path }
}
);
})
.ConfigureServices((hostContext, services) =>
{

View File

@ -171,7 +171,7 @@ namespace ASC.ElasticSearch
if (runBulk)
{
var portion1 = portion;
var portion1 = portion.ToList();
Client.Instance.Bulk(r => r.IndexMany(portion1, GetMeta));
for (var j = portionStart; j < i; j++)
{
@ -567,6 +567,7 @@ namespace ASC.ElasticSearch
public IEnumerable<List<T>> IndexAll(Func<DateTime, (int, int, int)> getCount, Func<long, long, DateTime, List<T>> getData)
{
var now = DateTime.UtcNow;
var lastIndexed = WebstudioDbContext.WebstudioIndex
.Where(r => r.IndexName == Wrapper.IndexName)
.Select(r => r.LastModified)
@ -600,7 +601,7 @@ namespace ASC.ElasticSearch
WebstudioDbContext.AddOrUpdate(r => r.WebstudioIndex, new DbWebstudioIndex()
{
IndexName = Wrapper.IndexName,
LastModified = DateTime.UtcNow
LastModified = now
});
WebstudioDbContext.SaveChanges();

View File

@ -77,25 +77,24 @@ namespace ASC.ElasticSearch
.RequestTimeout(TimeSpan.FromMinutes(5))
.MaximumRetries(10)
.ThrowExceptions();
#if DEBUG
if (Log.IsTraceEnabled)
{
settings.DisableDirectStreaming().PrettyJson().EnableDebugMode(r =>
{
Log.Trace(r.DebugInformation);
//Log.Trace(r.DebugInformation);
if (r.RequestBodyInBytes != null)
{
Log.TraceFormat("Request: {0}", Encoding.UTF8.GetString(r.RequestBodyInBytes));
}
//if (r.RequestBodyInBytes != null)
//{
// Log.TraceFormat("Request: {0}", Encoding.UTF8.GetString(r.RequestBodyInBytes));
//}
if (r.ResponseBodyInBytes != null)
if (r.HttpStatusCode != null && (r.HttpStatusCode == 403 || r.HttpStatusCode == 500) && r.ResponseBodyInBytes != null)
{
Log.TraceFormat("Response: {0}", Encoding.UTF8.GetString(r.ResponseBodyInBytes));
}
});
}
#endif
client = new ElasticClient(settings);

View File

@ -223,7 +223,7 @@ namespace ASC.ElasticSearch
{
Logger.Error("inner", inner.Response.OriginalException);
if (inner.Response.HttpStatusCode == 413)
if (inner.Response.HttpStatusCode == 413 || inner.Response.HttpStatusCode == 403)
{
data.ForEach(r => Index(r, immediately));
}

View File

@ -110,6 +110,7 @@ namespace ASC.ElasticSearch
}, CancellationTokenSource.Token, TaskCreationOptions.LongRunning);
task.ConfigureAwait(false);
task.Start();
return Task.CompletedTask;
@ -131,7 +132,9 @@ namespace ASC.ElasticSearch
private void IndexAll(bool reindex = false)
{
Timer.Change(-1, -1);
try
{
Timer.Change(Timeout.Infinite, Timeout.Infinite);
IsStarted = true;
using var scope = Container.BeginLifetimeScope();
@ -146,6 +149,12 @@ namespace ASC.ElasticSearch
IndexNotify.Publish(new IndexAction() { Indexing = "", LastIndexed = DateTime.Now.Ticks }, CacheNotifyAction.Any);
IsStarted = false;
}
catch (Exception e)
{
Log.Fatal("IndexAll", e);
throw;
}
}
public void IndexProduct(IFactoryIndexer product, bool reindex)
{

View File

@ -44,7 +44,8 @@ namespace ASC.ElasticSearch.Service
Host = cfg.Host ?? "localhost";
Port = cfg.Port ?? 9200;
Period = cfg.Period ?? 1;
MemoryLimit = cfg.MemoryLimit ?? 10 * 1024 * 1024L;
MemoryLimit = cfg.MemoryLimit ?? 1 * 1024 * 1024L;
MaxContentLength = cfg.MaxContentLength ?? 10 * 1024 * 1024L;
}
public string Host { get; set; }
@ -56,5 +57,7 @@ namespace ASC.ElasticSearch.Service
public int? Period { get; set; }
public long? MemoryLimit { get; set; }
public long? MaxContentLength { get; set; }
}
}

View File

@ -35,11 +35,6 @@ namespace ASC.Notify
config.SetBasePath(path);
var env = hostContext.Configuration.GetValue("ENVIRONMENT", "Production");
config
.AddInMemoryCollection(new Dictionary<string, string>
{
{"pathToConf", path }
}
)
.AddJsonFile("appsettings.json")
.AddJsonFile($"appsettings.{env}.json", true)
.AddJsonFile($"appsettings.services.json", true)
@ -48,7 +43,12 @@ namespace ASC.Notify
.AddJsonFile("kafka.json")
.AddJsonFile($"kafka.{env}.json", true)
.AddEnvironmentVariables()
.AddCommandLine(args);
.AddCommandLine(args)
.AddInMemoryCollection(new Dictionary<string, string>
{
{"pathToConf", path }
}
);
})
.ConfigureServices((hostContext, services) =>
{

View File

@ -22,6 +22,7 @@
<ItemGroup>
<ProjectReference Include="..\..\ASC.Common\ASC.Common.csproj" />
<ProjectReference Include="..\..\ASC.Core.Common\ASC.Core.Common.csproj" />
<ProjectReference Include="..\..\ASC.Data.Encryption\ASC.Data.Encryption.csproj" />
</ItemGroup>
</Project>

View File

@ -60,11 +60,6 @@ namespace ASC.Socket.IO.Svc
config.SetBasePath(path);
var env = hostContext.Configuration.GetValue("ENVIRONMENT", "Production");
config
.AddInMemoryCollection(new Dictionary<string, string>
{
{"pathToConf", path }
}
)
.AddJsonFile("appsettings.json")
.AddJsonFile("storage.json")
.AddJsonFile("kafka.json")
@ -73,7 +68,12 @@ namespace ASC.Socket.IO.Svc
.AddJsonFile($"appsettings.{env}.json", true)
.AddJsonFile($"socket.{env}.json", true)
.AddEnvironmentVariables()
.AddCommandLine(args);
.AddCommandLine(args)
.AddInMemoryCollection(new Dictionary<string, string>
{
{"pathToConf", path }
}
);
})
.ConfigureServices((hostContext, services) =>
{

View File

@ -12,6 +12,7 @@
<ItemGroup>
<ProjectReference Include="..\..\..\web\ASC.Web.Core\ASC.Web.Core.csproj" />
<ProjectReference Include="..\..\ASC.Data.Encryption\ASC.Data.Encryption.csproj" />
<ProjectReference Include="..\..\ASC.Data.Storage\ASC.Data.Storage.csproj" />
</ItemGroup>

View File

@ -36,11 +36,6 @@ namespace ASC.Studio.Notify
config.SetBasePath(path);
var env = hostContext.Configuration.GetValue("ENVIRONMENT", "Production");
config
.AddInMemoryCollection(new Dictionary<string, string>
{
{"pathToConf", path }
}
)
.AddJsonFile("appsettings.json")
.AddJsonFile($"appsettings.{env}.json", true)
.AddJsonFile($"appsettings.services.json", true)
@ -49,7 +44,12 @@ namespace ASC.Studio.Notify
.AddJsonFile("kafka.json")
.AddJsonFile($"kafka.{env}.json", true)
.AddEnvironmentVariables()
.AddCommandLine(args);
.AddCommandLine(args)
.AddInMemoryCollection(new Dictionary<string, string>
{
{"pathToConf", path }
}
);
})
.ConfigureServices((hostContext, services) =>
{

Some files were not shown because too many files have changed in this diff Show More