Skip to content

Commit 003395b

Browse files
committed
Update to v12.7.1
1 parent d59e563 commit 003395b

File tree

58 files changed

+776
-591
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+776
-591
lines changed

CHANGELOG.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,41 @@
11
# Change log
22

3+
## Version 12.7.1
4+
5+
### General portal changes
6+
7+
* Fixed the issue with receiving an instance-id for AMI.
8+
* Made changes for requests to docbuilder using the shardkey parameter.
9+
* Fixed the critical issue in the AutoCleanUp service (Bug 71281).
10+
* Fixed the issue with missing the Comment tab in PDF files (Bug 70867).
11+
* Hidden buttons for creating a PDF form in the Private room.
12+
* Enabled SharePoint connection on UNIX systems.
13+
* Fixed the issue with the JWT secret during update (Bug 71036).
14+
* Fixed the issue with single-component installation updates (Bug 70862).
15+
* Fixed the issue when the POST /api/2.0/settings/customnavigation/create method allows passing an unlimited number of characters in the "label" parameter (Bug 71805).
16+
* Fixed passing of the logoDark parameter to the editor.
17+
* Fixed the ability to specify an unlimited number of characters in all SMTP parameters (Bug 71859).
18+
* Fixed the ability to set port to "999999999" in Workspace SMTP parameters (Bug 71860).
19+
* Fixed the issue when the POST /api/2.0/settings/whitelabel/save method allows passing an unlimited number of characters to the "logoText" string in Workspace (Bug 71857).
20+
* Fixed the issue with the unlimited length of the share link name and password (Bug 71862).
21+
* Fixed the error from log ( ERROR ASC.Api.ApiSetup - method error: http://127.0.0.1/api/2.0/project/securityinfo.json - Server error System.Web.HttpException (0x80004005): Forbidden ).
22+
* Fixed the error from log ( ERROR ASC.Api.ApiSetup - method error: https://127.0.0.1/api/2.0/settings/security.json - Server error ASC.Common.Security.Authorizing.AuthorizingException: "[username]" access denied "Edit Portal Settings" ) (Bug 71913).
23+
* Added deletion of the synchronization client in case of a critical error in ImapSync (to allow reconnection).
24+
* Fixed the issue when the bottom part of the title in the event and task viewing window is cut off (Bug 47353).
25+
* Fixed the issue with configuring Windows feature (Bug 71923).
26+
* Fixed duplicate Downloading text in the prerequisites installation UI.
27+
* Fixed the issue when Google connection as a Storage is not available on Linux distributions (Bug 72205).
28+
29+
### Documents module
30+
31+
* When creating a new document, a template with the Letter page format will be taken for the en-US language. For languages ​​without templates, a document with the A4 page format will be taken.
32+
* Added empty file templates for creation in the following languages: fi-FI, he-IL, nb-NO, sl-SI.
33+
* Starting documents now have titles in the corresponding language.
34+
35+
### Control Panel
36+
37+
* Fixed the issue when the /controlpanel/https page crashes with the 502 error after restarting the container. (Bug 71794).
38+
339
## Version 12.7.0
440

541
### General portal changes
@@ -59,6 +95,11 @@
5995
* Fixed the issue with a timeout expected when entering an incorrect login/password for the mail/gmail mailbox. (Bug 68740).
6096
* Fixed the issue when marking a To-do task as completed or uncompleted changes its start time (DTSTART label). (Bug 68970).
6197
* Fixed the issue with missing logos of the social network (X) Twitter in the dark theme of the portal. (Bug 70457).
98+
* Fixed the issue when the backup file created in the server version for Windows is not supported for importing to DocSpace (Bug 70558).
99+
* Fixed the issue when there is no possibility to connect Google as a storage in the server version for Windows (Bug 70557).
100+
* Fixed the issue when most of the ONLYOFFICE services do not start after updating RPM packages. (Bug 70583).
101+
* Fixed the issue when the installation on Ubuntu 20.04 / Debian 11 fails with the error "error: metadata-generation-failed" (Bug 70596).
102+
* Fixed the issue when the Full-text Search section content is not loaded with the error "500 (Internal Server Error)" (Bug 70556).
62103

63104
### Documents module
64105

common/ASC.Core.Common/Billing/BillingClient.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,10 @@ public IDictionary<string, Dictionary<string, decimal>> GetProductPriceInfo(stri
219219
return new Dictionary<string, Dictionary<string, decimal>>();
220220
}
221221

222+
public string ChangeDocspaceNonProfitTariff(string portalId, bool isActive)
223+
{
224+
return Request("ChangeNonProfit", portalId, new Tuple<string, string>("IsActive", isActive.ToString().ToLowerInvariant()));
225+
}
222226

223227
private string CreateAuthToken(string pkey, string machinekey)
224228
{

common/ASC.Core.Common/Billing/ITariffService.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,7 @@ public interface ITariffService
4343
string GetButton(int tariffId, string partnerId);
4444

4545
void SaveButton(int tariffId, string partnerId, string buttonUrl);
46+
47+
void ChangeDocspaceNonProfitTariff(int tenantId, bool isActive);
4648
}
4749
}

common/ASC.Core.Common/Billing/TariffService.cs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ public class TariffService : DbBaseService, ITariffService
4848
private readonly CoreConfiguration config;
4949
private readonly bool test;
5050
private readonly int paymentDelay;
51+
private readonly string dsregion;
5152

5253
public readonly static int ACTIVE_USERS_MIN;
5354
public readonly static int ACTIVE_USERS_MAX;
@@ -89,6 +90,7 @@ public TariffService(ConnectionStringSettings connectionString, IQuotaService qu
8990
CacheExpiration = DEFAULT_CACHE_EXPIRATION;
9091
test = ConfigurationManagerExtension.AppSettings["core.payment-test"] == "true";
9192
int.TryParse(ConfigurationManagerExtension.AppSettings["core.payment-delay"], out paymentDelay);
93+
dsregion = IsDocspace ? ConfigurationManagerExtension.AppSettings[$"core.payment-dsregion.{connectionString.Name}"] : null;
9294
}
9395

9496

@@ -438,6 +440,28 @@ public void SaveButton(int tariffId, string partnerId, string buttonUrl)
438440
ExecNonQuery(q);
439441
}
440442

