moved from ddf515b8

This commit is contained in:
pavelbannov 2022-06-16 17:16:46 +03:00
parent 430542b2ea
commit 56ece27e1b
11 changed files with 43 additions and 67 deletions

1
build/scripts/webdav.bat Normal file
View File

@ -0,0 +1 @@
yarn install --cwd %~dp0../../common/ASC.WebDav/ --frozen-lockfile

View File

@ -47,8 +47,7 @@ public class DbLoginEventsManager
private readonly ICache _cache;
private readonly TenantManager _tenantManager;
private readonly SecurityContext _securityContext;
private readonly TenantUtil _tenantUtil;
private readonly AuthContext _authContext;
private readonly IMapper _mapper;
private MessagesContext LoginEventContext => _lazyLoginEventContext.Value;
@ -57,15 +56,14 @@ public class DbLoginEventsManager
public DbLoginEventsManager(
ICache cache,
TenantManager tenantManager,
SecurityContext securityContext,
AuthContext authContext,
DbContextManager<MessagesContext> dbContextManager,
TenantUtil tenantUtil,
IMapper mapper)
{
_cache = cache;
_tenantManager = tenantManager;
_securityContext = securityContext;
_tenantUtil = tenantUtil;
_authContext = authContext;
_mapper = mapper;
_lazyLoginEventContext = new Lazy<MessagesContext>(() => dbContextManager.Value);
}
@ -169,7 +167,7 @@ public class DbLoginEventsManager
public void ResetCache()
{
var tenantId = _tenantManager.GetCurrentTenant().Id;
var userId = _securityContext.CurrentAccount.ID;
var userId = _authContext.CurrentAccount.ID;
ResetCache(tenantId, userId);
}

View File

