Skip to content

Commit

Permalink
Update to v12.7.1
Browse files Browse the repository at this point in the history
  • Loading branch information
JenkinsRobo committed Dec 23, 2024
1 parent d59e563 commit 003395b
Show file tree
Hide file tree
Showing 58 changed files with 776 additions and 591 deletions.
41 changes: 41 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,41 @@
# Change log

## Version 12.7.1

### General portal changes

* Fixed the issue with receiving an instance-id for AMI.
* Made changes for requests to docbuilder using the shardkey parameter.
* Fixed the critical issue in the AutoCleanUp service (Bug 71281).
* Fixed the issue with missing the Comment tab in PDF files (Bug 70867).
* Hidden buttons for creating a PDF form in the Private room.
* Enabled SharePoint connection on UNIX systems.
* Fixed the issue with the JWT secret during update (Bug 71036).
* Fixed the issue with single-component installation updates (Bug 70862).
* 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).
* Fixed passing of the logoDark parameter to the editor.
* Fixed the ability to specify an unlimited number of characters in all SMTP parameters (Bug 71859).
* Fixed the ability to set port to "999999999" in Workspace SMTP parameters (Bug 71860).
* 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).
* Fixed the issue with the unlimited length of the share link name and password (Bug 71862).
* 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 ).
* 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).
* Added deletion of the synchronization client in case of a critical error in ImapSync (to allow reconnection).
* Fixed the issue when the bottom part of the title in the event and task viewing window is cut off (Bug 47353).
* Fixed the issue with configuring Windows feature (Bug 71923).
* Fixed duplicate Downloading text in the prerequisites installation UI.
* Fixed the issue when Google connection as a Storage is not available on Linux distributions (Bug 72205).

### Documents module

* 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.
* Added empty file templates for creation in the following languages: fi-FI, he-IL, nb-NO, sl-SI.
* Starting documents now have titles in the corresponding language.

### Control Panel

* Fixed the issue when the /controlpanel/https page crashes with the 502 error after restarting the container. (Bug 71794).

## Version 12.7.0

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

### Documents module

Expand Down
4 changes: 4 additions & 0 deletions common/ASC.Core.Common/Billing/BillingClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,10 @@ public IDictionary<string, Dictionary<string, decimal>> GetProductPriceInfo(stri
return new Dictionary<string, Dictionary<string, decimal>>();
}

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

private string CreateAuthToken(string pkey, string machinekey)
{
Expand Down
2 changes: 2 additions & 0 deletions common/ASC.Core.Common/Billing/ITariffService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,7 @@ public interface ITariffService
string GetButton(int tariffId, string partnerId);

void SaveButton(int tariffId, string partnerId, string buttonUrl);

void ChangeDocspaceNonProfitTariff(int tenantId, bool isActive);
}
}
24 changes: 24 additions & 0 deletions common/ASC.Core.Common/Billing/TariffService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public class TariffService : DbBaseService, ITariffService
private readonly CoreConfiguration config;
private readonly bool test;
private readonly int paymentDelay;
private readonly string dsregion;

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


Expand Down Expand Up @@ -438,6 +440,28 @@ public void SaveButton(int tariffId, string partnerId, string buttonUrl)
ExecNonQuery(q);
}

public void ChangeDocspaceNonProfitTariff(int tenantId, bool isActive)
{
if (!IsDocspace || !BillingClient.Configured)
{
return;
}

var portalId = dsregion + tenantId;

try
{
var client = GetBillingClient();
var result = client.ChangeDocspaceNonProfitTariff(portalId, isActive);

log.Debug($"ChangeDocspaceNonProfitTariff portal {portalId} isActive: {isActive} result {result}");
}
catch (Exception error)
{
LogError(error, portalId);
}
}


private Tariff GetBillingInfo(int tenant)
{
Expand Down
2 changes: 1 addition & 1 deletion common/ASC.Core.Common/Data/DbTenantService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ private SqlQuery TenantsQuery(Exp where)
.Select("t.id", "t.alias", "t.mappeddomain", "t.version", "t.version_changed", "t.name", "t.language", "t.timezone", "t.owner_id")
.Select("t.trusteddomains", "t.trusteddomainsenabled", "t.creationdatetime", "t.status", "t.statuschanged", "t.payment_id", "t.last_modified")
.Select("NULL", "NULL", "NULL")
.Select("t.industry", "t.spam", "t.calls")
.Select("t.industry", "0", "t.calls")
.Where(where);
}