443+
public void ChangeDocspaceNonProfitTariff(int tenantId, bool isActive)
444+
{
445+
if (!IsDocspace || !BillingClient.Configured)
446+
{
447+
return;
448+
}
449+
450+
var portalId = dsregion + tenantId;
451+
452+
try
453+
{
454+
var client = GetBillingClient();
455+
var result = client.ChangeDocspaceNonProfitTariff(portalId, isActive);
456+
457+
log.Debug($"ChangeDocspaceNonProfitTariff portal {portalId} isActive: {isActive} result {result}");
458+
}
459+
catch (Exception error)
460+
{
461+
LogError(error, portalId);
462+
}
463+
}
464+
441465

442466
private Tariff GetBillingInfo(int tenant)
443467
{

common/ASC.Core.Common/Data/DbTenantService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ private SqlQuery TenantsQuery(Exp where)
314314
.Select("t.id", "t.alias", "t.mappeddomain", "t.version", "t.version_changed", "t.name", "t.language", "t.timezone", "t.owner_id")
315315
.Select("t.trusteddomains", "t.trusteddomainsenabled", "t.creationdatetime", "t.status", "t.statuschanged", "t.payment_id", "t.last_modified")
316316
.Select("NULL", "NULL", "NULL")
317-
.Select("t.industry", "t.spam", "t.calls")
317+
.Select("t.industry", "0", "t.calls")
318318
.Where(where);
319319
}
320320

common/ASC.Core.Common/HostedSolution.cs

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,6 @@ public bool IsDocspace
5555
get { return tenantService.IsDocspace; }
5656
}
5757

58-
public int DocspaceDefaultQuota
59-
{
60-
get
61-
{
62-
return int.TryParse(ConfigurationManagerExtension.AppSettings["docspace.default.quota"], out var quota) ? quota : -3;
63-
}
64-
}
65-
6658
public HostedSolution(ConnectionStringSettings connectionString)
6759
: this(connectionString, null)
6860
{
@@ -225,10 +217,17 @@ public TenantQuota SaveTenantQuota(TenantQuota quota)
225217

226218
public void SetTariff(int tenant, bool paid)
227219
{
228-
var quota = quotaService.GetTenantQuotas().FirstOrDefault(q => paid ? q.NonProfit : IsDocspace ? q.Id == DocspaceDefaultQuota : q.Trial);
229-
if (quota != null)
220+
if (IsDocspace)
221+
{
222+
tariffService.ChangeDocspaceNonProfitTariff(tenant, paid);
223+
}
224+
else
230225
{
231-
tariffService.SetTariff(tenant, new Tariff { QuotaId = quota.Id, DueDate = DateTime.MaxValue, Quantity = 1 });
226+
var quota = quotaService.GetTenantQuotas().FirstOrDefault(q => paid ? q.NonProfit : q.Trial);
227+
if (quota != null)
228+
{
229+
tariffService.SetTariff(tenant, new Tariff { QuotaId = quota.Id, DueDate = DateTime.MaxValue, Quantity = 1 });
230+
}
232231
}
233232
}
234233

module/ASC.Api/ASC.Api.Portal/PortalApi.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1006,6 +1006,13 @@ public void DeletePortalImmediately()
10061006
throw new Exception(Resource.ErrorAccessDenied);
10071007
}
10081008