@ -53,11 +53,11 @@ public class BackupWorker
_logger = logger;
_progressQueue = queueFactory.CreateQueue(CUSTOM_DISTRIBUTED_TASK_QUEUE_NAME);
_tempPath = tempPath;
TempFolder = Path.Combine(_tempPath.GetTempPath(), "backup");
}
public void Start(BackupSettings settings)
{
TempFolder = Path.Combine(_tempPath.GetTempPath(), "backup");
if (!Directory.Exists(TempFolder))
{
Directory.CreateDirectory(TempFolder);

View File

@ -46,13 +46,15 @@ public class BackupCleanerTempFileService : BackgroundService
{
var date = DateTime.UtcNow.AddDays(-7);
var regex = new Regex(@"^\w*_\d{4}-\d{2}-\d{2}_\d{2}-\d{2}-\d{2}.tar.gz$");
var files = Directory.EnumerateFiles(_tempFolder).Where(f => regex.IsMatch(Path.GetFileName(f)) && new FileInfo(f).LastWriteTimeUtc < date);
foreach (var file in files)
if (Directory.Exists(_tempFolder))
{
File.Delete(file);
_logger.InfoBackupCleanerDeleteFile(Path.GetFileName(file));
var files = Directory.EnumerateFiles(_tempFolder).Where(f => regex.IsMatch(Path.GetFileName(f)) && new FileInfo(f).LastWriteTimeUtc < date);
foreach (var file in files)
{
File.Delete(file);
_logger.InfoBackupCleanerDeleteFile(Path.GetFileName(file));
}
}
await Task.Delay(TimeSpan.FromDays(1), stoppingToken);
}

View File

@ -112,7 +112,8 @@
"url": ""
},
"support-feedback": "https://helpdesk.onlyoffice.com",
"teamlab-site": "http://www.onlyoffice.com"
"teamlab-site": "http://www.onlyoffice.com",
"max-upload-size" : 5242880
},
"ConnectionStrings": {
"default": {

View File

@ -489,37 +489,6 @@
"twiliosender": ""
}
}
},
{
"type": "ASC.FederatedLogin.LoginProviders.YahooLoginProvider, ASC.FederatedLogin",
"services": [
{
"type": "ASC.Core.Common.Configuration.Consumer, ASC.Core.Common"
},
{
"type": "ASC.FederatedLogin.LoginProviders.YahooLoginProvider, ASC.FederatedLogin"
},
{
"key": "yahoo",
"type": "ASC.Core.Common.Configuration.Consumer, ASC.Core.Common"
},
{
"key": "yahoo",
"type": "ASC.FederatedLogin.LoginProviders.YahooLoginProvider, ASC.FederatedLogin"
}
],
"instanceScope": "perlifetimescope",
"parameters": {
"name": "yahoo",
"order": "14",
"props": {
"yahooClientId": "",
"yahooClientSecret": ""
},
"additional": {
"yahooRedirectUrl" : "https://service.teamlab.info/oauth2.aspx"
}
}
},
{
"type": "ASC.FederatedLogin.LoginProviders.VKLoginProvider, ASC.FederatedLogin",

View File

@ -70,8 +70,7 @@ internal class FileDao : AbstractDao, IFileDao<int>
ProviderFolderDao providerFolderDao,
CrossDao crossDao,
Settings settings,
IMapper mapper,
EntryProperties entryProperties)
IMapper mapper)
: base(
dbContextManager,
userManager,
@ -1579,12 +1578,15 @@ internal class FileDao : AbstractDao, IFileDao<int>
.Any(),
Deny = (from f in FilesDbContext.Security.AsQueryable()
where f.EntryType == FileEntryType.File && f.EntryId == r.Id.ToString() && f.TenantId == r.TenantId && (new[] { FileConstant.DenyDownloadId, FileConstant.DenySharingId }).Contains(f.Subject)
select new DbFileDeny
{
DenyDownload = f.Subject == FileConstant.DenyDownloadId,
DenySharing = f.Subject == FileConstant.DenySharingId
}
).Aggregate((a, b) => new DbFileDeny { DenyDownload = a.DenyDownload || b.DenyDownload, DenySharing = a.DenySharing || b.DenySharing }),
select f
).GroupBy(a => a.EntryId,
(a, b) =>
new DbFileDeny
{
DenyDownload = b.Any(c => c.Subject == FileConstant.DenyDownloadId),
DenySharing = b.Any(c => c.Subject == FileConstant.DenySharingId)
})
.FirstOrDefault(),
};
}
@ -1613,12 +1615,15 @@ internal class FileDao : AbstractDao, IFileDao<int>
.Any(),
Deny = (from f in FilesDbContext.Security.AsQueryable()
where f.EntryType == FileEntryType.File && f.EntryId == r.Id.ToString() && f.TenantId == r.TenantId && (new[] { FileConstant.DenyDownloadId, FileConstant.DenySharingId }).Contains(f.Subject)
select new DbFileDeny
{
DenyDownload = f.Subject == FileConstant.DenyDownloadId,
DenySharing = f.Subject == FileConstant.DenySharingId
}
).Aggregate((a, b) => new DbFileDeny { DenyDownload = a.DenyDownload || b.DenyDownload, DenySharing = a.DenySharing || b.DenySharing }),
select f
).GroupBy(a => a.EntryId,
(a, b) =>
new DbFileDeny
{
DenyDownload = b.Any(c => c.Subject == FileConstant.DenyDownloadId),
DenySharing = b.Any(c => c.Subject == FileConstant.DenySharingId)
})
.FirstOrDefault(),
});
}

View File

@ -448,13 +448,11 @@ public class DocumentServiceTrackerHelper
if (fileData.Status == TrackerStatus.ForceSave && fileData.ForceSaveType == TrackerData.ForceSaveInitiator.UserSubmit)
{
_entryManager.SubmitFillForm(file);
await _entryManager.SubmitFillForm(file);
}
}
var result = new TrackResponse { Message = saveMessage };
return result;
return new TrackResponse { Message = saveMessage };
}
private async Task<TrackResponse> ProcessMailMergeAsync<T>(T fileId, TrackerData fileData)

View File

@ -42,6 +42,7 @@
namespace ASC.Files.AutoCleanUp;
[Singletone]
public class Launcher : BackgroundService
{
private readonly ILogger<Launcher> _logger;

View File

@ -53,7 +53,7 @@ public class Worker
public Worker(IConfiguration configuration, ILogger<Worker> logger, IServiceScopeFactory serviceScopeFactory)
{
_period = TimeSpan.Parse(configuration.GetValue<string>("files:autoCleanUp:period"));
_period = TimeSpan.Parse(configuration.GetValue<string>("files:autoCleanUp:period") ?? "0:5:0");
_logger = logger;
_serviceScopeFactory = serviceScopeFactory;
}

View File

@ -1081,6 +1081,7 @@ public static class ResizeWorkerItemExtension
{
public static void Register(DIHelper services)
{
services.TryAdd<ResizeWorkerItem>();
services.Configure<DistributedTaskQueueFactoryOptions>(UserPhotoManager.CUSTOM_DISTRIBUTED_TASK_QUEUE_NAME, options =>
{
options.MaxThreadsCount = 2;