Expand Down
21 changes: 10 additions & 11 deletions common/ASC.Core.Common/HostedSolution.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,6 @@ public bool IsDocspace
get { return tenantService.IsDocspace; }
}

public int DocspaceDefaultQuota
{
get
{
return int.TryParse(ConfigurationManagerExtension.AppSettings["docspace.default.quota"], out var quota) ? quota : -3;
}
}

public HostedSolution(ConnectionStringSettings connectionString)
: this(connectionString, null)
{
Expand Down Expand Up @@ -225,10 +217,17 @@ public TenantQuota SaveTenantQuota(TenantQuota quota)

public void SetTariff(int tenant, bool paid)
{
var quota = quotaService.GetTenantQuotas().FirstOrDefault(q => paid ? q.NonProfit : IsDocspace ? q.Id == DocspaceDefaultQuota : q.Trial);
if (quota != null)
if (IsDocspace)
{
tariffService.ChangeDocspaceNonProfitTariff(tenant, paid);
}
else
{
tariffService.SetTariff(tenant, new Tariff { QuotaId = quota.Id, DueDate = DateTime.MaxValue, Quantity = 1 });
var quota = quotaService.GetTenantQuotas().FirstOrDefault(q => paid ? q.NonProfit : q.Trial);
if (quota != null)
{
tariffService.SetTariff(tenant, new Tariff { QuotaId = quota.Id, DueDate = DateTime.MaxValue, Quantity = 1 });
}
}
}

Expand Down
7 changes: 7 additions & 0 deletions module/ASC.Api/ASC.Api.Portal/PortalApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1006,6 +1006,13 @@ public void DeletePortalImmediately()
throw new Exception(Resource.ErrorAccessDenied);
}

var user = CoreContext.UserManager.GetUsers(tenant.OwnerId);

if (!SetupInfo.IsSecretEmail(user.Email))
{
throw new Exception(Resource.ErrorAccessDenied);
}

CoreContext.TenantManager.RemoveTenant(tenant.TenantId);