1009+
var user = CoreContext.UserManager.GetUsers(tenant.OwnerId);
1010+
1011+
if (!SetupInfo.IsSecretEmail(user.Email))
1012+
{
1013+
throw new Exception(Resource.ErrorAccessDenied);
1014+
}
1015+
10091016
CoreContext.TenantManager.RemoveTenant(tenant.TenantId);
10101017

10111018
if (!string.IsNullOrEmpty(ApiSystemHelper.ApiCacheUrl))

module/ASC.Api/ASC.Api.Settings/SettingsApi.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -797,6 +797,9 @@ public void SaveWhiteLabelSettings(string logoText, IEnumerable<ItemKeyValuePair
797797

798798
DemandWhiteLabelPermission();
799799

800+
if (!string.IsNullOrEmpty(logoText) && logoText.Length > 30)
801+
throw new ArgumentException("invalid logoText");
802+
800803
if (isDefault)
801804
{
802805
DemandRebrandingPermission();
@@ -1842,6 +1845,21 @@ public CustomNavigationItem CreateCustomNavigationItem(CustomNavigationItem item
18421845
{
18431846
SecurityContext.DemandPermissions(SecutiryConstants.EditPortalSettings);
18441847

1848+
if (item == null)
1849+
throw new ArgumentNullException();
1850+
1851+
if (string.IsNullOrEmpty(item.Label))
1852+
throw new ArgumentNullException("label");
1853+
1854+
if (item.Label.Length > 25)
1855+
throw new ArgumentException(@"Label exceed limitation of 25 characters.", "label");
1856+
1857+
if (string.IsNullOrEmpty(item.Url))
1858+
throw new ArgumentNullException("url");
1859+
1860+
if (item.Url.Length > 255)
1861+
throw new ArgumentException(@"Url exceed limitation of 255 characters.", "url");
1862+
18451863
var settings = CustomNavigationSettings.Load();
18461864

18471865
var exist = false;

module/ASC.Api/ASC.Api.Settings/SmtpSettingsApi.cs

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,29 @@ public SmtpSettingsWrapper SaveSmtpSettings(SmtpSettingsWrapper smtpSettings)
6969
{
7070
CheckSmtpPermissions();
7171

72-
//TODO: Add validation check
73-
7472
if (smtpSettings == null)
75-
throw new ArgumentNullException("smtpSettings");
73+
throw new ArgumentNullException("smtpSettings");
74+
75+
if (string.IsNullOrEmpty(smtpSettings.Host) || smtpSettings.Host.Length > 255)
76+
throw new ArgumentException("invalid host");
77+
78+
if (smtpSettings.Port < 1 || smtpSettings.Port > 65535)
79+
throw new ArgumentException("expected port range 1 - 65535");
80+
81+
if (string.IsNullOrEmpty(smtpSettings.SenderAddress) || smtpSettings.SenderAddress.Length > 255)
82+
throw new ArgumentException("invalid senderAddress");
83+
84+
if (!string.IsNullOrEmpty(smtpSettings.SenderDisplayName) && smtpSettings.SenderDisplayName.Length > 255)
85+
throw new ArgumentException("invalid senderDisplayName");
86+
87+
if (smtpSettings.EnableAuth)
88+
{
89+
if (string.IsNullOrEmpty(smtpSettings.CredentialsUserName) || smtpSettings.CredentialsUserName.Length > 255)
90+
throw new ArgumentException("invalid credentialsUserName");
91+
92+
if (string.IsNullOrEmpty(smtpSettings.CredentialsUserPassword) || smtpSettings.CredentialsUserPassword.Length > 255)
93+
throw new ArgumentException("invalid credentialsUserPassword");
94+
}
7695

7796
var settingConfig = ToSmtpSettingsConfig(smtpSettings);
7897

module/ASC.Files.AutoCleanUp/Worker.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,13 @@ private void DeleteFilesAndFolders(TenantUserSettings tenantUser)
136136

137137
var itemList = new ItemList<string>();
138138
var trashId = folderDao.GetFolderIDTrash(false, tenantUser.UserId);
139-
139+
140+
if (Convert.ToInt32(trashId) <= 0)
141+
{
142+
_logger.InfoFormat("No trash folder for tenant {0}, user {1}", tenantUser.TenantId, SecurityContext.CurrentAccount.ID);
143+
return;
144+
}
145+
140146
itemList.AddRange(folderDao.GetFolders(trashId)
141147
.Where(x => FileDateTime.GetModifiedOnWithAutoCleanUp(x.ModifiedOn, tenantUser.Setting, true) < now)
142148
.Select(f => "folder_" + f.ID));

module/ASC.Files.Thirdparty/SharePoint/SharePointProviderInfo.cs

Lines changed: 69 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525

2626
using ASC.Common;
2727
using ASC.Common.Caching;
28+
using ASC.Core;
2829
using ASC.Core.Tenants;
2930
using ASC.Files.Core;
3031
using ASC.Web.Files.Classes;
@@ -169,15 +170,27 @@ public Stream GetFileStream(object id, int offset = 0)
169170
var file = GetFileById(id);
170171

171172
if (file is SharePointFileErrorEntry) return null;
172-
var fileInfo = File.OpenBinaryDirect(clientContext, (string)id);
173+
174+
Stream stream;
175+
176+
if (WorkContext.IsMono)
177+
{
178+
stream = OpenBinaryDirect(clientContext, (string)id);
179+
}
180+
else
181+
{
182+
var fileInfo = File.OpenBinaryDirect(clientContext, (string)id);
183+
stream = fileInfo.Stream;
184+
}
185+
173186
clientContext.ExecuteQuery();
174187

175188
var tempBuffer = TempStream.Create();
176-
using (var str = fileInfo.Stream)
189+
using (stream)
177190
{
178-
if (str != null)
191+
if (stream != null)
179192
{
180-
str.CopyTo(tempBuffer);
193+
stream.CopyTo(tempBuffer);
181194
tempBuffer.Flush();
182195
tempBuffer.Seek(offset, SeekOrigin.Begin);
183196
}
@@ -598,5 +611,57 @@ private class SharePointProviderCacheItem
598611

599612
public string FolderKey { get; set; }
600613
}
614+
615+
/// <summary>
616+
/// Hack for Mono: ProtocolViolationException: Cannot send a content-body with this verb-type.
617+
/// </summary>
618+
private static Stream OpenBinaryDirect(ClientContext context, string serverRelativeUrl)
619+
{
620+
if (context == null)
621+
{
622+
throw new ArgumentNullException("context");
623+
}
624+
625+
if (context.HasPendingRequest)
626+
{
627+
throw new ClientRequestException(Resources.GetString("NoDirectHttpRequest"));
628+
}
629+
630+
string requestUrl = MakeFullUrl(context, serverRelativeUrl);
631+
WebRequestExecutor webRequestExecutor = context.WebRequestExecutorFactory.CreateWebRequestExecutor(context, requestUrl);
632+
webRequestExecutor.RequestHeaders[HttpRequestHeader.Translate] = "f";
633+
//context.FireExecutingWebRequestEventInternal(new WebRequestEventArgs(webRequestExecutor));
634+
webRequestExecutor.GetRequestStream().Write(new byte[0], 0, 0);
635+
//webRequestExecutor.RequestMethod = "GET";
636+
webRequestExecutor.Execute();
637+
if (webRequestExecutor.StatusCode != HttpStatusCode.OK)
638+
{
639+
throw new ClientRequestException(Resources.GetString("RequestUnexpectedResponseWithContentTypeAndStatus", webRequestExecutor.ResponseContentType, webRequestExecutor.StatusCode));
640+
}
641+
642+
//string etag = webRequestExecutor.ResponseHeaders["ETag"];
643+
// return new FileInformation(webRequestExecutor.GetResponseStream(), etag);
644+
return webRequestExecutor.GetResponseStream();
645+
}
646+
647+
private static string MakeFullUrl(ClientContext context, string serverRelativeUrl)
648+
{
649+
if (context == null)
650+
{
651+
throw new ArgumentNullException("context");
652+
}
653+
654+
if (serverRelativeUrl == null)
655+
{
656+
throw new ArgumentNullException("serverRelativeUrl");
657+
}
658+
659+
if (!serverRelativeUrl.StartsWith("/"))
660+
{
661+
throw new ArgumentOutOfRangeException("serverRelativeUrl");
662+
}
663+
664+
return new Uri(new Uri(context.Url), serverRelativeUrl).AbsoluteUri;
665+
}
601666
}
602667
}

0 commit comments

Comments
 (0)