if (!string.IsNullOrEmpty(ApiSystemHelper.ApiCacheUrl))
Expand Down
18 changes: 18 additions & 0 deletions module/ASC.Api/ASC.Api.Settings/SettingsApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -797,6 +797,9 @@ public void SaveWhiteLabelSettings(string logoText, IEnumerable<ItemKeyValuePair

DemandWhiteLabelPermission();

if (!string.IsNullOrEmpty(logoText) && logoText.Length > 30)
throw new ArgumentException("invalid logoText");

if (isDefault)
{
DemandRebrandingPermission();
Expand Down Expand Up @@ -1842,6 +1845,21 @@ public CustomNavigationItem CreateCustomNavigationItem(CustomNavigationItem item
{
SecurityContext.DemandPermissions(SecutiryConstants.EditPortalSettings);

if (item == null)
throw new ArgumentNullException();

if (string.IsNullOrEmpty(item.Label))
throw new ArgumentNullException("label");

if (item.Label.Length > 25)
throw new ArgumentException(@"Label exceed limitation of 25 characters.", "label");

if (string.IsNullOrEmpty(item.Url))
throw new ArgumentNullException("url");

if (item.Url.Length > 255)
throw new ArgumentException(@"Url exceed limitation of 255 characters.", "url");

var settings = CustomNavigationSettings.Load();

var exist = false;
Expand Down
25 changes: 22 additions & 3 deletions module/ASC.Api/ASC.Api.Settings/SmtpSettingsApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,29 @@ public SmtpSettingsWrapper SaveSmtpSettings(SmtpSettingsWrapper smtpSettings)
{
CheckSmtpPermissions();

//TODO: Add validation check

if (smtpSettings == null)
throw new ArgumentNullException("smtpSettings");
throw new ArgumentNullException("smtpSettings");

if (string.IsNullOrEmpty(smtpSettings.Host) || smtpSettings.Host.Length > 255)
throw new ArgumentException("invalid host");

if (smtpSettings.Port < 1 || smtpSettings.Port > 65535)
throw new ArgumentException("expected port range 1 - 65535");

if (string.IsNullOrEmpty(smtpSettings.SenderAddress) || smtpSettings.SenderAddress.Length > 255)
throw new ArgumentException("invalid senderAddress");

if (!string.IsNullOrEmpty(smtpSettings.SenderDisplayName) && smtpSettings.SenderDisplayName.Length > 255)
throw new ArgumentException("invalid senderDisplayName");

if (smtpSettings.EnableAuth)
{
if (string.IsNullOrEmpty(smtpSettings.CredentialsUserName) || smtpSettings.CredentialsUserName.Length > 255)
throw new ArgumentException("invalid credentialsUserName");

if (string.IsNullOrEmpty(smtpSettings.CredentialsUserPassword) || smtpSettings.CredentialsUserPassword.Length > 255)
throw new ArgumentException("invalid credentialsUserPassword");
}

var settingConfig = ToSmtpSettingsConfig(smtpSettings);

Expand Down
8 changes: 7 additions & 1 deletion module/ASC.Files.AutoCleanUp/Worker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,13 @@ private void DeleteFilesAndFolders(TenantUserSettings tenantUser)

var itemList = new ItemList<string>();
var trashId = folderDao.GetFolderIDTrash(false, tenantUser.UserId);


if (Convert.ToInt32(trashId) <= 0)
{
_logger.InfoFormat("No trash folder for tenant {0}, user {1}", tenantUser.TenantId, SecurityContext.CurrentAccount.ID);
return;
}

itemList.AddRange(folderDao.GetFolders(trashId)
.Where(x => FileDateTime.GetModifiedOnWithAutoCleanUp(x.ModifiedOn, tenantUser.Setting, true) < now)
.Select(f => "folder_" + f.ID));
Expand Down
73 changes: 69 additions & 4 deletions module/ASC.Files.Thirdparty/SharePoint/SharePointProviderInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

using ASC.Common;
using ASC.Common.Caching;
using ASC.Core;
using ASC.Core.Tenants;
using ASC.Files.Core;
using ASC.Web.Files.Classes;
Expand Down Expand Up @@ -169,15 +170,27 @@ public Stream GetFileStream(object id, int offset = 0)
var file = GetFileById(id);

if (file is SharePointFileErrorEntry) return null;
var fileInfo = File.OpenBinaryDirect(clientContext, (string)id);

Stream stream;

if (WorkContext.IsMono)
{
stream = OpenBinaryDirect(clientContext, (string)id);
}
else
{
var fileInfo = File.OpenBinaryDirect(clientContext, (string)id);
stream = fileInfo.Stream;
}

clientContext.ExecuteQuery();

var tempBuffer = TempStream.Create();
using (var str = fileInfo.Stream)
using (stream)
{
if (str != null)
if (stream != null)
{
str.CopyTo(tempBuffer);
stream.CopyTo(tempBuffer);
tempBuffer.Flush();
tempBuffer.Seek(offset, SeekOrigin.Begin);
}
Expand Down Expand Up @@ -598,5 +611,57 @@ private class SharePointProviderCacheItem

public string FolderKey { get; set; }
}

/// <summary>
/// Hack for Mono: ProtocolViolationException: Cannot send a content-body with this verb-type.
/// </summary>
private static Stream OpenBinaryDirect(ClientContext context, string serverRelativeUrl)
{
if (context == null)
{
throw new ArgumentNullException("context");
}

if (context.HasPendingRequest)
{
throw new ClientRequestException(Resources.GetString("NoDirectHttpRequest"));
}

string requestUrl = MakeFullUrl(context, serverRelativeUrl);
WebRequestExecutor webRequestExecutor = context.WebRequestExecutorFactory.CreateWebRequestExecutor(context, requestUrl);
webRequestExecutor.RequestHeaders[HttpRequestHeader.Translate] = "f";
//context.FireExecutingWebRequestEventInternal(new WebRequestEventArgs(webRequestExecutor));
webRequestExecutor.GetRequestStream().Write(new byte[0], 0, 0);
//webRequestExecutor.RequestMethod = "GET";
webRequestExecutor.Execute();
if (webRequestExecutor.StatusCode != HttpStatusCode.OK)
{
throw new ClientRequestException(Resources.GetString("RequestUnexpectedResponseWithContentTypeAndStatus", webRequestExecutor.ResponseContentType, webRequestExecutor.StatusCode));
}

//string etag = webRequestExecutor.ResponseHeaders["ETag"];
// return new FileInformation(webRequestExecutor.GetResponseStream(), etag);
return webRequestExecutor.GetResponseStream();
}

private static string MakeFullUrl(ClientContext context, string serverRelativeUrl)
{
if (context == null)
{
throw new ArgumentNullException("context");
}

if (serverRelativeUrl == null)
{
throw new ArgumentNullException("serverRelativeUrl");
}

if (!serverRelativeUrl.StartsWith("/"))
{
throw new ArgumentOutOfRangeException("serverRelativeUrl");
}

return new Uri(new Uri(context.Url), serverRelativeUrl).AbsoluteUri;
}
}
}
Loading

0 comments on commit 003395b

Please sign in to comment.