Merge branch 'develop' into feature/submit-to-form-gallery

This commit is contained in:
Mushka Nikita 2023-06-28 11:52:09 +03:00
commit a81c366fc2
265 changed files with 49208 additions and 42996 deletions

View File

@ -23,7 +23,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.Core.Common", "common\A
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.Migration.Creator", "common\Tools\ASC.Migration.Creator\ASC.Migration.Creator.csproj", "{4BECDA03-E5E7-4273-B2D5-65AD3B1D0AF6}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.Migration.Core", "common\Tools\ASC.Migration.Core\ASC.Migration.Core.csproj", "{4E971C04-8D1F-4C07-8D6F-C062C114CF7F}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.Migrations.Core", "common\Tools\ASC.Migrations.Core\ASC.Migrations.Core.csproj", "{4E971C04-8D1F-4C07-8D6F-C062C114CF7F}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.Migration.Runner", "common\Tools\ASC.Migration.Runner\ASC.Migration.Runner.csproj", "{249DC522-AC3B-475C-B77E-52CE0322E686}"
EndProject

View File

@ -211,7 +211,7 @@ public class LicenseReader
var tariff = new Tariff
{
Quotas = new List<Quota> { new Quota(quota.Tenant, 1) },
Quotas = new List<Quota> { new Quota(quota.TenantId, 1) },
DueDate = license.DueDate,
};

View File

@ -194,8 +194,8 @@ public class TariffService : ITariffService
var paymentEndDate = 9999 <= currentPayment.EndDate.Year ? DateTime.MaxValue : currentPayment.EndDate;
asynctariff.DueDate = DateTime.Compare(asynctariff.DueDate, paymentEndDate) < 0 ? asynctariff.DueDate : paymentEndDate;
asynctariff.Quotas = asynctariff.Quotas.Where(r => r.Id != quota.Tenant).ToList();
asynctariff.Quotas.Add(new Quota(quota.Tenant, currentPayment.Quantity));
asynctariff.Quotas = asynctariff.Quotas.Where(r => r.Id != quota.TenantId).ToList();
asynctariff.Quotas.Add(new Quota(quota.TenantId, currentPayment.Quantity));
email = currentPayment.PaymentEmail;
}
@ -203,7 +203,7 @@ public class TariffService : ITariffService
foreach (var quota in asynctariff.Quotas)
{
var tenantQuota = tenantQuotas.SingleOrDefault(q => q.Tenant == quota.Id);
var tenantQuota = tenantQuotas.SingleOrDefault(q => q.TenantId == quota.Id);
tenantQuota *= quota.Quantity;
updatedQuota += tenantQuota;
@ -297,7 +297,7 @@ public class TariffService : ITariffService
var quota = await _quotaService.GetTenantQuotaAsync(quotaId);
var mustUpdateQuota = newQuotas.FirstOrDefault(q => q.Tenant == quota.Tenant);
var mustUpdateQuota = newQuotas.FirstOrDefault(q => q.TenantId == quota.TenantId);
if (mustUpdateQuota != null)
{
qty = quantity[mustUpdateQuota.Name];
@ -308,7 +308,7 @@ public class TariffService : ITariffService
}
// add new quotas
var addedQuotas = newQuotas.Where(q => !tariff.Quotas.Any(t => t.Id == q.Tenant));
var addedQuotas = newQuotas.Where(q => !tariff.Quotas.Any(t => t.Id == q.TenantId));
foreach (var addedQuota in addedQuotas)
{
var qty = quantity[addedQuota.Name];
@ -424,7 +424,7 @@ public class TariffService : ITariffService
var quota = quotas.SingleOrDefault(q => q.ProductId == pi.ProductRef.ToString());
if (quota != null)
{
pi.QuotaId = quota.Tenant;
pi.QuotaId = quota.TenantId;
}
payments.Add(pi);
}
@ -684,7 +684,7 @@ public class TariffService : ITariffService
if (tenant.HasValue)
{
q = q.Where(r => r.Tenant == tenant.Value);
q = q.Where(r => r.TenantId == tenant.Value);
}
if (id.HasValue)
@ -705,7 +705,7 @@ public class TariffService : ITariffService
tariff.CustomerId = r.CustomerId;
var tariffRows = coreDbContext.TariffRows
.Where(row => row.TariffId == r.Id && row.Tenant == tenant);
.Where(row => row.TariffId == r.Id && row.TenantId == tenant);
tariff.Quotas = await tariffRows.Select(r => new Quota(r.Quota, r.Quantity)).ToListAsync();
@ -737,7 +737,7 @@ public class TariffService : ITariffService
var efTariff = new DbTariff
{
Id = tariffInfo.Id,
Tenant = tenant,
TenantId = tenant,
Stamp = stamp,
CustomerId = tariffInfo.CustomerId,
CreateOn = DateTime.UtcNow
@ -764,7 +764,7 @@ public class TariffService : ITariffService
TariffId = efTariff.Id,
Quota = q.Id,
Quantity = q.Quantity,
Tenant = tenant
TenantId = tenant
});
}
@ -802,11 +802,11 @@ public class TariffService : ITariffService
const int tenant = Tenant.DefaultTenant;
using var coreDbContext = _dbContextFactory.CreateDbContext();
var tariffs = await coreDbContext.Tariffs.Where(r => r.Tenant == tenant).ToListAsync();
var tariffs = await coreDbContext.Tariffs.Where(r => r.TenantId == tenant).ToListAsync();
foreach (var t in tariffs)
{
t.Tenant = -2;
t.TenantId = -2;
t.CreateOn = DateTime.UtcNow;
}
@ -920,7 +920,7 @@ public class TariffService : ITariffService
if (toAdd != null)
{
tariff.Quotas.Add(new Quota(toAdd.Tenant, 1));
tariff.Quotas.Add(new Quota(toAdd.TenantId, 1));
}
}
@ -1002,4 +1002,4 @@ public class TariffService : ITariffService
{
return _paymentDelay;
}
}
}

View File

@ -43,7 +43,7 @@ class AzServiceCache
private void UpdateCache(AzRecord r, bool remove)
{
var aces = Cache.Get<AzRecordStore>(GetKey(r.Tenant));
var aces = Cache.Get<AzRecordStore>(GetKey(r.TenantId));
if (aces != null)
{
lock (aces)

View File

@ -107,7 +107,7 @@ class CachedQuotaService : IQuotaService
public async Task<TenantQuota> GetTenantQuotaAsync(int tenant)
{
return (await GetTenantQuotasAsync()).SingleOrDefault(q => q.Tenant == tenant);
return (await GetTenantQuotasAsync()).SingleOrDefault(q => q.TenantId == tenant);
}
public async Task<TenantQuota> SaveTenantQuotaAsync(TenantQuota quota)
@ -126,11 +126,11 @@ class CachedQuotaService : IQuotaService
public async Task SetTenantQuotaRowAsync(TenantQuotaRow row, bool exchange)
{
await Service.SetTenantQuotaRowAsync(row, exchange);
CacheNotify.Publish(new QuotaCacheItem { Key = GetKey(row.Tenant) }, CacheNotifyAction.Any);
CacheNotify.Publish(new QuotaCacheItem { Key = GetKey(row.TenantId) }, CacheNotifyAction.Any);
if (row.UserId != Guid.Empty)
{
CacheNotify.Publish(new QuotaCacheItem { Key = GetKey(row.Tenant, row.UserId) }, CacheNotifyAction.Any);
CacheNotify.Publish(new QuotaCacheItem { Key = GetKey(row.TenantId, row.UserId) }, CacheNotifyAction.Any);
}
}

View File

@ -315,6 +315,12 @@ class CachedTenantService : ITenantService
_cacheNotifyItem.Publish(new TenantCacheItem() { TenantId = id }, CacheNotifyAction.InsertOrUpdate);
}
public async Task PermanentlyRemoveTenantAsync(int id)
{
await _service.PermanentlyRemoveTenantAsync(id);
_cacheNotifyItem.Publish(new TenantCacheItem() { TenantId = id }, CacheNotifyAction.Remove);
}
public async Task<IEnumerable<TenantVersion>> GetTenantVersionsAsync()
{
return await _service.GetTenantVersionsAsync();

View File

@ -93,7 +93,7 @@ public class UserServiceCache
private void UpdateUserGroupRefCache(UserGroupRef r)
{
var key = GetRefCacheKey(r.Tenant);
var key = GetRefCacheKey(r.TenantId);
var refs = Cache.Get<UserGroupRefStore>(key);
if (refs != null)
{
@ -408,7 +408,7 @@ public class CachedUserService : IUserService, ICachedService
{
await Service.RemoveUserGroupRefAsync(tenant, userId, groupId, refType);
var r = new UserGroupRef(userId, groupId, refType) { Tenant = tenant, Removed = true };
var r = new UserGroupRef(userId, groupId, refType) { TenantId = tenant, Removed = true };
CacheUserGroupRefItem.Publish(r, CacheNotifyAction.Remove);
}

View File

@ -382,7 +382,7 @@ public class TenantManager
public async Task<IEnumerable<TenantQuota>> GetTenantQuotasAsync(bool all)
{
return (await QuotaService.GetTenantQuotasAsync()).Where(q => q.Tenant < 0 && (all || q.Visible)).OrderByDescending(q => q.Tenant).ToList();
return (await QuotaService.GetTenantQuotasAsync()).Where(q => q.TenantId < 0 && (all || q.Visible)).OrderByDescending(q => q.TenantId).ToList();
}
public async Task<TenantQuota> GetCurrentTenantQuotaAsync(bool refresh = false)
@ -393,7 +393,7 @@ public class TenantManager
public async Task<TenantQuota> GetTenantQuotaAsync(int tenant, bool refresh = false)
{
var defaultQuota = await QuotaService.GetTenantQuotaAsync(tenant) ?? await QuotaService.GetTenantQuotaAsync(Tenant.DefaultTenant) ?? TenantQuota.Default;
if (defaultQuota.Tenant != tenant && TariffService != null)
if (defaultQuota.TenantId != tenant && TariffService != null)
{
var tariff = await TariffService.GetTariffAsync(tenant, refresh: refresh);
@ -456,7 +456,7 @@ public class TenantManager
catch
{
throw;
}
}
finally
{
_semaphore.Release();
@ -467,4 +467,4 @@ public class TenantManager
{
return (await QuotaService.FindTenantQuotaRowsAsync(tenantId)).ToList();
}
}
}

View File

@ -33,7 +33,7 @@ public class AzRecord : IMapFrom<Acl>
public Guid Action { get; set; }
public string Object { get; set; }
public AceType AceType { get; set; }
public int Tenant { get; set; }
public int TenantId { get; set; }
public AzRecord() { }
@ -59,7 +59,7 @@ public class AzRecord : IMapFrom<Acl>
{
var result = new AzRecord()
{
Tenant = cache.Tenant
TenantId = cache.Tenant
};
@ -91,14 +91,14 @@ public class AzRecord : IMapFrom<Acl>
ActionId = cache.Action.ToString(),
ObjectId = cache.Object,
Reaction = cache.AceType.ToString(),
Tenant = cache.Tenant
Tenant = cache.TenantId
};
}
public override bool Equals(object obj)
{
return obj is AzRecord r &&
r.Tenant == Tenant &&
r.TenantId == TenantId &&
r.Subject == Subject &&
r.Action == Action &&
r.Object == Object &&
@ -107,7 +107,7 @@ public class AzRecord : IMapFrom<Acl>
public override int GetHashCode()
{
return Tenant.GetHashCode() ^
return TenantId.GetHashCode() ^
Subject.GetHashCode() ^
Action.GetHashCode() ^
(Object ?? string.Empty).GetHashCode() ^

View File

@ -34,7 +34,7 @@ public class Group : IMapFrom<DbGroup>
public Guid CategoryId { get; set; }
public bool Removed { get; set; }
public DateTime LastModified { get; set; }
public int Tenant { get; set; }
public int TenantId { get; set; }
public string Sid { get; set; }
public override string ToString()

View File

@ -44,6 +44,7 @@ public interface ITenantService
Task<Tenant> SaveTenantAsync(CoreSettings coreSettings, Tenant tenant);
Task RemoveTenantAsync(int id, bool auto = false);
Task SetTenantSettingsAsync(int tenant, string key, byte[] data);
Task PermanentlyRemoveTenantAsync(int id);
void SetTenantSettings(int tenant, string key, byte[] data);
Task ValidateDomainAsync(string domain);
}

View File

@ -34,7 +34,7 @@ public class UserGroupRef : IMapFrom<UserGroup>
public bool Removed { get; set; }
public DateTime LastModified { get; set; }
public UserGroupRefType RefType { get; set; }
public int Tenant { get; set; }
public int TenantId { get; set; }
public UserGroupRef() { }
@ -52,17 +52,17 @@ public class UserGroupRef : IMapFrom<UserGroup>
public string CreateKey()
{
return CreateKey(Tenant, UserId, GroupId, RefType);
return CreateKey(TenantId, UserId, GroupId, RefType);
}
public override int GetHashCode()
{
return UserId.GetHashCode() ^ GroupId.GetHashCode() ^ Tenant.GetHashCode() ^ RefType.GetHashCode();
return UserId.GetHashCode() ^ GroupId.GetHashCode() ^ TenantId.GetHashCode() ^ RefType.GetHashCode();
}
public override bool Equals(object obj)
{
return obj is UserGroupRef r && r.Tenant == Tenant && r.UserId == UserId && r.GroupId == GroupId && r.RefType == RefType;
return obj is UserGroupRef r && r.TenantId == TenantId && r.UserId == UserId && r.GroupId == GroupId && r.RefType == RefType;
}
public void Mapping(Profile profile)
@ -84,7 +84,7 @@ public class UserGroupRef : IMapFrom<UserGroup>
result.RefType = refType;
}
result.Tenant = cache.Tenant;
result.TenantId = cache.Tenant;
result.LastModified = new DateTime(cache.LastModified);
result.Removed = cache.Removed;
@ -100,7 +100,7 @@ public class UserGroupRef : IMapFrom<UserGroup>
RefType = cache.RefType.ToString(),
LastModified = cache.LastModified.Ticks,
Removed = cache.Removed,
Tenant = cache.Tenant
Tenant = cache.TenantId
};
}
}

View File

@ -65,7 +65,7 @@ public sealed class UserInfo : IDirectRecipient, ICloneable, IMapFrom<User>
public string Notes { get; set; }
public bool Removed { get; set; }
public DateTime LastModified { get; set; }
public int Tenant { get; set; }
public int TenantId { get; set; }
public bool IsActive => ActivationStatus.HasFlag(EmployeeActivationStatus.Activated);
public string CultureName { get; set; }
public string MobilePhone { get; set; }

View File

@ -45,20 +45,20 @@ class DbAzService : IAzService
// row with tenant = -1 - common for all tenants, but equal row with tenant != -1 escape common row for the portal
var commonAces = await
userDbContext.Acl
.Where(r => r.Tenant == Tenant.DefaultTenant)
.Where(r => r.TenantId == Tenant.DefaultTenant)
.ProjectTo<AzRecord>(_mapper.ConfigurationProvider)
.ToDictionaryAsync(a => string.Concat(a.Tenant.ToString(), a.Subject.ToString(), a.Action.ToString(), a.Object));
.ToDictionaryAsync(a => string.Concat(a.TenantId.ToString(), a.Subject.ToString(), a.Action.ToString(), a.Object));
var tenantAces = await
userDbContext.Acl
.Where(r => r.Tenant == tenant)
.Where(r => r.TenantId == tenant)
.ProjectTo<AzRecord>(_mapper.ConfigurationProvider)
.ToListAsync();
// remove excaped rows
foreach (var a in tenantAces)
{
var key = string.Concat(a.Tenant.ToString(), a.Subject.ToString(), a.Action.ToString(), a.Object);
var key = string.Concat(a.TenantId.ToString(), a.Subject.ToString(), a.Action.ToString(), a.Object);
if (commonAces.TryGetValue(key, out var common))
{
commonAces.Remove(key);
@ -74,34 +74,34 @@ class DbAzService : IAzService
public async Task<AzRecord> SaveAceAsync(int tenant, AzRecord r)
{
r.Tenant = tenant;
r.TenantId = tenant;
if (!await ExistEscapeRecordAsync(r))
{
await InsertRecordAsync(r);
}
else
{
// unescape
}
else
{
// unescape
await DeleteRecordAsync(r);
}
}
return r;
}
public async Task RemoveAceAsync(int tenant, AzRecord r)
{
r.Tenant = tenant;
r.TenantId = tenant;
if (await ExistEscapeRecordAsync(r))
{
// escape
// escape
await InsertRecordAsync(r);
}
else
{
}
else
{
await DeleteRecordAsync(r);
}
}
}
@ -110,7 +110,7 @@ class DbAzService : IAzService
{
using var userDbContext = _dbContextFactory.CreateDbContext();
return await userDbContext.Acl
.Where(a => a.Tenant == Tenant.DefaultTenant)
.Where(a => a.TenantId == Tenant.DefaultTenant)
.Where(a => a.Subject == r.Subject)
.Where(a => a.Action == r.Action)
.Where(a => a.Object == (r.Object ?? string.Empty))
@ -122,7 +122,7 @@ class DbAzService : IAzService
{
using var userDbContext = _dbContextFactory.CreateDbContext();
var record = await userDbContext.Acl
.Where(a => a.Tenant == r.Tenant)
.Where(a => a.TenantId == r.TenantId)
.Where(a => a.Subject == r.Subject)
.Where(a => a.Action == r.Action)
.Where(a => a.Object == (r.Object ?? string.Empty))
@ -142,4 +142,4 @@ class DbAzService : IAzService
await userDbContext.AddOrUpdateAsync(q=> q.Acl, _mapper.Map<AzRecord, Acl>(r));
await userDbContext.SaveChangesAsync();
}
}
}

View File

@ -48,7 +48,7 @@ class DbQuotaService : IQuotaService
{
using var coreDbContext = _dbContextFactory.CreateDbContext();
return _mapper.Map<DbQuota, TenantQuota>(await coreDbContext.Quotas.SingleOrDefaultAsync(r => r.Tenant == id));
return _mapper.Map<DbQuota, TenantQuota>(await coreDbContext.Quotas.SingleOrDefaultAsync(r => r.TenantId == id));
}
public async Task<TenantQuota> SaveTenantQuotaAsync(TenantQuota quota)
@ -66,14 +66,14 @@ class DbQuotaService : IQuotaService
{
using var coreDbContext = _dbContextFactory.CreateDbContext();
var d = await coreDbContext.Quotas
.Where(r => r.Tenant == id)
.Where(r => r.TenantId == id)
.SingleOrDefaultAsync();
if (d != null)
{
coreDbContext.Quotas.Remove(d);
await coreDbContext.SaveChangesAsync();
}
}
}
@ -85,7 +85,7 @@ class DbQuotaService : IQuotaService
var dbTenantQuotaRow = _mapper.Map<TenantQuotaRow, DbQuotaRow>(row);
dbTenantQuotaRow.UserId = row.UserId;
var exist = await coreDbContext.QuotaRows.FindAsync(new object[] { dbTenantQuotaRow.Tenant, dbTenantQuotaRow.UserId, dbTenantQuotaRow.Path });
var exist = await coreDbContext.QuotaRows.FindAsync(new object[] { dbTenantQuotaRow.TenantId, dbTenantQuotaRow.UserId, dbTenantQuotaRow.Path });
if (exist == null)
{
@ -97,7 +97,7 @@ class DbQuotaService : IQuotaService
if (exchange)
{
await coreDbContext.QuotaRows
.Where(r => r.Path == row.Path && r.Tenant == row.Tenant && r.UserId == row.UserId)
.Where(r => r.Path == row.Path && r.TenantId == row.TenantId && r.UserId == row.UserId)
.ExecuteUpdateAsync(x => x.SetProperty(p => p.Counter, p => (p.Counter + row.Counter)));
}
else
@ -120,12 +120,12 @@ class DbQuotaService : IQuotaService
if (tenantId != Tenant.DefaultTenant)
{
q = q.Where(r => r.Tenant == tenantId);
q = q.Where(r => r.TenantId == tenantId);
}
return await q.ProjectTo<TenantQuotaRow>(_mapper.ConfigurationProvider).ToListAsync();
}
}
}
public static class DbQuotaServiceExtensions
{

View File

@ -31,7 +31,7 @@ public class DbSubscriptionService : ISubscriptionService
{
private readonly IDbContextFactory<UserDbContext> _dbContextFactory;
private readonly IMapper _mapper;
public DbSubscriptionService(IDbContextFactory<UserDbContext> dbContextFactory, IMapper mapper)
{
_dbContextFactory = dbContextFactory;
@ -52,25 +52,25 @@ public class DbSubscriptionService : ISubscriptionService
return await q.ToArrayAsync();
}
public async Task<IEnumerable<SubscriptionRecord>> GetSubscriptionsAsync(int tenant, string sourceId, string actionId)
{
ArgumentNullException.ThrowIfNull(sourceId);
ArgumentNullException.ThrowIfNull(actionId);
using var userDbContext = _dbContextFactory.CreateDbContext();
var q = GetQuery(userDbContext, tenant, sourceId, actionId);
return await GetSubscriptionsAsync(q, tenant);
}
public async Task<IEnumerable<SubscriptionRecord>> GetSubscriptionsAsync(int tenant, string sourceId, string actionId, string recipientId, string objectId)
{
using var userDbContext = _dbContextFactory.CreateDbContext();
var q = GetQuery(userDbContext, tenant, sourceId, actionId);
if (recipientId != null)
{
q = q.Where(r => r.Recipient == recipientId);
@ -79,20 +79,20 @@ public class DbSubscriptionService : ISubscriptionService
{
q = q.Where(r => r.Object == (objectId ?? string.Empty));
}
return await GetSubscriptionsAsync(q, tenant);
}
public async Task<SubscriptionRecord> GetSubscriptionAsync(int tenant, string sourceId, string actionId, string recipientId, string objectId)
{
ArgumentNullException.ThrowIfNull(recipientId);
using var userDbContext = _dbContextFactory.CreateDbContext();
var q = GetQuery(userDbContext, tenant, sourceId, actionId)
.Where(r => r.Recipient == recipientId)
.Where(r => r.Object == (objectId ?? string.Empty));
return (await GetSubscriptionsAsync(q, tenant)).Take(1).FirstOrDefault();
}
@ -106,7 +106,7 @@ public class DbSubscriptionService : ISubscriptionService
var q = userDbContext.Subscriptions
.Where(r => r.Source == sourceId &&
r.Action == actionId &&
r.Tenant == tenant &&
r.TenantId == tenant &&
r.Recipient == recipientId &&
r.Unsubscribed);
@ -142,7 +142,7 @@ public class DbSubscriptionService : ISubscriptionService
return await q.Select(r => r.Object).ToArrayAsync();
}
public async Task SaveSubscriptionAsync(SubscriptionRecord s)
{
ArgumentNullException.ThrowIfNull(s);
@ -154,45 +154,45 @@ public class DbSubscriptionService : ISubscriptionService
Recipient = s.RecipientId,
Source = s.SourceId,
Unsubscribed = !s.Subscribed,
Tenant = s.Tenant
TenantId = s.Tenant
};
using var userDbContext = _dbContextFactory.CreateDbContext();
await userDbContext.AddOrUpdateAsync(q=> q.Subscriptions, subs);
await userDbContext.SaveChangesAsync();
}
public async Task RemoveSubscriptionsAsync(int tenant, string sourceId, string actionId)
{
await RemoveSubscriptionsAsync(tenant, sourceId, actionId, string.Empty);
}
public async Task RemoveSubscriptionsAsync(int tenant, string sourceId, string actionId, string objectId)
{
ArgumentNullException.ThrowIfNull(sourceId);
ArgumentNullException.ThrowIfNull(actionId);
using var userDbContext = _dbContextFactory.CreateDbContext();
var q = userDbContext.Subscriptions
.Where(r => r.Tenant == tenant)
.Where(r => r.Source == sourceId)
.Where(r => r.Action == actionId);
var q = userDbContext.Subscriptions
.Where(r => r.TenantId == tenant)
.Where(r => r.Source == sourceId)
.Where(r => r.Action == actionId);
if (objectId.Length != 0)
{
q = q.Where(r => r.Object == (objectId ?? string.Empty));
}
if (objectId.Length != 0)
{
q = q.Where(r => r.Object == (objectId ?? string.Empty));
}
var sub = await q.FirstOrDefaultAsync();
var sub = await q.FirstOrDefaultAsync();
if (sub != null)
{
userDbContext.Subscriptions.Remove(sub);
if (sub != null)
{
userDbContext.Subscriptions.Remove(sub);
await userDbContext.SaveChangesAsync();
}
}
}
public async Task<IEnumerable<SubscriptionMethod>> GetSubscriptionMethodsAsync(int tenant, string sourceId, string actionId, string recipientId)
{
ArgumentNullException.ThrowIfNull(sourceId);
@ -200,7 +200,7 @@ public class DbSubscriptionService : ISubscriptionService
using var userDbContext = _dbContextFactory.CreateDbContext();
var q = userDbContext.SubscriptionMethods
.Where(r => r.Tenant == -1 || r.Tenant == tenant)
.Where(r => r.TenantId == -1 || r.TenantId == tenant)
.Where(r => r.Source == sourceId);
if (recipientId != null)
@ -209,14 +209,14 @@ public class DbSubscriptionService : ISubscriptionService
}
var a = q
.OrderBy(r => r.Tenant)
.OrderBy(r => r.TenantId)
.Distinct();
var methods = await a.ToListAsync();
var result = new List<SubscriptionMethod>();
var common = new Dictionary<string, SubscriptionMethod>();
foreach (var r in methods)
{
var m = _mapper.Map<DbSubscriptionMethod, SubscriptionMethod>(r);
@ -237,64 +237,64 @@ public class DbSubscriptionService : ISubscriptionService
}
return result;
}
public async Task SetSubscriptionMethodAsync(SubscriptionMethod m)
{
ArgumentNullException.ThrowIfNull(m);
using var userDbContext = _dbContextFactory.CreateDbContext();
if (m.Methods == null || m.Methods.Length == 0)
{
var q = userDbContext.SubscriptionMethods
.Where(r => r.Tenant == m.Tenant)
.Where(r => r.Source == m.Source)
.Where(r => r.Recipient == m.Recipient)
.Where(r => r.Action == m.Action);
var sm = await q.FirstOrDefaultAsync();
if (sm != null)
if (m.Methods == null || m.Methods.Length == 0)
{
userDbContext.SubscriptionMethods.Remove(sm);
var q = userDbContext.SubscriptionMethods
.Where(r => r.TenantId == m.Tenant)
.Where(r => r.Source == m.Source)
.Where(r => r.Recipient == m.Recipient)
.Where(r => r.Action == m.Action);
var sm = await q.FirstOrDefaultAsync();
if (sm != null)
{
userDbContext.SubscriptionMethods.Remove(sm);
}
}
}
else
{
var sm = new DbSubscriptionMethod
else
{
Action = m.Action,
Recipient = m.Recipient,
Source = m.Source,
Tenant = m.Tenant,
Sender = string.Join("|", m.Methods)
};
var sm = new DbSubscriptionMethod
{
Action = m.Action,
Recipient = m.Recipient,
Source = m.Source,
TenantId = m.Tenant,
Sender = string.Join("|", m.Methods)
};
await userDbContext.AddOrUpdateAsync(q => q.SubscriptionMethods, sm);
}
}
await userDbContext.SaveChangesAsync();
await userDbContext.SaveChangesAsync();
}
private IQueryable<Subscription> GetQuery(UserDbContext userDbContext, int tenant, string sourceId, string actionId)
{
ArgumentNullException.ThrowIfNull(sourceId);
ArgumentNullException.ThrowIfNull(actionId);
return
userDbContext.Subscriptions
.Where(r => r.Source == sourceId)
.Where(r => r.Action == actionId)
.Where(r => r.Tenant == -1 || r.Tenant == tenant)
.OrderBy(r => r.Tenant);
.Where(r => r.TenantId == -1 || r.TenantId == tenant)
.OrderBy(r => r.TenantId);
}
private async Task<IEnumerable<SubscriptionRecord>> GetSubscriptionsAsync(IQueryable<Subscription> q, int tenant)
{
var subs = await q.ToListAsync();
var result = new List<SubscriptionRecord>();
var common = new Dictionary<string, SubscriptionRecord>();
foreach (var r in subs)
{
var s = _mapper.Map<Subscription, SubscriptionRecord>(r);
@ -316,4 +316,4 @@ public class DbSubscriptionService : ISubscriptionService
return result;
}
}
}

View File

@ -93,7 +93,7 @@ public class DbTenantService : ITenantService
using var userDbContext = _userDbContextFactory.CreateDbContext();//TODO: remove
IQueryable<TenantUserSecurity> query() => tenantDbContext.Tenants
.Where(r => r.Status == TenantStatus.Active)
.Join(userDbContext.Users, r => r.Id, r => r.Tenant, (tenant, user) => new
.Join(userDbContext.Users, r => r.Id, r => r.TenantId, (tenant, user) => new
{
tenant,
user
@ -156,9 +156,9 @@ public class DbTenantService : ITenantService
public Tenant GetTenant(int id)
{
using var tenantDbContext = _dbContextFactory.CreateDbContext();
return tenantDbContext.Tenants
.Where(r => r.Id == id)
.ProjectTo<Tenant>(_mapper.ConfigurationProvider)
return tenantDbContext.Tenants
.Where(r => r.Id == id)
.ProjectTo<Tenant>(_mapper.ConfigurationProvider)
.SingleOrDefault();
}
@ -294,9 +294,9 @@ public class DbTenantService : ITenantService
using var tenantDbContext = _dbContextFactory.CreateDbContext();
var alias = await tenantDbContext.Tenants
.Where(r => r.Id == id)
.Select(r => r.Alias)
.FirstOrDefaultAsync();
.Where(r => r.Id == id)
.Select(r => r.Alias)
.FirstOrDefaultAsync();
var count = await tenantDbContext.Tenants
.Where(r => r.Alias.StartsWith(alias + postfix))
@ -315,6 +315,14 @@ public class DbTenantService : ITenantService
}
}
public async Task PermanentlyRemoveTenantAsync(int id)
{
using var tenantDbContext = _dbContextFactory.CreateDbContext();
var tenant = await tenantDbContext.Tenants.SingleOrDefaultAsync(r => r.Id == id);
tenantDbContext.Tenants.Remove(tenant);
await tenantDbContext.SaveChangesAsync();
}
public async Task<IEnumerable<TenantVersion>> GetTenantVersionsAsync()
{
using var tenantDbContext = _dbContextFactory.CreateDbContext();
@ -329,7 +337,7 @@ public class DbTenantService : ITenantService
{
using var tenantDbContext = _dbContextFactory.CreateDbContext();
return await tenantDbContext.CoreSettings
.Where(r => r.Tenant == tenant)
.Where(r => r.TenantId == tenant)
.Where(r => r.Id == key)
.Select(r => r.Value)
.FirstOrDefaultAsync();
@ -339,7 +347,7 @@ public class DbTenantService : ITenantService
{
using var tenantDbContext = _dbContextFactory.CreateDbContext();
return tenantDbContext.CoreSettings
.Where(r => r.Tenant == tenant)
.Where(r => r.TenantId == tenant)
.Where(r => r.Id == key)
.Select(r => r.Value)
.FirstOrDefault();
@ -352,7 +360,7 @@ public class DbTenantService : ITenantService
if (data == null || data.Length == 0)
{
var settings = await tenantDbContext.CoreSettings
.Where(r => r.Tenant == tenant)
.Where(r => r.TenantId == tenant)
.Where(r => r.Id == key)
.FirstOrDefaultAsync();
@ -366,7 +374,7 @@ public class DbTenantService : ITenantService
var settings = new DbCoreSettings
{
Id = key,
Tenant = tenant,
TenantId = tenant,
Value = data,
LastModified = DateTime.UtcNow
};
@ -383,7 +391,7 @@ public class DbTenantService : ITenantService
if (data == null || data.Length == 0)
{
var settings = tenantDbContext.CoreSettings
.Where(r => r.Tenant == tenant)
.Where(r => r.TenantId == tenant)
.Where(r => r.Id == key)
.FirstOrDefault();
@ -397,7 +405,7 @@ public class DbTenantService : ITenantService
var settings = new DbCoreSettings
{
Id = key,
Tenant = tenant,
TenantId = tenant,
Value = data,
LastModified = DateTime.UtcNow
};
@ -475,4 +483,4 @@ public class TenantUserSecurity
public DbTenant DbTenant { get; set; }
public User User { get; set; }
public UserSecurity UserSecurity { get; set; }
}
}

View File

@ -116,7 +116,7 @@ public class EFUserService : IUserService
if (tenant != Tenant.DefaultTenant)
{
q = q.Where(r => r.UserSecurity.Tenant == tenant);
q = q.Where(r => r.UserSecurity.TenantId == tenant);
}
return await q.Select(r => r.User)
@ -174,7 +174,7 @@ public class EFUserService : IUserService
if (tenant != Tenant.DefaultTenant)
{
q = q.Where(r => r.Tenant == tenant);
q = q.Where(r => r.TenantId == tenant);
}
return q.Where(r => r.UserGroupId == groupId && r.RefType == refType && !r.Removed)
.ProjectTo<UserGroupRef>(_mapper.ConfigurationProvider);
@ -187,7 +187,7 @@ public class EFUserService : IUserService
if (tenant != Tenant.DefaultTenant)
{
q = q.Where(r => r.Tenant == tenant);
q = q.Where(r => r.TenantId == tenant);
}
return await q.ProjectTo<UserGroupRef>(_mapper.ConfigurationProvider).ToDictionaryAsync(r => r.CreateKey(), r => r);
@ -200,7 +200,7 @@ public class EFUserService : IUserService
if (tenant != Tenant.DefaultTenant)
{
q = q.Where(r => r.Tenant == tenant);
q = q.Where(r => r.TenantId == tenant);
}
return q.ProjectTo<UserGroupRef>(_mapper.ConfigurationProvider)
@ -211,7 +211,7 @@ public class EFUserService : IUserService
{
using var userDbContext = _dbContextFactory.CreateDbContext();
var stamp = await userDbContext.UserSecurity
.Where(r => r.Tenant == tenant)
.Where(r => r.TenantId == tenant)
.Where(r => r.UserId == id)
.Select(r => r.LastModified)
.FirstOrDefaultAsync();
@ -223,7 +223,7 @@ public class EFUserService : IUserService
{
using var userDbContext = _dbContextFactory.CreateDbContext();
var photo = await userDbContext.Photos
.Where(r => r.Tenant == tenant)
.Where(r => r.TenantId == tenant)
.Where(r => r.UserId == id)
.Select(r => r.Photo)
.FirstOrDefaultAsync();
@ -305,7 +305,7 @@ public class EFUserService : IUserService
public IQueryable<UserInfo> GetUsers(int tenant, out int total)
{
var userDbContext = _dbContextFactory.CreateDbContext();
total = userDbContext.Users.Count(r => r.Tenant == tenant);
total = userDbContext.Users.Count(r => r.TenantId == tenant);
return GetUserQuery(userDbContext, tenant)
.ProjectTo<UserInfo>(_mapper.ConfigurationProvider);
@ -315,7 +315,7 @@ public class EFUserService : IUserService
{
var userDbContext = _dbContextFactory.CreateDbContext();
var tenants = await userDbContext.Users.Where(u => u.LastModified > from).Select(u => u.Tenant).Distinct().ToListAsync();
var tenants = await userDbContext.Users.Where(u => u.LastModified > from).Select(u => u.TenantId).Distinct().ToListAsync();
return tenants;
}
@ -331,12 +331,12 @@ public class EFUserService : IUserService
var ids = CollectGroupChilds(userDbContext, tenant, id);
var stringIds = ids.Select(r => r.ToString()).ToList();
userDbContext.Acl.RemoveRange(userDbContext.Acl.Where(r => r.Tenant == tenant && ids.Any(i => i == r.Subject)));
userDbContext.Subscriptions.RemoveRange(userDbContext.Subscriptions.Where(r => r.Tenant == tenant && stringIds.Any(i => i == r.Recipient)));
userDbContext.SubscriptionMethods.RemoveRange(userDbContext.SubscriptionMethods.Where(r => r.Tenant == tenant && stringIds.Any(i => i == r.Recipient)));
userDbContext.Acl.RemoveRange(userDbContext.Acl.Where(r => r.TenantId == tenant && ids.Any(i => i == r.Subject)));
userDbContext.Subscriptions.RemoveRange(userDbContext.Subscriptions.Where(r => r.TenantId == tenant && stringIds.Any(i => i == r.Recipient)));
userDbContext.SubscriptionMethods.RemoveRange(userDbContext.SubscriptionMethods.Where(r => r.TenantId == tenant && stringIds.Any(i => i == r.Recipient)));
var userGroups = userDbContext.UserGroups.Where(r => r.Tenant == tenant && ids.Any(i => i == r.UserGroupId));
var groups = userDbContext.Groups.Where(r => r.Tenant == tenant && ids.Any(i => i == r.Id));
var userGroups = userDbContext.UserGroups.Where(r => r.TenantId == tenant && ids.Any(i => i == r.UserGroupId));
var groups = userDbContext.Groups.Where(r => r.TenantId == tenant && ids.Any(i => i == r.Id));
if (immediate)
{
@ -370,14 +370,14 @@ public class EFUserService : IUserService
{
using var userDbContext = _dbContextFactory.CreateDbContext();
userDbContext.Acl.RemoveRange(userDbContext.Acl.Where(r => r.Tenant == tenant && r.Subject == id));
userDbContext.Subscriptions.RemoveRange(userDbContext.Subscriptions.Where(r => r.Tenant == tenant && r.Recipient == id.ToString()));
userDbContext.SubscriptionMethods.RemoveRange(userDbContext.SubscriptionMethods.Where(r => r.Tenant == tenant && r.Recipient == id.ToString()));
userDbContext.Photos.RemoveRange(userDbContext.Photos.Where(r => r.Tenant == tenant && r.UserId == id));
userDbContext.Acl.RemoveRange(userDbContext.Acl.Where(r => r.TenantId == tenant && r.Subject == id));
userDbContext.Subscriptions.RemoveRange(userDbContext.Subscriptions.Where(r => r.TenantId == tenant && r.Recipient == id.ToString()));
userDbContext.SubscriptionMethods.RemoveRange(userDbContext.SubscriptionMethods.Where(r => r.TenantId == tenant && r.Recipient == id.ToString()));
userDbContext.Photos.RemoveRange(userDbContext.Photos.Where(r => r.TenantId == tenant && r.UserId == id));
var userGroups = userDbContext.UserGroups.Where(r => r.Tenant == tenant && r.Userid == id);
var users = userDbContext.Users.Where(r => r.Tenant == tenant && r.Id == id);
var userSecurity = userDbContext.UserSecurity.Where(r => r.Tenant == tenant && r.UserId == id);
var userGroups = userDbContext.UserGroups.Where(r => r.TenantId == tenant && r.Userid == id);
var users = userDbContext.Users.Where(r => r.TenantId == tenant && r.Id == id);
var userSecurity = userDbContext.UserSecurity.Where(r => r.TenantId == tenant && r.UserId == id);
if (immediate)
{
@ -413,7 +413,7 @@ public class EFUserService : IUserService
{
using var userDbContext = _dbContextFactory.CreateDbContext();
var userGroups = userDbContext.UserGroups.Where(r => r.Tenant == tenant && r.Userid == userId && r.UserGroupId == groupId && r.RefType == refType);
var userGroups = userDbContext.UserGroups.Where(r => r.TenantId == tenant && r.Userid == userId && r.UserGroupId == groupId && r.RefType == refType);
if (immediate)
{
userDbContext.UserGroups.RemoveRange(userGroups);
@ -428,7 +428,7 @@ public class EFUserService : IUserService
});
}
var user = userDbContext.Users.First(r => r.Tenant == tenant && r.Id == userId);
var user = userDbContext.Users.First(r => r.TenantId == tenant && r.Id == userId);
user.LastModified = DateTime.UtcNow;
await userDbContext.SaveChangesAsync();
}
@ -443,7 +443,7 @@ public class EFUserService : IUserService
}
group.LastModified = DateTime.UtcNow;
group.Tenant = tenant;
group.TenantId = tenant;
var dbGroup = _mapper.Map<Group, DbGroup>(group);
@ -474,7 +474,7 @@ public class EFUserService : IUserService
}
user.LastModified = DateTime.UtcNow;
user.Tenant = tenant;
user.TenantId = tenant;
user.UserName = user.UserName.Trim();
user.Email = user.Email.Trim();
@ -507,11 +507,11 @@ public class EFUserService : IUserService
ArgumentNullException.ThrowIfNull(userGroupRef);
userGroupRef.LastModified = DateTime.UtcNow;
userGroupRef.Tenant = tenant;
userGroupRef.TenantId = tenant;
using var userDbContext = _dbContextFactory.CreateDbContext();
var user = await GetUserQuery(userDbContext, tenant).FirstOrDefaultAsync(a => a.Tenant == tenant && a.Id == userGroupRef.UserId);
var user = await GetUserQuery(userDbContext, tenant).FirstOrDefaultAsync(a => a.TenantId == tenant && a.Id == userGroupRef.UserId);
if (user != null)
{
user.LastModified = userGroupRef.LastModified;
@ -528,7 +528,7 @@ public class EFUserService : IUserService
var us = new UserSecurity
{
Tenant = tenant,
TenantId = tenant,
UserId = id,
PwdHash = h1,
LastModified = DateTime.UtcNow
@ -543,14 +543,14 @@ public class EFUserService : IUserService
{
using var userDbContext = _dbContextFactory.CreateDbContext();
var userPhoto = await userDbContext.Photos.FirstOrDefaultAsync(r => r.UserId == id && r.Tenant == tenant);
var userPhoto = await userDbContext.Photos.FirstOrDefaultAsync(r => r.UserId == id && r.TenantId == tenant);
if (photo != null && photo.Length != 0)
{
if (userPhoto == null)
{
userPhoto = new UserPhoto
{
Tenant = tenant,
TenantId = tenant,
UserId = id,
Photo = photo
};
@ -577,7 +577,7 @@ public class EFUserService : IUserService
if (tenant != Tenant.DefaultTenant)
{
q = q.Where(r => r.Tenant == tenant);
q = q.Where(r => r.TenantId == tenant);
where = true;
}
@ -595,7 +595,7 @@ public class EFUserService : IUserService
if (tenant != Tenant.DefaultTenant)
{
q = q.Where(r => r.Tenant == tenant);
q = q.Where(r => r.TenantId == tenant);
}
return q;
@ -618,7 +618,7 @@ public class EFUserService : IUserService
{
foreach (var ig in includeGroups)
{
q = q.Where(r => userDbContext.UserGroups.Any(a => !a.Removed && a.Tenant == r.Tenant && a.Userid == r.Id && ig.Any(r => r == a.UserGroupId)));
q = q.Where(r => userDbContext.UserGroups.Any(a => !a.Removed && a.TenantId == r.TenantId && a.Userid == r.Id && ig.Any(r => r == a.UserGroupId)));
}
}
@ -626,7 +626,7 @@ public class EFUserService : IUserService
{
foreach (var eg in excludeGroups)
{
q = q.Where(r => !userDbContext.UserGroups.Any(a => !a.Removed && a.Tenant == r.Tenant && a.Userid == r.Id && a.UserGroupId == eg));
q = q.Where(r => !userDbContext.UserGroups.Any(a => !a.Removed && a.TenantId == r.TenantId && a.Userid == r.Id && a.UserGroupId == eg));
}
}
@ -700,7 +700,7 @@ public class EFUserService : IUserService
var result = new List<Guid>();
var childs = userDbContext.Groups
.Where(r => r.Tenant == tenant)
.Where(r => r.TenantId == tenant)
.Where(r => r.ParentId == id)
.Select(r => r.Id);
@ -734,9 +734,9 @@ public class EFUserService : IUserService
{
using var userDbContext = _dbContextFactory.CreateDbContext();
return await (from usersDav in userDbContext.UsersDav
join users in userDbContext.Users on new { tenant = usersDav.TenantId, userId = usersDav.UserId } equals new { tenant = users.Tenant, userId = users.Id }
where usersDav.TenantId == tenant
select users.Email)
join users in userDbContext.Users on new { tenant = usersDav.TenantId, userId = usersDav.UserId } equals new { tenant = users.TenantId, userId = users.Id }
where usersDav.TenantId == tenant
select users.Email)
.Distinct()
.ToListAsync();
}

View File

@ -42,6 +42,7 @@ public class CoreDbContext : DbContext
.AddDbQuotaRow()
.AddDbQuota()
.AddDbTariff()
.AddDbTariffRow();
.AddDbTariffRow()
.AddDbTenant();
}
}

View File

@ -27,7 +27,6 @@
namespace ASC.Core.Common.EF.Context;
public class FirebaseDbContext : DbContext
{
public DbSet<FireBaseUser> Users { get; set; }
public FirebaseDbContext(DbContextOptions<FirebaseDbContext> options) : base(options)
@ -39,6 +38,7 @@ public class FirebaseDbContext : DbContext
{
ModelBuilderWrapper
.From(modelBuilder, Database)
.AddFireBaseUsers();
.AddFireBaseUsers()
.AddDbTenant();
}
}

View File

@ -41,6 +41,7 @@ public class NotifyDbContext : DbContext
ModelBuilderWrapper
.From(modelBuilder, Database)
.AddNotifyInfo()
.AddNotifyQueue();
.AddNotifyQueue()
.AddDbTenant();
}
}

View File

@ -39,6 +39,7 @@ public class TelegramDbContext : DbContext
{
ModelBuilderWrapper
.From(modelBuilder, Database)
.AddTelegramUsers();
.AddTelegramUsers()
.AddDbTenant();
}
}

View File

@ -55,6 +55,7 @@ public class UserDbContext : DbContext
.AddDbGroup()
.AddUserGroup()
.AddSubscription()
.AddUserDav();
.AddUserDav()
.AddDbTenant();
}
}

View File

@ -33,7 +33,9 @@ public class FireBaseUser : BaseEntity
public int TenantId { get; set; }
public string FirebaseDeviceToken { get; set; }
public string Application { get; set; }
public bool? IsSubscribed { get; set; }
public bool? IsSubscribed { get; set; }
public DbTenant Tenant { get; set; }
public override object[] GetKeys()
{
@ -44,7 +46,9 @@ public class FireBaseUser : BaseEntity
public static class FireBaseUserExtension
{
public static ModelBuilderWrapper AddFireBaseUsers(this ModelBuilderWrapper modelBuilder)
{
{
modelBuilder.Entity<FireBaseUser>().Navigation(e => e.Tenant).AutoInclude(false);
modelBuilder
.Add(MySqlAddFireBaseUsers, Provider.MySql)
.Add(PgSqlAddFireBaseUsers, Provider.PostgreSql);

View File

@ -28,15 +28,17 @@ namespace ASC.Core.Common.EF;
public class Acl : BaseEntity, IMapFrom<AzRecord>
{
public int Tenant { get; set; }
public int TenantId { get; set; }
public Guid Subject { get; set; }
public Guid Action { get; set; }
public string Object { get; set; }
public AceType AceType { get; set; }
public DbTenant Tenant { get; set; }
public override object[] GetKeys()
{
return new object[] { Tenant, Subject, Action, Object };
return new object[] { TenantId, Subject, Action, Object };
}
}
@ -44,77 +46,79 @@ public static class AclExtension
{
public static ModelBuilderWrapper AddAcl(this ModelBuilderWrapper modelBuilder)
{
modelBuilder.Entity<Acl>().Navigation(e => e.Tenant).AutoInclude(false);
modelBuilder
.Add(MySqlAddAcl, Provider.MySql)
.Add(PgSqlAddAcl, Provider.PostgreSql)
.HasData(
new Acl { Tenant = -1, Subject = Guid.Parse("5d5b7260-f7f7-49f1-a1c9-95fbb6a12604"), Action = Guid.Parse("ef5e6790-f346-4b6e-b662-722bc28cb0db"), Object = "", AceType = 0 },
new Acl { Tenant = -1, Subject = Guid.Parse("5d5b7260-f7f7-49f1-a1c9-95fbb6a12604"), Action = Guid.Parse("f11e8f3f-46e6-4e55-90e3-09c22ec565bd"), Object = "", AceType = 0 },
new Acl { Tenant = -1, Subject = Guid.Parse("c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e"), Action = Guid.Parse("088d5940-a80f-4403-9741-d610718ce95c"), Object = "", AceType = 0 },
new Acl { Tenant = -1, Subject = Guid.Parse("c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e"), Action = Guid.Parse("08d66144-e1c9-4065-9aa1-aa4bba0a7bc8"), Object = "", AceType = 0 },
new Acl { Tenant = -1, Subject = Guid.Parse("abef62db-11a8-4673-9d32-ef1d8af19dc0"), Action = Guid.Parse("08d75c97-cf3f-494b-90d1-751c941fe2dd"), Object = "", AceType = 0 },
new Acl { Tenant = -1, Subject = Guid.Parse("abef62db-11a8-4673-9d32-ef1d8af19dc0"), Action = Guid.Parse("0d1f72a8-63da-47ea-ae42-0900e4ac72a9"), Object = "", AceType = 0 },
new Acl { Tenant = -1, Subject = Guid.Parse("abef62db-11a8-4673-9d32-ef1d8af19dc0"), Action = Guid.Parse("13e30b51-5b4d-40a5-8575-cb561899eeb1"), Object = "", AceType = 0 },
new Acl { Tenant = -1, Subject = Guid.Parse("abef62db-11a8-4673-9d32-ef1d8af19dc0"), Action = Guid.Parse("19f658ae-722b-4cd8-8236-3ad150801d96"), Object = "", AceType = 0 },
new Acl { Tenant = -1, Subject = Guid.Parse("abef62db-11a8-4673-9d32-ef1d8af19dc0"), Action = Guid.Parse("2c6552b3-b2e0-4a00-b8fd-13c161e337b1"), Object = "", AceType = 0 },
new Acl { Tenant = -1, Subject = Guid.Parse("c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e"), Action = Guid.Parse("388c29d3-c662-4a61-bf47-fc2f7094224a"), Object = "", AceType = 0 },
new Acl { Tenant = -1, Subject = Guid.Parse("abef62db-11a8-4673-9d32-ef1d8af19dc0"), Action = Guid.Parse("40bf31f4-3132-4e76-8d5c-9828a89501a3"), Object = "", AceType = 0 },
new Acl { Tenant = -1, Subject = Guid.Parse("abef62db-11a8-4673-9d32-ef1d8af19dc0"), Action = Guid.Parse("49ae8915-2b30-4348-ab74-b152279364fb"), Object = "", AceType = 0 },
new Acl { Tenant = -1, Subject = Guid.Parse("c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e"), Action = Guid.Parse("63e9f35f-6bb5-4fb1-afaa-e4c2f4dec9bd"), Object = "", AceType = 0 },
new Acl { Tenant = -1, Subject = Guid.Parse("c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e"), Action = Guid.Parse("9018c001-24c2-44bf-a1db-d1121a570e74"), Object = "", AceType = 0 },
new Acl { Tenant = -1, Subject = Guid.Parse("abef62db-11a8-4673-9d32-ef1d8af19dc0"), Action = Guid.Parse("948ad738-434b-4a88-8e38-7569d332910a"), Object = "", AceType = 0 },
new Acl { Tenant = -1, Subject = Guid.Parse("abef62db-11a8-4673-9d32-ef1d8af19dc0"), Action = Guid.Parse("9d75a568-52aa-49d8-ad43-473756cd8903"), Object = "", AceType = 0 },
new Acl { Tenant = -1, Subject = Guid.Parse("c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e"), Action = Guid.Parse("a362fe79-684e-4d43-a599-65bc1f4e167f"), Object = "", AceType = 0 },
new Acl { Tenant = -1, Subject = Guid.Parse("c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e"), Action = Guid.Parse("c426c349-9ad4-47cd-9b8f-99fc30675951"), Object = "", AceType = 0 },
new Acl { Tenant = -1, Subject = Guid.Parse("c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e"), Action = Guid.Parse("d11ebcb9-0e6e-45e6-a6d0-99c41d687598"), Object = "", AceType = 0 },
new Acl { Tenant = -1, Subject = Guid.Parse("c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e"), Action = Guid.Parse("d1f3b53d-d9e2-4259-80e7-d24380978395"), Object = "", AceType = 0 },
new Acl { Tenant = -1, Subject = Guid.Parse("abef62db-11a8-4673-9d32-ef1d8af19dc0"), Action = Guid.Parse("d49f4e30-da10-4b39-bc6d-b41ef6e039d3"), Object = "", AceType = 0 },
new Acl { Tenant = -1, Subject = Guid.Parse("abef62db-11a8-4673-9d32-ef1d8af19dc0"), Action = Guid.Parse("d852b66f-6719-45e1-8657-18f0bb791690"), Object = "", AceType = 0 },
new Acl { Tenant = -1, Subject = Guid.Parse("c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e"), Action = Guid.Parse("e0759a42-47f0-4763-a26a-d5aa665bec35"), Object = "", AceType = 0 },
new Acl { Tenant = -1, Subject = Guid.Parse("c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e"), Action = Guid.Parse("e37239bd-c5b5-4f1e-a9f8-3ceeac209615"), Object = "", AceType = 0 },
new Acl { Tenant = -1, Subject = Guid.Parse("c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e"), Action = Guid.Parse("fbc37705-a04c-40ad-a68c-ce2f0423f397"), Object = "", AceType = 0 },
new Acl { Tenant = -1, Subject = Guid.Parse("c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e"), Action = Guid.Parse("fcac42b8-9386-48eb-a938-d19b3c576912"), Object = "", AceType = 0 },
new Acl { Tenant = -1, Subject = Guid.Parse("ba74ca02-873f-43dc-8470-8620c156bc67"), Action = Guid.Parse("13e30b51-5b4d-40a5-8575-cb561899eeb1"), Object = "", AceType = 0 },
new Acl { Tenant = -1, Subject = Guid.Parse("ba74ca02-873f-43dc-8470-8620c156bc67"), Action = Guid.Parse("49ae8915-2b30-4348-ab74-b152279364fb"), Object = "", AceType = 0 },
new Acl { Tenant = -1, Subject = Guid.Parse("ba74ca02-873f-43dc-8470-8620c156bc67"), Action = Guid.Parse("63e9f35f-6bb5-4fb1-afaa-e4c2f4dec9bd"), Object = "", AceType = 0 },
new Acl { Tenant = -1, Subject = Guid.Parse("ba74ca02-873f-43dc-8470-8620c156bc67"), Action = Guid.Parse("9018c001-24c2-44bf-a1db-d1121a570e74"), Object = "", AceType = 0 },
new Acl { Tenant = -1, Subject = Guid.Parse("ba74ca02-873f-43dc-8470-8620c156bc67"), Action = Guid.Parse("d1f3b53d-d9e2-4259-80e7-d24380978395"), Object = "", AceType = 0 },
new Acl { Tenant = -1, Subject = Guid.Parse("ba74ca02-873f-43dc-8470-8620c156bc67"), Action = Guid.Parse("e0759a42-47f0-4763-a26a-d5aa665bec35"), Object = "", AceType = 0 },
new Acl { Tenant = -1, Subject = Guid.Parse("ba74ca02-873f-43dc-8470-8620c156bc67"), Action = Guid.Parse("e37239bd-c5b5-4f1e-a9f8-3ceeac209615"), Object = "", AceType = 0 },
new Acl { Tenant = -1, Subject = Guid.Parse("ba74ca02-873f-43dc-8470-8620c156bc67"), Action = Guid.Parse("f11e88d7-f185-4372-927c-d88008d2c483"), Object = "", AceType = 0 },
new Acl { Tenant = -1, Subject = Guid.Parse("ba74ca02-873f-43dc-8470-8620c156bc67"), Action = Guid.Parse("f11e8f3f-46e6-4e55-90e3-09c22ec565bd"), Object = "", AceType = 0 },
new Acl { Tenant = -1, Subject = Guid.Parse("bba32183-a14d-48ed-9d39-c6b4d8925fbf"), Action = Guid.Parse("00e7dfc5-ac49-4fd3-a1d6-98d84e877ac4"), Object = "", AceType = 0 },
new Acl { Tenant = -1, Subject = Guid.Parse("bba32183-a14d-48ed-9d39-c6b4d8925fbf"), Action = Guid.Parse("14be970f-7af5-4590-8e81-ea32b5f7866d"), Object = "", AceType = 0 },
new Acl { Tenant = -1, Subject = Guid.Parse("bba32183-a14d-48ed-9d39-c6b4d8925fbf"), Action = Guid.Parse("18ecc94d-6afa-4994-8406-aee9dff12ce2"), Object = "", AceType = 0 },
new Acl { Tenant = -1, Subject = Guid.Parse("bba32183-a14d-48ed-9d39-c6b4d8925fbf"), Action = Guid.Parse("298530eb-435e-4dc6-a776-9abcd95c70e9"), Object = "", AceType = 0 },
new Acl { Tenant = -1, Subject = Guid.Parse("bba32183-a14d-48ed-9d39-c6b4d8925fbf"), Action = Guid.Parse("430eaf70-1886-483c-a746-1a18e3e6bb63"), Object = "", AceType = 0 },
new Acl { Tenant = -1, Subject = Guid.Parse("bba32183-a14d-48ed-9d39-c6b4d8925fbf"), Action = Guid.Parse("557d6503-633b-4490-a14c-6473147ce2b3"), Object = "", AceType = 0 }/*qwerty*/,
new Acl { Tenant = -1, Subject = Guid.Parse("bba32183-a14d-48ed-9d39-c6b4d8925fbf"), Action = Guid.Parse("724cbb75-d1c9-451e-bae0-4de0db96b1f7"), Object = "", AceType = 0 },
new Acl { Tenant = -1, Subject = Guid.Parse("bba32183-a14d-48ed-9d39-c6b4d8925fbf"), Action = Guid.Parse("7cb5c0d1-d254-433f-abe3-ff23373ec631"), Object = "", AceType = 0 },
new Acl { Tenant = -1, Subject = Guid.Parse("bba32183-a14d-48ed-9d39-c6b4d8925fbf"), Action = Guid.Parse("91b29dcd-9430-4403-b17a-27d09189be88"), Object = "", AceType = 0 },
new Acl { Tenant = -1, Subject = Guid.Parse("bba32183-a14d-48ed-9d39-c6b4d8925fbf"), Action = Guid.Parse("a18480a4-6d18-4c71-84fa-789888791f45"), Object = "", AceType = 0 },
new Acl { Tenant = -1, Subject = Guid.Parse("bba32183-a14d-48ed-9d39-c6b4d8925fbf"), Action = Guid.Parse("b630d29b-1844-4bda-bbbe-cf5542df3559"), Object = "", AceType = 0 },
new Acl { Tenant = -1, Subject = Guid.Parse("bba32183-a14d-48ed-9d39-c6b4d8925fbf"), Action = Guid.Parse("c62a9e8d-b24c-4513-90aa-7ff0f8ba38eb"), Object = "", AceType = 0 },
new Acl { Tenant = -1, Subject = Guid.Parse("bba32183-a14d-48ed-9d39-c6b4d8925fbf"), Action = Guid.Parse("d7cdb020-288b-41e5-a857-597347618533"), Object = "", AceType = 0 },
new Acl { Tenant = -1, Subject = Guid.Parse("bba32183-a14d-48ed-9d39-c6b4d8925fbf"), Action = Guid.Parse("662f3db7-9bc8-42cf-84da-2765f563e9b0"), Object = "", AceType = 0 },
new Acl { Tenant = -1, Subject = Guid.Parse("712d9ec3-5d2b-4b13-824f-71f00191dcca"), Action = Guid.Parse("e0759a42-47f0-4763-a26a-d5aa665bec35"), Object = "", AceType = 0 },
new Acl { Tenant = -1, Subject = Guid.Parse("bba32183-a14d-48ed-9d39-c6b4d8925fbf"), Action = Guid.Parse("0d68b142-e20a-446e-a832-0d6b0b65a164"), Object = "", AceType = 0 },
new Acl { Tenant = -1, Subject = Guid.Parse("c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e"), Action = Guid.Parse("6f05c382-8bca-4469-9424-c807a98c40d7"), Object = "", AceType = 0 },
new Acl { Tenant = -1, Subject = Guid.Parse("c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e"), Action = Guid.Parse("77777777-32ae-425f-99b5-83176061d1ae"), Object = "ASC.Web.Core.WebItemSecurity+WebItemSecurityObject|1e04460243b54d7982f3fd6208a11960", AceType = 0 },
new Acl { Tenant = -1, Subject = Guid.Parse("c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e"), Action = Guid.Parse("77777777-32ae-425f-99b5-83176061d1ae"), Object = "ASC.Web.Core.WebItemSecurity+WebItemSecurityObject|6743007c6f954d208c88a8601ce5e76d", AceType = 0 },
new Acl { Tenant = -1, Subject = Guid.Parse("c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e"), Action = Guid.Parse("77777777-32ae-425f-99b5-83176061d1ae"), Object = "ASC.Web.Core.WebItemSecurity+WebItemSecurityObject|e67be73df9ae4ce18fec1880cb518cb4", AceType = 0 },
new Acl { Tenant = -1, Subject = Guid.Parse("c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e"), Action = Guid.Parse("77777777-32ae-425f-99b5-83176061d1ae"), Object = "ASC.Web.Core.WebItemSecurity+WebItemSecurityObject|ea942538e68e49079394035336ee0ba8", AceType = (AceType)1 },
new Acl { Tenant = -1, Subject = Guid.Parse("c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e"), Action = Guid.Parse("77777777-32ae-425f-99b5-83176061d1ae"), Object = "ASC.Web.Core.WebItemSecurity+WebItemSecurityObject|32d24cb57ece46069c9419216ba42086", AceType = 0 },
new Acl { Tenant = -1, Subject = Guid.Parse("c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e"), Action = Guid.Parse("77777777-32ae-425f-99b5-83176061d1ae"), Object = "ASC.Web.Core.WebItemSecurity+WebItemSecurityObject|bf88953e3c434850a3fbb1e43ad53a3e", AceType = 0 },
new Acl { Tenant = -1, Subject = Guid.Parse("c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e"), Action = Guid.Parse("77777777-32ae-425f-99b5-83176061d1ae"), Object = "ASC.Web.Core.WebItemSecurity+WebItemSecurityObject|2a9230378b2d487b9a225ac0918acf3f", AceType = 0 },
new Acl { Tenant = -1, Subject = Guid.Parse("c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e"), Action = Guid.Parse("77777777-32ae-425f-99b5-83176061d1ae"), Object = "ASC.Web.Core.WebItemSecurity+WebItemSecurityObject|f4d98afdd336433287783c6945c81ea0", AceType = 0 },
new Acl { Tenant = -1, Subject = Guid.Parse("c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e"), Action = Guid.Parse("77777777-32ae-425f-99b5-83176061d1ae"), Object = "ASC.Web.Core.WebItemSecurity+WebItemSecurityObject|28b10049dd204f54b986873bc14ccfc7", AceType = (AceType)1 },
new Acl { Tenant = -1, Subject = Guid.Parse("c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e"), Action = Guid.Parse("77777777-32ae-425f-99b5-83176061d1ae"), Object = "ASC.Web.Core.WebItemSecurity+WebItemSecurityObject|3cfd481b46f24a4ab55cb8c0c9def02c", AceType = (AceType)1 },
new Acl { Tenant = -1, Subject = Guid.Parse("c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e"), Action = Guid.Parse("77777777-32ae-425f-99b5-83176061d1ae"), Object = "ASC.Web.Core.WebItemSecurity+WebItemSecurityObject|6a598c7491ae437da5f4ad339bd11bb2", AceType = (AceType)1 },
new Acl { Tenant = -1, Subject = Guid.Parse("c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e"), Action = Guid.Parse("77777777-32ae-425f-99b5-83176061d1ae"), Object = "ASC.Web.Core.WebItemSecurity+WebItemSecurityObject|742cf945cbbc4a5782d61600a12cf8ca", AceType = (AceType)1 },
new Acl { Tenant = -1, Subject = Guid.Parse("c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e"), Action = Guid.Parse("77777777-32ae-425f-99b5-83176061d1ae"), Object = "ASC.Web.Core.WebItemSecurity+WebItemSecurityObject|853b6eb973ee438d9b098ffeedf36234", AceType = (AceType)1 },
new Acl { Tenant = -1, Subject = Guid.Parse("c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e"), Action = Guid.Parse("77777777-32ae-425f-99b5-83176061d1ae"), Object = "ASC.Web.Core.WebItemSecurity+WebItemSecurityObject|46cfa73af32046cf8d5bcd82e1d67f26", AceType = 0 },
new Acl { Tenant = -1, Subject = Guid.Parse("c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e"), Action = Guid.Parse("77777777-32ae-425f-99b5-83176061d1ae"), Object = "ASC.Web.Core.WebItemSecurity+WebItemSecurityObject|37620ae5c40b45ce855a39dd7d76a1fa", AceType = 0 });
new Acl { TenantId = -1, Subject = Guid.Parse("5d5b7260-f7f7-49f1-a1c9-95fbb6a12604"), Action = Guid.Parse("ef5e6790-f346-4b6e-b662-722bc28cb0db"), Object = "", AceType = 0 },
new Acl { TenantId = -1, Subject = Guid.Parse("5d5b7260-f7f7-49f1-a1c9-95fbb6a12604"), Action = Guid.Parse("f11e8f3f-46e6-4e55-90e3-09c22ec565bd"), Object = "", AceType = 0 },
new Acl { TenantId = -1, Subject = Guid.Parse("c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e"), Action = Guid.Parse("088d5940-a80f-4403-9741-d610718ce95c"), Object = "", AceType = 0 },
new Acl { TenantId = -1, Subject = Guid.Parse("c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e"), Action = Guid.Parse("08d66144-e1c9-4065-9aa1-aa4bba0a7bc8"), Object = "", AceType = 0 },
new Acl { TenantId = -1, Subject = Guid.Parse("abef62db-11a8-4673-9d32-ef1d8af19dc0"), Action = Guid.Parse("08d75c97-cf3f-494b-90d1-751c941fe2dd"), Object = "", AceType = 0 },
new Acl { TenantId = -1, Subject = Guid.Parse("abef62db-11a8-4673-9d32-ef1d8af19dc0"), Action = Guid.Parse("0d1f72a8-63da-47ea-ae42-0900e4ac72a9"), Object = "", AceType = 0 },
new Acl { TenantId = -1, Subject = Guid.Parse("abef62db-11a8-4673-9d32-ef1d8af19dc0"), Action = Guid.Parse("13e30b51-5b4d-40a5-8575-cb561899eeb1"), Object = "", AceType = 0 },
new Acl { TenantId = -1, Subject = Guid.Parse("abef62db-11a8-4673-9d32-ef1d8af19dc0"), Action = Guid.Parse("19f658ae-722b-4cd8-8236-3ad150801d96"), Object = "", AceType = 0 },
new Acl { TenantId = -1, Subject = Guid.Parse("abef62db-11a8-4673-9d32-ef1d8af19dc0"), Action = Guid.Parse("2c6552b3-b2e0-4a00-b8fd-13c161e337b1"), Object = "", AceType = 0 },
new Acl { TenantId = -1, Subject = Guid.Parse("c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e"), Action = Guid.Parse("388c29d3-c662-4a61-bf47-fc2f7094224a"), Object = "", AceType = 0 },
new Acl { TenantId = -1, Subject = Guid.Parse("abef62db-11a8-4673-9d32-ef1d8af19dc0"), Action = Guid.Parse("40bf31f4-3132-4e76-8d5c-9828a89501a3"), Object = "", AceType = 0 },
new Acl { TenantId = -1, Subject = Guid.Parse("abef62db-11a8-4673-9d32-ef1d8af19dc0"), Action = Guid.Parse("49ae8915-2b30-4348-ab74-b152279364fb"), Object = "", AceType = 0 },
new Acl { TenantId = -1, Subject = Guid.Parse("c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e"), Action = Guid.Parse("63e9f35f-6bb5-4fb1-afaa-e4c2f4dec9bd"), Object = "", AceType = 0 },
new Acl { TenantId = -1, Subject = Guid.Parse("c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e"), Action = Guid.Parse("9018c001-24c2-44bf-a1db-d1121a570e74"), Object = "", AceType = 0 },
new Acl { TenantId = -1, Subject = Guid.Parse("abef62db-11a8-4673-9d32-ef1d8af19dc0"), Action = Guid.Parse("948ad738-434b-4a88-8e38-7569d332910a"), Object = "", AceType = 0 },
new Acl { TenantId = -1, Subject = Guid.Parse("abef62db-11a8-4673-9d32-ef1d8af19dc0"), Action = Guid.Parse("9d75a568-52aa-49d8-ad43-473756cd8903"), Object = "", AceType = 0 },
new Acl { TenantId = -1, Subject = Guid.Parse("c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e"), Action = Guid.Parse("a362fe79-684e-4d43-a599-65bc1f4e167f"), Object = "", AceType = 0 },
new Acl { TenantId = -1, Subject = Guid.Parse("c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e"), Action = Guid.Parse("c426c349-9ad4-47cd-9b8f-99fc30675951"), Object = "", AceType = 0 },
new Acl { TenantId = -1, Subject = Guid.Parse("c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e"), Action = Guid.Parse("d11ebcb9-0e6e-45e6-a6d0-99c41d687598"), Object = "", AceType = 0 },
new Acl { TenantId = -1, Subject = Guid.Parse("c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e"), Action = Guid.Parse("d1f3b53d-d9e2-4259-80e7-d24380978395"), Object = "", AceType = 0 },
new Acl { TenantId = -1, Subject = Guid.Parse("abef62db-11a8-4673-9d32-ef1d8af19dc0"), Action = Guid.Parse("d49f4e30-da10-4b39-bc6d-b41ef6e039d3"), Object = "", AceType = 0 },
new Acl { TenantId = -1, Subject = Guid.Parse("abef62db-11a8-4673-9d32-ef1d8af19dc0"), Action = Guid.Parse("d852b66f-6719-45e1-8657-18f0bb791690"), Object = "", AceType = 0 },
new Acl { TenantId = -1, Subject = Guid.Parse("c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e"), Action = Guid.Parse("e0759a42-47f0-4763-a26a-d5aa665bec35"), Object = "", AceType = 0 },
new Acl { TenantId = -1, Subject = Guid.Parse("c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e"), Action = Guid.Parse("e37239bd-c5b5-4f1e-a9f8-3ceeac209615"), Object = "", AceType = 0 },
new Acl { TenantId = -1, Subject = Guid.Parse("c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e"), Action = Guid.Parse("fbc37705-a04c-40ad-a68c-ce2f0423f397"), Object = "", AceType = 0 },
new Acl { TenantId = -1, Subject = Guid.Parse("c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e"), Action = Guid.Parse("fcac42b8-9386-48eb-a938-d19b3c576912"), Object = "", AceType = 0 },
new Acl { TenantId = -1, Subject = Guid.Parse("ba74ca02-873f-43dc-8470-8620c156bc67"), Action = Guid.Parse("13e30b51-5b4d-40a5-8575-cb561899eeb1"), Object = "", AceType = 0 },
new Acl { TenantId = -1, Subject = Guid.Parse("ba74ca02-873f-43dc-8470-8620c156bc67"), Action = Guid.Parse("49ae8915-2b30-4348-ab74-b152279364fb"), Object = "", AceType = 0 },
new Acl { TenantId = -1, Subject = Guid.Parse("ba74ca02-873f-43dc-8470-8620c156bc67"), Action = Guid.Parse("63e9f35f-6bb5-4fb1-afaa-e4c2f4dec9bd"), Object = "", AceType = 0 },
new Acl { TenantId = -1, Subject = Guid.Parse("ba74ca02-873f-43dc-8470-8620c156bc67"), Action = Guid.Parse("9018c001-24c2-44bf-a1db-d1121a570e74"), Object = "", AceType = 0 },
new Acl { TenantId = -1, Subject = Guid.Parse("ba74ca02-873f-43dc-8470-8620c156bc67"), Action = Guid.Parse("d1f3b53d-d9e2-4259-80e7-d24380978395"), Object = "", AceType = 0 },
new Acl { TenantId = -1, Subject = Guid.Parse("ba74ca02-873f-43dc-8470-8620c156bc67"), Action = Guid.Parse("e0759a42-47f0-4763-a26a-d5aa665bec35"), Object = "", AceType = 0 },
new Acl { TenantId = -1, Subject = Guid.Parse("ba74ca02-873f-43dc-8470-8620c156bc67"), Action = Guid.Parse("e37239bd-c5b5-4f1e-a9f8-3ceeac209615"), Object = "", AceType = 0 },
new Acl { TenantId = -1, Subject = Guid.Parse("ba74ca02-873f-43dc-8470-8620c156bc67"), Action = Guid.Parse("f11e88d7-f185-4372-927c-d88008d2c483"), Object = "", AceType = 0 },
new Acl { TenantId = -1, Subject = Guid.Parse("ba74ca02-873f-43dc-8470-8620c156bc67"), Action = Guid.Parse("f11e8f3f-46e6-4e55-90e3-09c22ec565bd"), Object = "", AceType = 0 },
new Acl { TenantId = -1, Subject = Guid.Parse("bba32183-a14d-48ed-9d39-c6b4d8925fbf"), Action = Guid.Parse("00e7dfc5-ac49-4fd3-a1d6-98d84e877ac4"), Object = "", AceType = 0 },
new Acl { TenantId = -1, Subject = Guid.Parse("bba32183-a14d-48ed-9d39-c6b4d8925fbf"), Action = Guid.Parse("14be970f-7af5-4590-8e81-ea32b5f7866d"), Object = "", AceType = 0 },
new Acl { TenantId = -1, Subject = Guid.Parse("bba32183-a14d-48ed-9d39-c6b4d8925fbf"), Action = Guid.Parse("18ecc94d-6afa-4994-8406-aee9dff12ce2"), Object = "", AceType = 0 },
new Acl { TenantId = -1, Subject = Guid.Parse("bba32183-a14d-48ed-9d39-c6b4d8925fbf"), Action = Guid.Parse("298530eb-435e-4dc6-a776-9abcd95c70e9"), Object = "", AceType = 0 },
new Acl { TenantId = -1, Subject = Guid.Parse("bba32183-a14d-48ed-9d39-c6b4d8925fbf"), Action = Guid.Parse("430eaf70-1886-483c-a746-1a18e3e6bb63"), Object = "", AceType = 0 },
new Acl { TenantId = -1, Subject = Guid.Parse("bba32183-a14d-48ed-9d39-c6b4d8925fbf"), Action = Guid.Parse("557d6503-633b-4490-a14c-6473147ce2b3"), Object = "", AceType = 0 }/*qwerty*/,
new Acl { TenantId = -1, Subject = Guid.Parse("bba32183-a14d-48ed-9d39-c6b4d8925fbf"), Action = Guid.Parse("724cbb75-d1c9-451e-bae0-4de0db96b1f7"), Object = "", AceType = 0 },
new Acl { TenantId = -1, Subject = Guid.Parse("bba32183-a14d-48ed-9d39-c6b4d8925fbf"), Action = Guid.Parse("7cb5c0d1-d254-433f-abe3-ff23373ec631"), Object = "", AceType = 0 },
new Acl { TenantId = -1, Subject = Guid.Parse("bba32183-a14d-48ed-9d39-c6b4d8925fbf"), Action = Guid.Parse("91b29dcd-9430-4403-b17a-27d09189be88"), Object = "", AceType = 0 },
new Acl { TenantId = -1, Subject = Guid.Parse("bba32183-a14d-48ed-9d39-c6b4d8925fbf"), Action = Guid.Parse("a18480a4-6d18-4c71-84fa-789888791f45"), Object = "", AceType = 0 },
new Acl { TenantId = -1, Subject = Guid.Parse("bba32183-a14d-48ed-9d39-c6b4d8925fbf"), Action = Guid.Parse("b630d29b-1844-4bda-bbbe-cf5542df3559"), Object = "", AceType = 0 },
new Acl { TenantId = -1, Subject = Guid.Parse("bba32183-a14d-48ed-9d39-c6b4d8925fbf"), Action = Guid.Parse("c62a9e8d-b24c-4513-90aa-7ff0f8ba38eb"), Object = "", AceType = 0 },
new Acl { TenantId = -1, Subject = Guid.Parse("bba32183-a14d-48ed-9d39-c6b4d8925fbf"), Action = Guid.Parse("d7cdb020-288b-41e5-a857-597347618533"), Object = "", AceType = 0 },
new Acl { TenantId = -1, Subject = Guid.Parse("bba32183-a14d-48ed-9d39-c6b4d8925fbf"), Action = Guid.Parse("662f3db7-9bc8-42cf-84da-2765f563e9b0"), Object = "", AceType = 0 },
new Acl { TenantId = -1, Subject = Guid.Parse("712d9ec3-5d2b-4b13-824f-71f00191dcca"), Action = Guid.Parse("e0759a42-47f0-4763-a26a-d5aa665bec35"), Object = "", AceType = 0 },
new Acl { TenantId = -1, Subject = Guid.Parse("bba32183-a14d-48ed-9d39-c6b4d8925fbf"), Action = Guid.Parse("0d68b142-e20a-446e-a832-0d6b0b65a164"), Object = "", AceType = 0 },
new Acl { TenantId = -1, Subject = Guid.Parse("c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e"), Action = Guid.Parse("6f05c382-8bca-4469-9424-c807a98c40d7"), Object = "", AceType = 0 },
new Acl { TenantId = -1, Subject = Guid.Parse("c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e"), Action = Guid.Parse("77777777-32ae-425f-99b5-83176061d1ae"), Object = "ASC.Web.Core.WebItemSecurity+WebItemSecurityObject|1e04460243b54d7982f3fd6208a11960", AceType = 0 },
new Acl { TenantId = -1, Subject = Guid.Parse("c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e"), Action = Guid.Parse("77777777-32ae-425f-99b5-83176061d1ae"), Object = "ASC.Web.Core.WebItemSecurity+WebItemSecurityObject|6743007c6f954d208c88a8601ce5e76d", AceType = 0 },
new Acl { TenantId = -1, Subject = Guid.Parse("c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e"), Action = Guid.Parse("77777777-32ae-425f-99b5-83176061d1ae"), Object = "ASC.Web.Core.WebItemSecurity+WebItemSecurityObject|e67be73df9ae4ce18fec1880cb518cb4", AceType = 0 },
new Acl { TenantId = -1, Subject = Guid.Parse("c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e"), Action = Guid.Parse("77777777-32ae-425f-99b5-83176061d1ae"), Object = "ASC.Web.Core.WebItemSecurity+WebItemSecurityObject|ea942538e68e49079394035336ee0ba8", AceType = (AceType)1 },
new Acl { TenantId = -1, Subject = Guid.Parse("c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e"), Action = Guid.Parse("77777777-32ae-425f-99b5-83176061d1ae"), Object = "ASC.Web.Core.WebItemSecurity+WebItemSecurityObject|32d24cb57ece46069c9419216ba42086", AceType = 0 },
new Acl { TenantId = -1, Subject = Guid.Parse("c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e"), Action = Guid.Parse("77777777-32ae-425f-99b5-83176061d1ae"), Object = "ASC.Web.Core.WebItemSecurity+WebItemSecurityObject|bf88953e3c434850a3fbb1e43ad53a3e", AceType = 0 },
new Acl { TenantId = -1, Subject = Guid.Parse("c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e"), Action = Guid.Parse("77777777-32ae-425f-99b5-83176061d1ae"), Object = "ASC.Web.Core.WebItemSecurity+WebItemSecurityObject|2a9230378b2d487b9a225ac0918acf3f", AceType = 0 },
new Acl { TenantId = -1, Subject = Guid.Parse("c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e"), Action = Guid.Parse("77777777-32ae-425f-99b5-83176061d1ae"), Object = "ASC.Web.Core.WebItemSecurity+WebItemSecurityObject|f4d98afdd336433287783c6945c81ea0", AceType = 0 },
new Acl { TenantId = -1, Subject = Guid.Parse("c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e"), Action = Guid.Parse("77777777-32ae-425f-99b5-83176061d1ae"), Object = "ASC.Web.Core.WebItemSecurity+WebItemSecurityObject|28b10049dd204f54b986873bc14ccfc7", AceType = (AceType)1 },
new Acl { TenantId = -1, Subject = Guid.Parse("c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e"), Action = Guid.Parse("77777777-32ae-425f-99b5-83176061d1ae"), Object = "ASC.Web.Core.WebItemSecurity+WebItemSecurityObject|3cfd481b46f24a4ab55cb8c0c9def02c", AceType = (AceType)1 },
new Acl { TenantId = -1, Subject = Guid.Parse("c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e"), Action = Guid.Parse("77777777-32ae-425f-99b5-83176061d1ae"), Object = "ASC.Web.Core.WebItemSecurity+WebItemSecurityObject|6a598c7491ae437da5f4ad339bd11bb2", AceType = (AceType)1 },
new Acl { TenantId = -1, Subject = Guid.Parse("c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e"), Action = Guid.Parse("77777777-32ae-425f-99b5-83176061d1ae"), Object = "ASC.Web.Core.WebItemSecurity+WebItemSecurityObject|742cf945cbbc4a5782d61600a12cf8ca", AceType = (AceType)1 },
new Acl { TenantId = -1, Subject = Guid.Parse("c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e"), Action = Guid.Parse("77777777-32ae-425f-99b5-83176061d1ae"), Object = "ASC.Web.Core.WebItemSecurity+WebItemSecurityObject|853b6eb973ee438d9b098ffeedf36234", AceType = (AceType)1 },
new Acl { TenantId = -1, Subject = Guid.Parse("c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e"), Action = Guid.Parse("77777777-32ae-425f-99b5-83176061d1ae"), Object = "ASC.Web.Core.WebItemSecurity+WebItemSecurityObject|46cfa73af32046cf8d5bcd82e1d67f26", AceType = 0 },
new Acl { TenantId = -1, Subject = Guid.Parse("c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e"), Action = Guid.Parse("77777777-32ae-425f-99b5-83176061d1ae"), Object = "ASC.Web.Core.WebItemSecurity+WebItemSecurityObject|37620ae5c40b45ce855a39dd7d76a1fa", AceType = 0 });
return modelBuilder;
}
@ -123,13 +127,13 @@ public static class AclExtension
{
modelBuilder.Entity<Acl>(entity =>
{
entity.HasKey(e => new { e.Tenant, e.Subject, e.Action, e.Object })
entity.HasKey(e => new { e.TenantId, e.Subject, e.Action, e.Object })
.HasName("PRIMARY");
entity.ToTable("core_acl")
.HasCharSet("utf8");
entity.Property(e => e.Tenant).HasColumnName("tenant");
entity.Property(e => e.TenantId).HasColumnName("tenant");
entity.Property(e => e.Subject)
.HasColumnName("subject")
@ -157,12 +161,12 @@ public static class AclExtension
{
modelBuilder.Entity<Acl>(entity =>
{
entity.HasKey(e => new { e.Tenant, e.Subject, e.Action, e.Object })
entity.HasKey(e => new { e.TenantId, e.Subject, e.Action, e.Object })
.HasName("core_acl_pkey");
entity.ToTable("core_acl", "onlyoffice");
entity.Property(e => e.Tenant).HasColumnName("tenant");
entity.Property(e => e.TenantId).HasColumnName("tenant");
entity.Property(e => e.Subject)
.HasColumnName("subject")

View File

@ -28,14 +28,16 @@ namespace ASC.Core.Common.EF.Model;
public class DbCoreSettings : BaseEntity
{
public int Tenant { get; set; }
public int TenantId { get; set; }
public string Id { get; set; }
public byte[] Value { get; set; }
public DateTime LastModified { get; set; }
public DbTenant Tenant { get; set; }
public override object[] GetKeys()
{
return new object[] { Tenant, Id };
return new object[] { TenantId, Id };
}
}
@ -43,13 +45,15 @@ public static class CoreSettingsExtension
{
public static ModelBuilderWrapper AddCoreSettings(this ModelBuilderWrapper modelBuilder)
{
modelBuilder.Entity<DbCoreSettings>().Navigation(e => e.Tenant).AutoInclude(false);
modelBuilder
.Add(MySqlAddCoreSettings, Provider.MySql)
.Add(PgSqlAddCoreSettings, Provider.PostgreSql)
.HasData(
new DbCoreSettings { Tenant = -1, Id = "CompanyWhiteLabelSettings", Value = new byte[] { 245, 71, 4, 138, 72, 101, 23, 21, 135, 217, 206, 188, 138, 73, 108, 96, 29, 150, 3, 31, 44, 28, 62, 145, 96, 53, 57, 66, 238, 118, 93, 172, 211, 22, 244, 181, 244, 40, 146, 67, 111, 196, 162, 27, 154, 109, 248, 255, 181, 17, 253, 127, 42, 65, 19, 90, 26, 206, 203, 145, 159, 159, 243, 105, 24, 71, 188, 165, 53, 85, 57, 37, 186, 251, 57, 96, 18, 162, 218, 80, 0, 101, 250, 100, 66, 97, 24, 51, 240, 215, 216, 169, 105, 100, 15, 253, 29, 83, 182, 236, 203, 53, 68, 251, 2, 150, 149, 148, 58, 136, 84, 37, 151, 82, 92, 227, 30, 52, 111, 40, 154, 155, 7, 126, 149, 100, 169, 87, 10, 129, 228, 138, 177, 101, 77, 67, 177, 216, 189, 201, 1, 213, 136, 216, 107, 198, 253, 221, 106, 255, 198, 17, 68, 14, 110, 90, 174, 182, 68, 222, 188, 77, 157, 19, 26, 68, 86, 97, 15, 81, 24, 171, 214, 114, 191, 175, 56, 56, 48, 52, 125, 82, 253, 113, 71, 41, 201, 5, 8, 118, 162, 191, 99, 196, 48, 198, 223, 79, 204, 174, 31, 97, 236, 20, 213, 218, 85, 34, 16, 74, 196, 209, 235, 14, 71, 209, 32, 131, 195, 84, 11, 66, 74, 19, 115, 255, 99, 69, 235, 210, 204, 15, 13, 4, 143, 127, 152, 125, 212, 91 }, LastModified = new DateTime(2022, 7, 8) },
new DbCoreSettings { Tenant = -1, Id = "FullTextSearchSettings", Value = new byte[] { 8, 120, 207, 5, 153, 181, 23, 202, 162, 211, 218, 237, 157, 6, 76, 62, 220, 238, 175, 67, 31, 53, 166, 246, 66, 220, 173, 160, 72, 23, 227, 81, 50, 39, 187, 177, 222, 110, 43, 171, 235, 158, 16, 119, 178, 207, 49, 140, 72, 152, 20, 84, 94, 135, 117, 1, 246, 51, 251, 190, 148, 2, 44, 252, 221, 2, 91, 83, 149, 151, 58, 245, 16, 148, 52, 8, 187, 86, 150, 46, 227, 93, 163, 95, 47, 131, 116, 207, 95, 209, 38, 149, 53, 148, 73, 215, 206, 251, 194, 199, 189, 17, 42, 229, 135, 82, 23, 154, 162, 165, 158, 94, 23, 128, 30, 88, 12, 204, 96, 250, 236, 142, 189, 211, 214, 18, 196, 136, 102, 102, 217, 109, 108, 240, 96, 96, 94, 100, 201, 10, 31, 170, 128, 192 }, LastModified = new DateTime(2022, 7, 8) },
new DbCoreSettings { Tenant = -1, Id = "SmtpSettings", Value = new byte[] { 240, 82, 224, 144, 161, 163, 117, 13, 173, 205, 78, 153, 97, 218, 4, 170, 81, 239, 1, 151, 226, 192, 98, 60, 241, 44, 88, 56, 191, 164, 10, 155, 72, 186, 239, 203, 227, 113, 88, 119, 49, 215, 227, 220, 158, 124, 96, 9, 116, 47, 158, 65, 93, 86, 219, 15, 10, 224, 142, 50, 248, 144, 75, 44, 68, 28, 198, 87, 198, 69, 67, 234, 238, 38, 32, 68, 162, 139, 67, 53, 220, 176, 240, 196, 233, 64, 29, 137, 31, 160, 99, 105, 249, 132, 202, 45, 71, 92, 134, 194, 55, 145, 121, 97, 197, 130, 119, 105, 131, 21, 133, 35, 10, 102, 172, 119, 135, 230, 251, 86, 253, 62, 55, 56, 146, 103, 164, 106 }, LastModified = new DateTime(2022, 7, 8) }
new DbCoreSettings { TenantId = -1, Id = "CompanyWhiteLabelSettings", Value = new byte[] { 245, 71, 4, 138, 72, 101, 23, 21, 135, 217, 206, 188, 138, 73, 108, 96, 29, 150, 3, 31, 44, 28, 62, 145, 96, 53, 57, 66, 238, 118, 93, 172, 211, 22, 244, 181, 244, 40, 146, 67, 111, 196, 162, 27, 154, 109, 248, 255, 181, 17, 253, 127, 42, 65, 19, 90, 26, 206, 203, 145, 159, 159, 243, 105, 24, 71, 188, 165, 53, 85, 57, 37, 186, 251, 57, 96, 18, 162, 218, 80, 0, 101, 250, 100, 66, 97, 24, 51, 240, 215, 216, 169, 105, 100, 15, 253, 29, 83, 182, 236, 203, 53, 68, 251, 2, 150, 149, 148, 58, 136, 84, 37, 151, 82, 92, 227, 30, 52, 111, 40, 154, 155, 7, 126, 149, 100, 169, 87, 10, 129, 228, 138, 177, 101, 77, 67, 177, 216, 189, 201, 1, 213, 136, 216, 107, 198, 253, 221, 106, 255, 198, 17, 68, 14, 110, 90, 174, 182, 68, 222, 188, 77, 157, 19, 26, 68, 86, 97, 15, 81, 24, 171, 214, 114, 191, 175, 56, 56, 48, 52, 125, 82, 253, 113, 71, 41, 201, 5, 8, 118, 162, 191, 99, 196, 48, 198, 223, 79, 204, 174, 31, 97, 236, 20, 213, 218, 85, 34, 16, 74, 196, 209, 235, 14, 71, 209, 32, 131, 195, 84, 11, 66, 74, 19, 115, 255, 99, 69, 235, 210, 204, 15, 13, 4, 143, 127, 152, 125, 212, 91 }, LastModified = new DateTime(2022, 7, 8) },
new DbCoreSettings { TenantId = -1, Id = "FullTextSearchSettings", Value = new byte[] { 8, 120, 207, 5, 153, 181, 23, 202, 162, 211, 218, 237, 157, 6, 76, 62, 220, 238, 175, 67, 31, 53, 166, 246, 66, 220, 173, 160, 72, 23, 227, 81, 50, 39, 187, 177, 222, 110, 43, 171, 235, 158, 16, 119, 178, 207, 49, 140, 72, 152, 20, 84, 94, 135, 117, 1, 246, 51, 251, 190, 148, 2, 44, 252, 221, 2, 91, 83, 149, 151, 58, 245, 16, 148, 52, 8, 187, 86, 150, 46, 227, 93, 163, 95, 47, 131, 116, 207, 95, 209, 38, 149, 53, 148, 73, 215, 206, 251, 194, 199, 189, 17, 42, 229, 135, 82, 23, 154, 162, 165, 158, 94, 23, 128, 30, 88, 12, 204, 96, 250, 236, 142, 189, 211, 214, 18, 196, 136, 102, 102, 217, 109, 108, 240, 96, 96, 94, 100, 201, 10, 31, 170, 128, 192 }, LastModified = new DateTime(2022, 7, 8) },
new DbCoreSettings { TenantId = -1, Id = "SmtpSettings", Value = new byte[] { 240, 82, 224, 144, 161, 163, 117, 13, 173, 205, 78, 153, 97, 218, 4, 170, 81, 239, 1, 151, 226, 192, 98, 60, 241, 44, 88, 56, 191, 164, 10, 155, 72, 186, 239, 203, 227, 113, 88, 119, 49, 215, 227, 220, 158, 124, 96, 9, 116, 47, 158, 65, 93, 86, 219, 15, 10, 224, 142, 50, 248, 144, 75, 44, 68, 28, 198, 87, 198, 69, 67, 234, 238, 38, 32, 68, 162, 139, 67, 53, 220, 176, 240, 196, 233, 64, 29, 137, 31, 160, 99, 105, 249, 132, 202, 45, 71, 92, 134, 194, 55, 145, 121, 97, 197, 130, 119, 105, 131, 21, 133, 35, 10, 102, 172, 119, 135, 230, 251, 86, 253, 62, 55, 56, 146, 103, 164, 106 }, LastModified = new DateTime(2022, 7, 8) }
);
return modelBuilder;
@ -59,13 +63,13 @@ public static class CoreSettingsExtension
{
modelBuilder.Entity<DbCoreSettings>(entity =>
{
entity.HasKey(e => new { e.Tenant, e.Id })
entity.HasKey(e => new { e.TenantId, e.Id })
.HasName("PRIMARY");
entity.ToTable("core_settings")
.HasCharSet("utf8");
entity.Property(e => e.Tenant).HasColumnName("tenant");
entity.Property(e => e.TenantId).HasColumnName("tenant");
entity.Property(e => e.Id)
.HasColumnName("id")
@ -87,12 +91,12 @@ public static class CoreSettingsExtension
{
modelBuilder.Entity<DbCoreSettings>(entity =>
{
entity.HasKey(e => new { e.Tenant, e.Id })
entity.HasKey(e => new { e.TenantId, e.Id })
.HasName("core_settings_pkey");
entity.ToTable("core_settings", "onlyoffice");
entity.Property(e => e.Tenant).HasColumnName("tenant");
entity.Property(e => e.TenantId).HasColumnName("tenant");
entity.Property(e => e.Id)
.HasColumnName("id")

View File

@ -28,15 +28,17 @@ namespace ASC.Core.Common.EF;
public class DbSubscriptionMethod : BaseEntity
{
public int Tenant { get; set; }
public int TenantId { get; set; }
public string Source { get; set; }
public string Action { get; set; }
public string Recipient { get; set; }
public string Sender { get; set; }
public DbTenant Tenant { get; set; }
public override object[] GetKeys()
{
return new object[] { Tenant, Source, Action, Recipient };
return new object[] { TenantId, Source, Action, Recipient };
}
}
@ -44,42 +46,44 @@ public static class SubscriptionMethodExtension
{
public static ModelBuilderWrapper AddSubscriptionMethod(this ModelBuilderWrapper modelBuilder)
{
modelBuilder.Entity<DbSubscriptionMethod>().Navigation(e => e.Tenant).AutoInclude(false);
modelBuilder
.Add(MySqlAddSubscriptionMethod, Provider.MySql)
.Add(PgSqlAddSubscriptionMethod, Provider.PostgreSql)
.HasData(
new DbSubscriptionMethod { Source = "asc.web.studio", Action = "send_whats_new", Recipient = "c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e", Sender = "email.sender", Tenant = -1 },
new DbSubscriptionMethod { Source = "6504977c-75af-4691-9099-084d3ddeea04", Action = "new feed", Recipient = "c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e", Sender = "email.sender|messanger.sender", Tenant = -1 },
new DbSubscriptionMethod { Source = "6a598c74-91ae-437d-a5f4-ad339bd11bb2", Action = "new post", Recipient = "c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e", Sender = "email.sender|messanger.sender", Tenant = -1 },
new DbSubscriptionMethod { Source = "853b6eb9-73ee-438d-9b09-8ffeedf36234", Action = "new topic in forum", Recipient = "c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e", Sender = "email.sender|messanger.sender", Tenant = -1 },
new DbSubscriptionMethod { Source = "9d51954f-db9b-4aed-94e3-ed70b914e101", Action = "new photo uploaded", Recipient = "c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e", Sender = "email.sender|messanger.sender", Tenant = -1 },
new DbSubscriptionMethod { Source = "28b10049-dd20-4f54-b986-873bc14ccfc7", Action = "new bookmark created", Recipient = "c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e", Sender = "email.sender|messanger.sender", Tenant = -1 },
new DbSubscriptionMethod { Source = "742cf945-cbbc-4a57-82d6-1600a12cf8ca", Action = "new wiki page", Recipient = "c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e", Sender = "email.sender|messanger.sender", Tenant = -1 },
new DbSubscriptionMethod { Source = "37620ae5-c40b-45ce-855a-39dd7d76a1fa", Action = "BirthdayReminder", Recipient = "abef62db-11a8-4673-9d32-ef1d8af19dc0", Sender = "email.sender|messanger.sender", Tenant = -1 },
new DbSubscriptionMethod { Source = "6fe286a4-479e-4c25-a8d9-0156e332b0c0", Action = "sharedocument", Recipient = "c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e", Sender = "email.sender|messanger.sender", Tenant = -1 },
new DbSubscriptionMethod { Source = "6fe286a4-479e-4c25-a8d9-0156e332b0c0", Action = "sharefolder", Recipient = "c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e", Sender = "email.sender|messanger.sender", Tenant = -1 },
new DbSubscriptionMethod { Source = "6fe286a4-479e-4c25-a8d9-0156e332b0c0", Action = "updatedocument", Recipient = "c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e", Sender = "email.sender|messanger.sender", Tenant = -1 },
new DbSubscriptionMethod { Source = "6045b68c-2c2e-42db-9e53-c272e814c4ad", Action = "invitetoproject", Recipient = "c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e", Sender = "email.sender|messanger.sender", Tenant = -1 },
new DbSubscriptionMethod { Source = "6045b68c-2c2e-42db-9e53-c272e814c4ad", Action = "milestonedeadline", Recipient = "c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e", Sender = "email.sender|messanger.sender", Tenant = -1 },
new DbSubscriptionMethod { Source = "6045b68c-2c2e-42db-9e53-c272e814c4ad", Action = "newcommentformessage", Recipient = "c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e", Sender = "email.sender|messanger.sender", Tenant = -1 },
new DbSubscriptionMethod { Source = "6045b68c-2c2e-42db-9e53-c272e814c4ad", Action = "newcommentformilestone", Recipient = "c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e", Sender = "email.sender|messanger.sender", Tenant = -1 },
new DbSubscriptionMethod { Source = "6045b68c-2c2e-42db-9e53-c272e814c4ad", Action = "newcommentfortask", Recipient = "c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e", Sender = "email.sender|messanger.sender", Tenant = -1 },
new DbSubscriptionMethod { Source = "6045b68c-2c2e-42db-9e53-c272e814c4ad", Action = "projectcreaterequest", Recipient = "c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e", Sender = "email.sender|messanger.sender", Tenant = -1 },
new DbSubscriptionMethod { Source = "6045b68c-2c2e-42db-9e53-c272e814c4ad", Action = "projecteditrequest", Recipient = "c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e", Sender = "email.sender|messanger.sender", Tenant = -1 },
new DbSubscriptionMethod { Source = "6045b68c-2c2e-42db-9e53-c272e814c4ad", Action = "removefromproject", Recipient = "c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e", Sender = "email.sender|messanger.sender", Tenant = -1 },
new DbSubscriptionMethod { Source = "6045b68c-2c2e-42db-9e53-c272e814c4ad", Action = "responsibleforproject", Recipient = "c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e", Sender = "email.sender|messanger.sender", Tenant = -1 },
new DbSubscriptionMethod { Source = "6045b68c-2c2e-42db-9e53-c272e814c4ad", Action = "responsiblefortask", Recipient = "c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e", Sender = "email.sender|messanger.sender", Tenant = -1 },
new DbSubscriptionMethod { Source = "6045b68c-2c2e-42db-9e53-c272e814c4ad", Action = "taskclosed", Recipient = "c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e", Sender = "email.sender|messanger.sender", Tenant = -1 },
new DbSubscriptionMethod { Source = "40650da3-f7c1-424c-8c89-b9c115472e08", Action = "calendar_sharing", Recipient = "c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e", Sender = "email.sender|messanger.sender", Tenant = -1 },
new DbSubscriptionMethod { Source = "40650da3-f7c1-424c-8c89-b9c115472e08", Action = "event_alert", Recipient = "c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e", Sender = "email.sender|messanger.sender", Tenant = -1 },
new DbSubscriptionMethod { Source = "asc.web.studio", Action = "admin_notify", Recipient = "cd84e66b-b803-40fc-99f9-b2969a54a1de", Sender = "email.sender", Tenant = -1 },
new DbSubscriptionMethod { Source = "13ff36fb-0272-4887-b416-74f52b0d0b02", Action = "SetAccess", Recipient = "abef62db-11a8-4673-9d32-ef1d8af19dc0", Sender = "email.sender|messanger.sender", Tenant = -1 },
new DbSubscriptionMethod { Source = "13ff36fb-0272-4887-b416-74f52b0d0b02", Action = "ResponsibleForTask", Recipient = "abef62db-11a8-4673-9d32-ef1d8af19dc0", Sender = "email.sender|messanger.sender", Tenant = -1 },
new DbSubscriptionMethod { Source = "13ff36fb-0272-4887-b416-74f52b0d0b02", Action = "AddRelationshipEvent", Recipient = "abef62db-11a8-4673-9d32-ef1d8af19dc0", Sender = "email.sender|messanger.sender", Tenant = -1 },
new DbSubscriptionMethod { Source = "13ff36fb-0272-4887-b416-74f52b0d0b02", Action = "ExportCompleted", Recipient = "abef62db-11a8-4673-9d32-ef1d8af19dc0", Sender = "email.sender|messanger.sender", Tenant = -1 },
new DbSubscriptionMethod { Source = "13ff36fb-0272-4887-b416-74f52b0d0b02", Action = "CreateNewContact", Recipient = "abef62db-11a8-4673-9d32-ef1d8af19dc0", Sender = "email.sender|messanger.sender", Tenant = -1 },
new DbSubscriptionMethod { Source = "13ff36fb-0272-4887-b416-74f52b0d0b02", Action = "ResponsibleForOpportunity", Recipient = "abef62db-11a8-4673-9d32-ef1d8af19dc0", Sender = "email.sender|messanger.sender", Tenant = -1 },
new DbSubscriptionMethod { Source = "asc.web.studio", Action = "periodic_notify", Recipient = "c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e", Sender = "email.sender", Tenant = -1 }
new DbSubscriptionMethod { Source = "asc.web.studio", Action = "send_whats_new", Recipient = "c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e", Sender = "email.sender", TenantId = -1 },
new DbSubscriptionMethod { Source = "6504977c-75af-4691-9099-084d3ddeea04", Action = "new feed", Recipient = "c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e", Sender = "email.sender|messanger.sender", TenantId = -1 },
new DbSubscriptionMethod { Source = "6a598c74-91ae-437d-a5f4-ad339bd11bb2", Action = "new post", Recipient = "c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e", Sender = "email.sender|messanger.sender", TenantId = -1 },
new DbSubscriptionMethod { Source = "853b6eb9-73ee-438d-9b09-8ffeedf36234", Action = "new topic in forum", Recipient = "c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e", Sender = "email.sender|messanger.sender", TenantId = -1 },
new DbSubscriptionMethod { Source = "9d51954f-db9b-4aed-94e3-ed70b914e101", Action = "new photo uploaded", Recipient = "c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e", Sender = "email.sender|messanger.sender", TenantId = -1 },
new DbSubscriptionMethod { Source = "28b10049-dd20-4f54-b986-873bc14ccfc7", Action = "new bookmark created", Recipient = "c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e", Sender = "email.sender|messanger.sender", TenantId = -1 },
new DbSubscriptionMethod { Source = "742cf945-cbbc-4a57-82d6-1600a12cf8ca", Action = "new wiki page", Recipient = "c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e", Sender = "email.sender|messanger.sender", TenantId = -1 },
new DbSubscriptionMethod { Source = "37620ae5-c40b-45ce-855a-39dd7d76a1fa", Action = "BirthdayReminder", Recipient = "abef62db-11a8-4673-9d32-ef1d8af19dc0", Sender = "email.sender|messanger.sender", TenantId = -1 },
new DbSubscriptionMethod { Source = "6fe286a4-479e-4c25-a8d9-0156e332b0c0", Action = "sharedocument", Recipient = "c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e", Sender = "email.sender|messanger.sender", TenantId = -1 },
new DbSubscriptionMethod { Source = "6fe286a4-479e-4c25-a8d9-0156e332b0c0", Action = "sharefolder", Recipient = "c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e", Sender = "email.sender|messanger.sender", TenantId = -1 },
new DbSubscriptionMethod { Source = "6fe286a4-479e-4c25-a8d9-0156e332b0c0", Action = "updatedocument", Recipient = "c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e", Sender = "email.sender|messanger.sender", TenantId = -1 },
new DbSubscriptionMethod { Source = "6045b68c-2c2e-42db-9e53-c272e814c4ad", Action = "invitetoproject", Recipient = "c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e", Sender = "email.sender|messanger.sender", TenantId = -1 },
new DbSubscriptionMethod { Source = "6045b68c-2c2e-42db-9e53-c272e814c4ad", Action = "milestonedeadline", Recipient = "c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e", Sender = "email.sender|messanger.sender", TenantId = -1 },
new DbSubscriptionMethod { Source = "6045b68c-2c2e-42db-9e53-c272e814c4ad", Action = "newcommentformessage", Recipient = "c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e", Sender = "email.sender|messanger.sender", TenantId = -1 },
new DbSubscriptionMethod { Source = "6045b68c-2c2e-42db-9e53-c272e814c4ad", Action = "newcommentformilestone", Recipient = "c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e", Sender = "email.sender|messanger.sender", TenantId = -1 },
new DbSubscriptionMethod { Source = "6045b68c-2c2e-42db-9e53-c272e814c4ad", Action = "newcommentfortask", Recipient = "c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e", Sender = "email.sender|messanger.sender", TenantId = -1 },
new DbSubscriptionMethod { Source = "6045b68c-2c2e-42db-9e53-c272e814c4ad", Action = "projectcreaterequest", Recipient = "c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e", Sender = "email.sender|messanger.sender", TenantId = -1 },
new DbSubscriptionMethod { Source = "6045b68c-2c2e-42db-9e53-c272e814c4ad", Action = "projecteditrequest", Recipient = "c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e", Sender = "email.sender|messanger.sender", TenantId = -1 },
new DbSubscriptionMethod { Source = "6045b68c-2c2e-42db-9e53-c272e814c4ad", Action = "removefromproject", Recipient = "c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e", Sender = "email.sender|messanger.sender", TenantId = -1 },
new DbSubscriptionMethod { Source = "6045b68c-2c2e-42db-9e53-c272e814c4ad", Action = "responsibleforproject", Recipient = "c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e", Sender = "email.sender|messanger.sender", TenantId = -1 },
new DbSubscriptionMethod { Source = "6045b68c-2c2e-42db-9e53-c272e814c4ad", Action = "responsiblefortask", Recipient = "c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e", Sender = "email.sender|messanger.sender", TenantId = -1 },
new DbSubscriptionMethod { Source = "6045b68c-2c2e-42db-9e53-c272e814c4ad", Action = "taskclosed", Recipient = "c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e", Sender = "email.sender|messanger.sender", TenantId = -1 },
new DbSubscriptionMethod { Source = "40650da3-f7c1-424c-8c89-b9c115472e08", Action = "calendar_sharing", Recipient = "c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e", Sender = "email.sender|messanger.sender", TenantId = -1 },
new DbSubscriptionMethod { Source = "40650da3-f7c1-424c-8c89-b9c115472e08", Action = "event_alert", Recipient = "c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e", Sender = "email.sender|messanger.sender", TenantId = -1 },
new DbSubscriptionMethod { Source = "asc.web.studio", Action = "admin_notify", Recipient = "cd84e66b-b803-40fc-99f9-b2969a54a1de", Sender = "email.sender", TenantId = -1 },
new DbSubscriptionMethod { Source = "13ff36fb-0272-4887-b416-74f52b0d0b02", Action = "SetAccess", Recipient = "abef62db-11a8-4673-9d32-ef1d8af19dc0", Sender = "email.sender|messanger.sender", TenantId = -1 },
new DbSubscriptionMethod { Source = "13ff36fb-0272-4887-b416-74f52b0d0b02", Action = "ResponsibleForTask", Recipient = "abef62db-11a8-4673-9d32-ef1d8af19dc0", Sender = "email.sender|messanger.sender", TenantId = -1 },
new DbSubscriptionMethod { Source = "13ff36fb-0272-4887-b416-74f52b0d0b02", Action = "AddRelationshipEvent", Recipient = "abef62db-11a8-4673-9d32-ef1d8af19dc0", Sender = "email.sender|messanger.sender", TenantId = -1 },
new DbSubscriptionMethod { Source = "13ff36fb-0272-4887-b416-74f52b0d0b02", Action = "ExportCompleted", Recipient = "abef62db-11a8-4673-9d32-ef1d8af19dc0", Sender = "email.sender|messanger.sender", TenantId = -1 },
new DbSubscriptionMethod { Source = "13ff36fb-0272-4887-b416-74f52b0d0b02", Action = "CreateNewContact", Recipient = "abef62db-11a8-4673-9d32-ef1d8af19dc0", Sender = "email.sender|messanger.sender", TenantId = -1 },
new DbSubscriptionMethod { Source = "13ff36fb-0272-4887-b416-74f52b0d0b02", Action = "ResponsibleForOpportunity", Recipient = "abef62db-11a8-4673-9d32-ef1d8af19dc0", Sender = "email.sender|messanger.sender", TenantId = -1 },
new DbSubscriptionMethod { Source = "asc.web.studio", Action = "periodic_notify", Recipient = "c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e", Sender = "email.sender", TenantId = -1 }
);
return modelBuilder;
@ -89,13 +93,13 @@ public static class SubscriptionMethodExtension
{
modelBuilder.Entity<DbSubscriptionMethod>(entity =>
{
entity.HasKey(e => new { e.Tenant, e.Source, e.Action, e.Recipient })
entity.HasKey(e => new { e.TenantId, e.Source, e.Action, e.Recipient })
.HasName("PRIMARY");
entity.ToTable("core_subscriptionmethod")
.HasCharSet("utf8");
entity.Property(e => e.Tenant).HasColumnName("tenant");
entity.Property(e => e.TenantId).HasColumnName("tenant");
entity.Property(e => e.Source)
.HasColumnName("source")
@ -127,12 +131,12 @@ public static class SubscriptionMethodExtension
{
modelBuilder.Entity<DbSubscriptionMethod>(entity =>
{
entity.HasKey(e => new { e.Tenant, e.Source, e.Action, e.Recipient })
entity.HasKey(e => new { e.TenantId, e.Source, e.Action, e.Recipient })
.HasName("core_subscriptionmethod_pkey");
entity.ToTable("core_subscriptionmethod", "onlyoffice");
entity.Property(e => e.Tenant).HasColumnName("tenant");
entity.Property(e => e.TenantId).HasColumnName("tenant");
entity.Property(e => e.Source)
.HasColumnName("source")

View File

@ -28,16 +28,18 @@ namespace ASC.Core.Common.EF;
public class Subscription : BaseEntity
{
public int Tenant { get; set; }
public int TenantId { get; set; }
public string Source { get; set; }
public string Action { get; set; }
public string Recipient { get; set; }
public string Object { get; set; }
public bool Unsubscribed { get; set; }
public DbTenant Tenant { get; set; }
public override object[] GetKeys()
{
return new object[] { Tenant, Source, Action, Recipient, Object };
return new object[] { TenantId, Source, Action, Recipient, Object };
}
}
@ -45,31 +47,33 @@ public static class SubscriptionExtension
{
public static ModelBuilderWrapper AddSubscription(this ModelBuilderWrapper modelBuilder)
{
modelBuilder.Entity<Subscription>().Navigation(e => e.Tenant).AutoInclude(false);
modelBuilder
.Add(MySqlAddSubscription, Provider.MySql)
.Add(PgSqlAddSubscription, Provider.PostgreSql)
.HasData(
new Subscription { Source = "asc.web.studio", Action = "send_whats_new", Recipient = "c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e", Object = "", Tenant = -1 },
new Subscription { Source = "asc.web.studio", Action = "rooms_activity", Recipient = "c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e", Object = "", Tenant = -1 },
new Subscription { Source = "6504977c-75af-4691-9099-084d3ddeea04", Action = "new feed", Recipient = "c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e", Object = "", Tenant = -1 },
new Subscription { Source = "6a598c74-91ae-437d-a5f4-ad339bd11bb2", Action = "new post", Recipient = "c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e", Object = "", Tenant = -1 },
new Subscription { Source = "853b6eb9-73ee-438d-9b09-8ffeedf36234", Action = "new topic in forum", Recipient = "c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e", Object = "", Tenant = -1 },
new Subscription { Source = "9d51954f-db9b-4aed-94e3-ed70b914e101", Action = "new photo uploaded", Recipient = "c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e", Object = "", Tenant = -1 },
new Subscription { Source = "28b10049-dd20-4f54-b986-873bc14ccfc7", Action = "new bookmark created", Recipient = "c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e", Object = "", Tenant = -1 },
new Subscription { Source = "742cf945-cbbc-4a57-82d6-1600a12cf8ca", Action = "new wiki page", Recipient = "c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e", Object = "", Tenant = -1 },
new Subscription { Source = "37620ae5-c40b-45ce-855a-39dd7d76a1fa", Action = "BirthdayReminder", Recipient = "abef62db-11a8-4673-9d32-ef1d8af19dc0", Object = "", Tenant = -1 },
new Subscription { Source = "6fe286a4-479e-4c25-a8d9-0156e332b0c0", Action = "sharedocument", Recipient = "c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e", Object = "", Tenant = -1 },
new Subscription { Source = "6fe286a4-479e-4c25-a8d9-0156e332b0c0", Action = "sharefolder", Recipient = "c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e", Object = "", Tenant = -1 },
new Subscription { Source = "40650da3-f7c1-424c-8c89-b9c115472e08", Action = "calendar_sharing", Recipient = "c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e", Object = "", Tenant = -1 },
new Subscription { Source = "40650da3-f7c1-424c-8c89-b9c115472e08", Action = "event_alert", Recipient = "c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e", Object = "", Tenant = -1 },
new Subscription { Source = "asc.web.studio", Action = "admin_notify", Recipient = "cd84e66b-b803-40fc-99f9-b2969a54a1de", Object = "", Tenant = -1 },
new Subscription { Source = "13ff36fb-0272-4887-b416-74f52b0d0b02", Action = "SetAccess", Recipient = "abef62db-11a8-4673-9d32-ef1d8af19dc0", Object = "", Tenant = -1 },
new Subscription { Source = "13ff36fb-0272-4887-b416-74f52b0d0b02", Action = "ResponsibleForTask", Recipient = "abef62db-11a8-4673-9d32-ef1d8af19dc0", Object = "", Tenant = -1 },
new Subscription { Source = "13ff36fb-0272-4887-b416-74f52b0d0b02", Action = "AddRelationshipEvent", Recipient = "abef62db-11a8-4673-9d32-ef1d8af19dc0", Object = "", Tenant = -1 },
new Subscription { Source = "13ff36fb-0272-4887-b416-74f52b0d0b02", Action = "ExportCompleted", Recipient = "abef62db-11a8-4673-9d32-ef1d8af19dc0", Object = "", Tenant = -1 },
new Subscription { Source = "13ff36fb-0272-4887-b416-74f52b0d0b02", Action = "CreateNewContact", Recipient = "abef62db-11a8-4673-9d32-ef1d8af19dc0", Object = "", Tenant = -1 },
new Subscription { Source = "13ff36fb-0272-4887-b416-74f52b0d0b02", Action = "ResponsibleForOpportunity", Recipient = "abef62db-11a8-4673-9d32-ef1d8af19dc0", Object = "", Tenant = -1 },
new Subscription { Source = "asc.web.studio", Action = "periodic_notify", Recipient = "c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e", Object = "", Tenant = -1 }
new Subscription { Source = "asc.web.studio", Action = "send_whats_new", Recipient = "c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e", Object = "", TenantId = -1 },
new Subscription { Source = "asc.web.studio", Action = "rooms_activity", Recipient = "c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e", Object = "", TenantId = -1 },
new Subscription { Source = "6504977c-75af-4691-9099-084d3ddeea04", Action = "new feed", Recipient = "c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e", Object = "", TenantId = -1 },
new Subscription { Source = "6a598c74-91ae-437d-a5f4-ad339bd11bb2", Action = "new post", Recipient = "c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e", Object = "", TenantId = -1 },
new Subscription { Source = "853b6eb9-73ee-438d-9b09-8ffeedf36234", Action = "new topic in forum", Recipient = "c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e", Object = "", TenantId = -1 },
new Subscription { Source = "9d51954f-db9b-4aed-94e3-ed70b914e101", Action = "new photo uploaded", Recipient = "c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e", Object = "", TenantId = -1 },
new Subscription { Source = "28b10049-dd20-4f54-b986-873bc14ccfc7", Action = "new bookmark created", Recipient = "c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e", Object = "", TenantId = -1 },
new Subscription { Source = "742cf945-cbbc-4a57-82d6-1600a12cf8ca", Action = "new wiki page", Recipient = "c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e", Object = "", TenantId = -1 },
new Subscription { Source = "37620ae5-c40b-45ce-855a-39dd7d76a1fa", Action = "BirthdayReminder", Recipient = "abef62db-11a8-4673-9d32-ef1d8af19dc0", Object = "", TenantId = -1 },
new Subscription { Source = "6fe286a4-479e-4c25-a8d9-0156e332b0c0", Action = "sharedocument", Recipient = "c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e", Object = "", TenantId = -1 },
new Subscription { Source = "6fe286a4-479e-4c25-a8d9-0156e332b0c0", Action = "sharefolder", Recipient = "c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e", Object = "", TenantId = -1 },
new Subscription { Source = "40650da3-f7c1-424c-8c89-b9c115472e08", Action = "calendar_sharing", Recipient = "c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e", Object = "", TenantId = -1 },
new Subscription { Source = "40650da3-f7c1-424c-8c89-b9c115472e08", Action = "event_alert", Recipient = "c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e", Object = "", TenantId = -1 },
new Subscription { Source = "asc.web.studio", Action = "admin_notify", Recipient = "cd84e66b-b803-40fc-99f9-b2969a54a1de", Object = "", TenantId = -1 },
new Subscription { Source = "13ff36fb-0272-4887-b416-74f52b0d0b02", Action = "SetAccess", Recipient = "abef62db-11a8-4673-9d32-ef1d8af19dc0", Object = "", TenantId = -1 },
new Subscription { Source = "13ff36fb-0272-4887-b416-74f52b0d0b02", Action = "ResponsibleForTask", Recipient = "abef62db-11a8-4673-9d32-ef1d8af19dc0", Object = "", TenantId = -1 },
new Subscription { Source = "13ff36fb-0272-4887-b416-74f52b0d0b02", Action = "AddRelationshipEvent", Recipient = "abef62db-11a8-4673-9d32-ef1d8af19dc0", Object = "", TenantId = -1 },
new Subscription { Source = "13ff36fb-0272-4887-b416-74f52b0d0b02", Action = "ExportCompleted", Recipient = "abef62db-11a8-4673-9d32-ef1d8af19dc0", Object = "", TenantId = -1 },
new Subscription { Source = "13ff36fb-0272-4887-b416-74f52b0d0b02", Action = "CreateNewContact", Recipient = "abef62db-11a8-4673-9d32-ef1d8af19dc0", Object = "", TenantId = -1 },
new Subscription { Source = "13ff36fb-0272-4887-b416-74f52b0d0b02", Action = "ResponsibleForOpportunity", Recipient = "abef62db-11a8-4673-9d32-ef1d8af19dc0", Object = "", TenantId = -1 },
new Subscription { Source = "asc.web.studio", Action = "periodic_notify", Recipient = "c5cc67d1-c3e8-43c0-a3ad-3928ae3e5b5e", Object = "", TenantId = -1 }
);
return modelBuilder;
@ -79,13 +83,13 @@ public static class SubscriptionExtension
{
modelBuilder.Entity<Subscription>(entity =>
{
entity.HasKey(e => new { e.Tenant, e.Source, e.Action, e.Recipient, e.Object })
entity.HasKey(e => new { e.TenantId, e.Source, e.Action, e.Recipient, e.Object })
.HasName("PRIMARY");
entity.ToTable("core_subscription")
.HasCharSet("utf8");
entity.Property(e => e.Tenant).HasColumnName("tenant");
entity.Property(e => e.TenantId).HasColumnName("tenant");
entity.Property(e => e.Source)
.HasColumnName("source")
@ -122,12 +126,12 @@ public static class SubscriptionExtension
{
modelBuilder.Entity<Subscription>(entity =>
{
entity.HasKey(e => new { e.Tenant, e.Source, e.Action, e.Recipient, e.Object })
entity.HasKey(e => new { e.TenantId, e.Source, e.Action, e.Recipient, e.Object })
.HasName("core_subscription_pkey");
entity.ToTable("core_subscription", "onlyoffice");
entity.Property(e => e.Tenant).HasColumnName("tenant");
entity.Property(e => e.TenantId).HasColumnName("tenant");
entity.Property(e => e.Source)
.HasColumnName("source")

View File

@ -32,6 +32,9 @@ public class DbWebstudioSettings : BaseEntity
public Guid Id { get; set; }
public Guid UserId { get; set; }
public string Data { get; set; }
public DbTenant Tenant { get; set; }
public override object[] GetKeys()
{
return new object[] { TenantId, Id, UserId };
@ -42,6 +45,8 @@ public static class WebstudioSettingsExtension
{
public static ModelBuilderWrapper AddWebstudioSettings(this ModelBuilderWrapper modelBuilder)
{
modelBuilder.Entity<DbWebstudioSettings>().Navigation(e => e.Tenant).AutoInclude(false);
modelBuilder
.Add(MySqlAddWebstudioSettings, Provider.MySql)
.Add(PgSqlAddWebstudioSettings, Provider.PostgreSql)

View File

@ -35,12 +35,16 @@ public class DbWebstudioUserVisit
public int VisitCount { get; set; }
public DateTime? FirstVisitTime { get; set; }
public DateTime? LastVisitTime { get; set; }
public DbTenant Tenant { get; set; }
}
public static class WebstudioUserVisitExtension
{
public static ModelBuilderWrapper AddWebstudioUserVisit(this ModelBuilderWrapper modelBuilder)
{
modelBuilder.Entity<DbWebstudioUserVisit>().Navigation(e => e.Tenant).AutoInclude(false);
modelBuilder
.Add(MySqlAddWebstudioUserVisit, Provider.MySql)
.Add(PgSqlAddWebstudioUserVisit, Provider.PostgreSql);

View File

@ -40,11 +40,15 @@ public class NotifyQueue
public DateTime CreationDate { get; set; }
public string Attachments { get; set; }
public string AutoSubmitted { get; set; }
public DbTenant Tenant { get; set; }
}
public static class NotifyQueueExtension
{
public static ModelBuilderWrapper AddNotifyQueue(this ModelBuilderWrapper modelBuilder)
{
modelBuilder.Entity<NotifyQueue>().Navigation(e => e.Tenant).AutoInclude(false);
modelBuilder
.Add(MySqlAddNotifyQueue, Provider.MySql)
.Add(PgSqlAddNotifyQueue, Provider.PostgreSql);

View File

@ -31,6 +31,9 @@ public class TelegramUser : BaseEntity
public Guid PortalUserId { get; set; }
public int TenantId { get; set; }
public long TelegramUserId { get; set; }
public DbTenant Tenant { get; set; }
public override object[] GetKeys()
{
return new object[] { TenantId, PortalUserId };
@ -41,6 +44,8 @@ public static class TelegramUsersExtension
{
public static ModelBuilderWrapper AddTelegramUsers(this ModelBuilderWrapper modelBuilder)
{
modelBuilder.Entity<TelegramUser>().Navigation(e => e.Tenant).AutoInclude(false);
modelBuilder
.Add(MySqlAddTelegramUsers, Provider.MySql)
.Add(PgSqlAddTelegramUsers, Provider.PostgreSql);

View File

@ -28,7 +28,7 @@ namespace ASC.Core.Common.EF;
public class DbQuota : BaseEntity, IMapFrom<TenantQuota>
{
public int Tenant { get; set; }
public int TenantId { get; set; }
public string Name { get; set; }
public string Description { get; set; }
public string Features { get; set; }
@ -38,7 +38,7 @@ public class DbQuota : BaseEntity, IMapFrom<TenantQuota>
public override object[] GetKeys()
{
return new object[] { Tenant };
return new object[] { TenantId };
}
public void Mapping(Profile profile)
@ -56,7 +56,7 @@ public static class DbQuotaExtension
.HasData(
new DbQuota
{
Tenant = -1,
TenantId = -1,
Name = "trial",
Description = null,
Features = "trial,audit,ldap,sso,whitelabel,thirdparty,restore,oauth,total_size:107374182400,file_size:100,manager:1",
@ -66,7 +66,7 @@ public static class DbQuotaExtension
},
new DbQuota
{
Tenant = -2,
TenantId = -2,
Name = "admin",
Description = null,
Features = "audit,ldap,sso,whitelabel,thirdparty,restore,oauth,contentsearch,total_size:107374182400,file_size:1024,manager:1",
@ -76,7 +76,7 @@ public static class DbQuotaExtension
},
new DbQuota
{
Tenant = -3,
TenantId = -3,
Name = "startup",
Description = null,
Features = "free,total_size:2147483648,manager:3,room:12",
@ -93,13 +93,13 @@ public static class DbQuotaExtension
{
modelBuilder.Entity<DbQuota>(entity =>
{
entity.HasKey(e => e.Tenant)
entity.HasKey(e => e.TenantId)
.HasName("PRIMARY");
entity.ToTable("tenants_quota")
.HasCharSet("utf8");
entity.Property(e => e.Tenant)
entity.Property(e => e.TenantId)
.HasColumnName("tenant")
.ValueGeneratedNever();
@ -140,12 +140,12 @@ public static class DbQuotaExtension
{
modelBuilder.Entity<DbQuota>(entity =>
{
entity.HasKey(e => e.Tenant)
entity.HasKey(e => e.TenantId)
.HasName("tenants_quota_pkey");
entity.ToTable("tenants_quota", "onlyoffice");
entity.Property(e => e.Tenant)
entity.Property(e => e.TenantId)
.HasColumnName("tenant")
.ValueGeneratedNever();

View File

@ -28,15 +28,18 @@ namespace ASC.Core.Common.EF;
public class DbQuotaRow : BaseEntity, IMapFrom<TenantQuotaRow>
{
public int Tenant { get; set; }
public int TenantId { get; set; }
public string Path { get; set; }
public long Counter { get; set; }
public string Tag { get; set; }
public DateTime LastModified { get; set; }
public Guid UserId { get; set; }
public DbTenant Tenant { get; set; }
public override object[] GetKeys()
{
return new object[] { Tenant, UserId, Path };
return new object[] { TenantId, UserId, Path };
}
}
@ -44,6 +47,8 @@ public static class DbQuotaRowExtension
{
public static ModelBuilderWrapper AddDbQuotaRow(this ModelBuilderWrapper modelBuilder)
{
modelBuilder.Entity<DbQuotaRow>().Navigation(e => e.Tenant).AutoInclude(false);
modelBuilder
.Add(MySqlAddDbQuotaRow, Provider.MySql)
.Add(PgSqlAddDbQuotaRow, Provider.PostgreSql);
@ -55,7 +60,7 @@ public static class DbQuotaRowExtension
{
modelBuilder.Entity<DbQuotaRow>(entity =>
{
entity.HasKey(e => new { e.Tenant, e.UserId, e.Path })
entity.HasKey(e => new { e.TenantId, e.UserId, e.Path })
.HasName("PRIMARY");
entity.ToTable("tenants_quotarow")
@ -64,7 +69,7 @@ public static class DbQuotaRowExtension
entity.HasIndex(e => e.LastModified)
.HasDatabaseName("last_modified");
entity.Property(e => e.Tenant).HasColumnName("tenant");
entity.Property(e => e.TenantId).HasColumnName("tenant");
entity.Property(e => e.Path)
.HasColumnName("path")
@ -97,7 +102,7 @@ public static class DbQuotaRowExtension
{
modelBuilder.Entity<DbQuotaRow>(entity =>
{
entity.HasKey(e => new { e.Tenant, e.Path })
entity.HasKey(e => new { e.TenantId, e.Path })
.HasName("tenants_quotarow_pkey");
entity.ToTable("tenants_quotarow", "onlyoffice");
@ -105,7 +110,7 @@ public static class DbQuotaRowExtension
entity.HasIndex(e => e.LastModified)
.HasDatabaseName("last_modified_tenants_quotarow");
entity.Property(e => e.Tenant).HasColumnName("tenant");
entity.Property(e => e.TenantId).HasColumnName("tenant");
entity.Property(e => e.Path)
.HasColumnName("path")

View File

@ -29,12 +29,14 @@ namespace ASC.Core.Common.EF;
public class DbTariff : BaseEntity
{
public int Id { get; set; }
public int Tenant { get; set; }
public int TenantId { get; set; }
public DateTime Stamp { get; set; }
public string CustomerId { get; set; }
public string Comment { get; set; }
public DateTime CreateOn { get; set; }
public DbTenant Tenant { get; set; }
public override object[] GetKeys()
{
return new object[] { Id };
@ -45,6 +47,8 @@ public static class DbTariffExtension
{
public static ModelBuilderWrapper AddDbTariff(this ModelBuilderWrapper modelBuilder)
{
modelBuilder.Entity<DbTariff>().Navigation(e => e.Tenant).AutoInclude(false);
modelBuilder
.Add(MySqlAddDbTariff, Provider.MySql)
.Add(PgSqlAddDbTariff, Provider.PostgreSql);
@ -58,7 +62,7 @@ public static class DbTariffExtension
entity.ToTable("tenants_tariff")
.HasCharSet("utf8");
entity.HasIndex(e => e.Tenant)
entity.HasIndex(e => e.TenantId)
.HasDatabaseName("tenant");
entity.Property(e => e.Id).HasColumnName("id");
@ -84,7 +88,7 @@ public static class DbTariffExtension
.HasCharSet("utf8")
.UseCollation("utf8_general_ci");
entity.Property(e => e.Tenant).HasColumnName("tenant");
entity.Property(e => e.TenantId).HasColumnName("tenant");
});
}
public static void PgSqlAddDbTariff(this ModelBuilder modelBuilder)
@ -93,7 +97,7 @@ public static class DbTariffExtension
{
entity.ToTable("tenants_tariff", "onlyoffice");
entity.HasIndex(e => e.Tenant)
entity.HasIndex(e => e.TenantId)
.HasDatabaseName("tenant_tenants_tariff");
entity.Property(e => e.Id).HasColumnName("id");
@ -115,7 +119,7 @@ public static class DbTariffExtension
.HasMaxLength(255)
.HasDefaultValueSql("NULL");
entity.Property(e => e.Tenant).HasColumnName("tenant");
entity.Property(e => e.TenantId).HasColumnName("tenant");
});
}
}

View File

@ -31,17 +31,21 @@ public class DbTariffRow : BaseEntity
public int TariffId { get; set; }
public int Quota { get; set; }
public int Quantity { get; set; }
public int Tenant { get; set; }
public int TenantId { get; set; }
public DbTenant Tenant { get; set; }
public override object[] GetKeys()
{
return new object[] { Tenant, TariffId, Quota };
return new object[] { TenantId, TariffId, Quota };
}
}
public static class DbTariffRowExtension
{
public static ModelBuilderWrapper AddDbTariffRow(this ModelBuilderWrapper modelBuilder)
{
{
modelBuilder.Entity<DbTariffRow>().Navigation(e => e.Tenant).AutoInclude(false);
modelBuilder
.Add(MySqlAddDbTariffRow, Provider.MySql)
.Add(PgSqlAddDbTariffRow, Provider.PostgreSql);
@ -55,7 +59,7 @@ public static class DbTariffRowExtension
{
entity.ToTable("tenants_tariffrow");
entity.HasKey(e => new { e.Tenant, e.TariffId, e.Quota })
entity.HasKey(e => new { e.TenantId, e.TariffId, e.Quota })
.HasName("PRIMARY");
entity.Property(e => e.TariffId)
@ -70,7 +74,7 @@ public static class DbTariffRowExtension
.HasColumnName("quantity")
.HasColumnType("int");
entity.Property(e => e.Tenant)
entity.Property(e => e.TenantId)
.HasColumnName("tenant")
.HasColumnType("int");
});
@ -82,7 +86,7 @@ public static class DbTariffRowExtension
{
entity.ToTable("tenants_tariffrow", "onlyoffice");
entity.HasKey(e => new { e.Tenant, e.TariffId, e.Quota })
entity.HasKey(e => new { e.TenantId, e.TariffId, e.Quota })
.HasName("PRIMARY");
entity.Property(e => e.TariffId)
@ -97,7 +101,7 @@ public static class DbTariffRowExtension
.HasColumnName("quantity")
.HasColumnType("int");
entity.Property(e => e.Tenant)
entity.Property(e => e.TenantId)
.HasColumnName("tenant")
.HasColumnType("int");
});

View File

@ -92,7 +92,18 @@ public static class DbTenantExtension
OwnerId = Guid.Parse("66faa6e4-f133-11ea-b126-00ffeec8b4ef"),
LastModified = new DateTime(2022, 7, 8)
}
);
)
.HasData(
new DbTenant
{
Id = -1,
Alias = "settings",
Name = "Web Office",
CreationDateTime = new DateTime(2021, 3, 9, 17, 46, 59, 97, DateTimeKind.Utc).AddTicks(4317),
OwnerId = Guid.Parse("00000000-0000-0000-0000-000000000000"),
LastModified = new DateTime(2022, 7, 8),
Status = TenantStatus.Suspended
});
return modelBuilder;
}

View File

@ -29,15 +29,19 @@ namespace ASC.Core.Common.EF.Model;
public class TenantIpRestrictions
{
public int Id { get; set; }
public int Tenant { get; set; }
public int TenantId { get; set; }
public string Ip { get; set; }
public bool ForAdmin { get; set; }
public DbTenant Tenant { get; set; }
}
public static class TenantIpRestrictionsExtension
{
public static ModelBuilderWrapper AddTenantIpRestrictions(this ModelBuilderWrapper modelBuilder)
{
modelBuilder.Entity<TenantIpRestrictions>().Navigation(e => e.Tenant).AutoInclude(false);
modelBuilder
.Add(MySqlAddTenantIpRestrictions, Provider.MySql)
.Add(PgSqlAddTenantIpRestrictions, Provider.PostgreSql);
@ -52,7 +56,7 @@ public static class TenantIpRestrictionsExtension
entity.ToTable("tenants_iprestrictions")
.HasCharSet("utf8");
entity.HasIndex(e => e.Tenant)
entity.HasIndex(e => e.TenantId)
.HasDatabaseName("tenant");
entity.Property(e => e.Id).HasColumnName("id");
@ -69,7 +73,7 @@ public static class TenantIpRestrictionsExtension
.HasColumnName("for_admin")
.HasColumnType("TINYINT(1)");
entity.Property(e => e.Tenant).HasColumnName("tenant");
entity.Property(e => e.TenantId).HasColumnName("tenant");
});
}
@ -79,7 +83,7 @@ public static class TenantIpRestrictionsExtension
{
entity.ToTable("tenants_iprestrictions", "onlyoffice");
entity.HasIndex(e => e.Tenant)
entity.HasIndex(e => e.TenantId)
.HasDatabaseName("tenant_tenants_iprestrictions");
entity.Property(e => e.Id).HasColumnName("id");
@ -94,7 +98,7 @@ public static class TenantIpRestrictionsExtension
.HasColumnName("for_admin")
.HasColumnType("TINYINT(1)");
entity.Property(e => e.Tenant).HasColumnName("tenant");
entity.Property(e => e.TenantId).HasColumnName("tenant");
});
}

View File

@ -28,7 +28,7 @@ namespace ASC.Core.Common.EF;
public class DbGroup : BaseEntity, IMapFrom<Group>
{
public int Tenant { get; set; }
public int TenantId { get; set; }
public Guid Id { get; set; }
public string Name { get; set; }
public Guid? CategoryId { get; set; }
@ -37,6 +37,8 @@ public class DbGroup : BaseEntity, IMapFrom<Group>
public bool Removed { get; set; }
public DateTime LastModified { get; set; }
public DbTenant Tenant { get; set; }
public override object[] GetKeys()
{
return new object[] { Id };
@ -47,6 +49,8 @@ public static class DbGroupExtension
{
public static ModelBuilderWrapper AddDbGroup(this ModelBuilderWrapper modelBuilder)
{
modelBuilder.Entity<DbGroup>().Navigation(e => e.Tenant).AutoInclude(false);
modelBuilder
.Add(MySqlAddDbGroup, Provider.MySql)
.Add(PgSqlAddDbGroup, Provider.PostgreSql);
@ -64,7 +68,7 @@ public static class DbGroupExtension
entity.HasIndex(e => e.LastModified)
.HasDatabaseName("last_modified");
entity.HasIndex(e => new { e.Tenant, e.ParentId })
entity.HasIndex(e => new { e.TenantId, e.ParentId })
.HasDatabaseName("parentid");
entity.Property(e => e.Id)
@ -107,7 +111,7 @@ public static class DbGroupExtension
.HasCharSet("utf8")
.UseCollation("utf8_general_ci");
entity.Property(e => e.Tenant).HasColumnName("tenant");
entity.Property(e => e.TenantId).HasColumnName("tenant");
});
}
private static void PgSqlAddDbGroup(this ModelBuilder modelBuilder)
@ -119,7 +123,7 @@ public static class DbGroupExtension
entity.HasIndex(e => e.LastModified)
.HasDatabaseName("last_modified");
entity.HasIndex(e => new { e.Tenant, e.ParentId })
entity.HasIndex(e => new { e.TenantId, e.ParentId })
.HasDatabaseName("parentid");
entity.Property(e => e.Id)
@ -152,7 +156,7 @@ public static class DbGroupExtension
.HasMaxLength(512)
.HasDefaultValueSql("NULL");
entity.Property(e => e.Tenant).HasColumnName("tenant");
entity.Property(e => e.TenantId).HasColumnName("tenant");
});
}
}

View File

@ -28,7 +28,7 @@ namespace ASC.Core.Common.EF;
public class User : BaseEntity, IMapFrom<UserInfo>
{
public int Tenant { get; set; }
public int TenantId { get; set; }
public string UserName { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
@ -54,6 +54,8 @@ public class User : BaseEntity, IMapFrom<UserInfo>
public DateTime CreateDate { get; set; }
public DateTime LastModified { get; set; }
public DbTenant Tenant { get; set; }
public override object[] GetKeys()
{
return new object[] { Id };
@ -64,6 +66,8 @@ public static class DbUserExtension
{
public static ModelBuilderWrapper AddUser(this ModelBuilderWrapper modelBuilder)
{
modelBuilder.Entity<User>().Navigation(e => e.Tenant).AutoInclude(false);
modelBuilder
.Add(MySqlAddUser, Provider.MySql)
.Add(PgSqlAddUser, Provider.PostgreSql)
@ -74,7 +78,7 @@ public static class DbUserExtension
FirstName = "Administrator",
LastName = "",
UserName = "administrator",
Tenant = 1,
TenantId = 1,
Email = "",
Status = (EmployeeStatus)1,
ActivationStatus = 0,
@ -102,7 +106,7 @@ public static class DbUserExtension
entity.HasIndex(e => e.LastModified)
.HasDatabaseName("last_modified");
entity.HasIndex(e => new { e.Tenant, e.UserName })
entity.HasIndex(e => new { e.TenantId, e.UserName })
.HasDatabaseName("username");
entity.Property(e => e.Id)
@ -213,7 +217,7 @@ public static class DbUserExtension
.HasColumnName("status")
.HasDefaultValueSql("'1'");
entity.Property(e => e.Tenant).HasColumnName("tenant");
entity.Property(e => e.TenantId).HasColumnName("tenant");
entity.Property(e => e.TerminatedDate)
.HasColumnName("terminateddate")
@ -251,7 +255,7 @@ public static class DbUserExtension
entity.HasIndex(e => e.LastModified)
.HasDatabaseName("last_modified_core_user");
entity.HasIndex(e => new { e.UserName, e.Tenant })
entity.HasIndex(e => new { e.UserName, e.TenantId })
.HasDatabaseName("username");
entity.Property(e => e.Id)
@ -333,7 +337,7 @@ public static class DbUserExtension
.HasColumnName("status")
.HasDefaultValueSql("1");
entity.Property(e => e.Tenant).HasColumnName("tenant");
entity.Property(e => e.TenantId).HasColumnName("tenant");
entity.Property(e => e.TerminatedDate).HasColumnName("terminateddate");

View File

@ -30,6 +30,8 @@ public class UserDav : BaseEntity
public int TenantId { get; set; }
public Guid UserId { get; set; }
public DbTenant Tenant { get; set; }
public override object[] GetKeys()
{
return new object[] { TenantId, UserId };
@ -40,6 +42,8 @@ public static class UserDavExtension
{
public static ModelBuilderWrapper AddUserDav(this ModelBuilderWrapper modelBuilder)
{
modelBuilder.Entity<UserDav>().Navigation(e => e.Tenant).AutoInclude(false);
modelBuilder
.Add(MySqlAddUserDav, Provider.MySql)
.Add(PgSqlAddUserDav, Provider.PostgreSql);

View File

@ -28,15 +28,18 @@ namespace ASC.Core.Common.EF;
public class UserGroup : BaseEntity, IMapFrom<UserGroupRef>
{
public int Tenant { get; set; }
public int TenantId { get; set; }
public Guid Userid { get; set; }
public Guid UserGroupId { get; set; }
public UserGroupRefType RefType { get; set; }
public bool Removed { get; set; }
public DateTime LastModified { get; set; }
public DbTenant Tenant { get; set; }
public override object[] GetKeys()
{
return new object[] { Tenant, Userid, UserGroupId, RefType };
return new object[] { TenantId, Userid, UserGroupId, RefType };
}
public void Mapping(Profile profile)
{
@ -49,13 +52,15 @@ public static class DbUserGroupExtension
{
public static ModelBuilderWrapper AddUserGroup(this ModelBuilderWrapper modelBuilder)
{
modelBuilder.Entity<UserGroup>().Navigation(e => e.Tenant).AutoInclude(false);
modelBuilder
.Add(MySqlAddUserGroup, Provider.MySql)
.Add(PgSqlAddUserGroup, Provider.PostgreSql)
.HasData(
new UserGroup
{
Tenant = 1,
TenantId = 1,
Userid = Guid.Parse("66faa6e4-f133-11ea-b126-00ffeec8b4ef"),
UserGroupId = Guid.Parse("cd84e66b-b803-40fc-99f9-b2969a54a1de"),
RefType = 0,
@ -70,7 +75,7 @@ public static class DbUserGroupExtension
{
modelBuilder.Entity<UserGroup>(entity =>
{
entity.HasKey(e => new { e.Tenant, e.Userid, e.UserGroupId, e.RefType })
entity.HasKey(e => new { e.TenantId, e.Userid, e.UserGroupId, e.RefType })
.HasName("PRIMARY");
entity.ToTable("core_usergroup")
@ -79,7 +84,7 @@ public static class DbUserGroupExtension
entity.HasIndex(e => e.LastModified)
.HasDatabaseName("last_modified");
entity.Property(e => e.Tenant).HasColumnName("tenant");
entity.Property(e => e.TenantId).HasColumnName("tenant");
entity.Property(e => e.Userid)
.HasColumnName("userid")
@ -109,7 +114,7 @@ public static class DbUserGroupExtension
{
modelBuilder.Entity<UserGroup>(entity =>
{
entity.HasKey(e => new { e.Tenant, e.Userid, e.UserGroupId, e.RefType })
entity.HasKey(e => new { e.TenantId, e.Userid, e.UserGroupId, e.RefType })
.HasName("core_usergroup_pkey");
entity.ToTable("core_usergroup", "onlyoffice");
@ -117,7 +122,7 @@ public static class DbUserGroupExtension
entity.HasIndex(e => e.LastModified)
.HasDatabaseName("last_modified_core_usergroup");
entity.Property(e => e.Tenant).HasColumnName("tenant");
entity.Property(e => e.TenantId).HasColumnName("tenant");
entity.Property(e => e.Userid)
.HasColumnName("userid")

View File

@ -28,9 +28,12 @@ namespace ASC.Core.Common.EF;
public class UserPhoto : BaseEntity
{
public int Tenant { get; set; }
public int TenantId { get; set; }
public Guid UserId { get; set; }
public byte[] Photo { get; set; }
public DbTenant Tenant { get; set; }
public override object[] GetKeys()
{
return new object[] { UserId };
@ -40,6 +43,8 @@ public static class UserPhotoExtension
{
public static ModelBuilderWrapper AddUserPhoto(this ModelBuilderWrapper modelBuilder)
{
modelBuilder.Entity<UserPhoto>().Navigation(e => e.Tenant).AutoInclude(false);
modelBuilder
.Add(MySqlAddUserPhoto, Provider.MySql)
.Add(PgSqlAddUserPhoto, Provider.PostgreSql);
@ -56,7 +61,7 @@ public static class UserPhotoExtension
entity.ToTable("core_userphoto")
.HasCharSet("utf8");
entity.HasIndex(e => e.Tenant)
entity.HasIndex(e => e.TenantId)
.HasDatabaseName("tenant");
entity.Property(e => e.UserId)
@ -70,7 +75,7 @@ public static class UserPhotoExtension
.HasColumnName("photo")
.HasColumnType("mediumblob");
entity.Property(e => e.Tenant).HasColumnName("tenant");
entity.Property(e => e.TenantId).HasColumnName("tenant");
});
}
public static void PgSqlAddUserPhoto(this ModelBuilder modelBuilder)
@ -82,7 +87,7 @@ public static class UserPhotoExtension
entity.ToTable("core_userphoto", "onlyoffice");
entity.HasIndex(e => e.Tenant)
entity.HasIndex(e => e.TenantId)
.HasDatabaseName("tenant_core_userphoto");
entity.Property(e => e.UserId)
@ -93,7 +98,7 @@ public static class UserPhotoExtension
.IsRequired()
.HasColumnName("photo");
entity.Property(e => e.Tenant).HasColumnName("tenant");
entity.Property(e => e.TenantId).HasColumnName("tenant");
});
}
}

View File

@ -28,10 +28,13 @@ namespace ASC.Core.Common.EF;
public class UserSecurity : BaseEntity
{
public int Tenant { get; set; }
public int TenantId { get; set; }
public Guid UserId { get; set; }
public string PwdHash { get; set; }
public DateTime? LastModified { get; set; }
public DbTenant Tenant { get; set; }
public override object[] GetKeys()
{
return new object[] { UserId };
@ -42,13 +45,15 @@ public static class UserSecurityExtension
{
public static ModelBuilderWrapper AddUserSecurity(this ModelBuilderWrapper modelBuilder)
{
modelBuilder.Entity<UserSecurity>().Navigation(e => e.Tenant).AutoInclude(false);
modelBuilder
.Add(MySqlAddUserSecurity, Provider.MySql)
.Add(PgSqlAddUserSecurity, Provider.PostgreSql)
.HasData(
new UserSecurity
{
Tenant = 1,
TenantId = 1,
UserId = Guid.Parse("66faa6e4-f133-11ea-b126-00ffeec8b4ef"),
PwdHash = "jGl25bVBBBW96Qi9Te4V37Fnqchz/Eu4qB9vKrRIqRg=",
LastModified = new DateTime(2022, 7, 8)
@ -70,7 +75,7 @@ public static class UserSecurityExtension
entity.HasIndex(e => e.PwdHash)
.HasDatabaseName("pwdhash");
entity.HasIndex(e => e.Tenant)
entity.HasIndex(e => e.TenantId)
.HasDatabaseName("tenant");
entity.Property(e => e.UserId)
@ -89,7 +94,7 @@ public static class UserSecurityExtension
.HasCharSet("utf8")
.UseCollation("utf8_general_ci");
entity.Property(e => e.Tenant).HasColumnName("tenant");
entity.Property(e => e.TenantId).HasColumnName("tenant");
});
}
public static void PgSqlAddUserSecurity(this ModelBuilder modelBuilder)
@ -104,7 +109,7 @@ public static class UserSecurityExtension
entity.HasIndex(e => e.PwdHash)
.HasDatabaseName("pwdhash");
entity.HasIndex(e => e.Tenant)
entity.HasIndex(e => e.TenantId)
.HasDatabaseName("tenant_core_usersecurity");
entity.Property(e => e.UserId)
@ -118,7 +123,7 @@ public static class UserSecurityExtension
.HasMaxLength(512)
.HasDefaultValueSql("NULL");
entity.Property(e => e.Tenant).HasColumnName("tenant");
entity.Property(e => e.TenantId).HasColumnName("tenant");
});
}
}

View File

@ -78,7 +78,7 @@ public class HostedSolution
public async Task<List<Tenant>> FindTenantsAsync(string login, string passwordHash = null)
{
if (!string.IsNullOrEmpty(passwordHash) && await UserService.GetUserByPasswordHashAsync(Tenant.DefaultTenant, login, passwordHash) == null)
{
{
throw new SecurityException("Invalid login or password.");
}
@ -229,7 +229,7 @@ public class HostedSolution
var quota = (await QuotaService.GetTenantQuotasAsync()).FirstOrDefault(q => paid ? q.NonProfit : q.Trial);
if (quota != null)
{
await TariffService.SetTariffAsync(tenant, new Tariff { Quotas = new List<Quota> { new Quota(quota.Tenant, 1) }, DueDate = DateTime.MaxValue, });
await TariffService.SetTariffAsync(tenant, new Tariff { Quotas = new List<Quota> { new Quota(quota.TenantId, 1) }, DueDate = DateTime.MaxValue, });
}
}

View File

@ -1,31 +1,31 @@
// (c) Copyright Ascensio System SIA 2010-2022
//
// This program is a free software product.
// You can redistribute it and/or modify it under the terms
// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software
// Foundation. In accordance with Section 7(a) of the GNU AGPL 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 details, see
// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
//
// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021.
//
// The interactive user interfaces in modified source and object code versions of the Program must
// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3.
//
// Pursuant to Section 7(b) of the License you must retain the original Product logo when
// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under
// trademark law for use of our trademarks.
//
// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
// (c) Copyright Ascensio System SIA 2010-2022
//
// This program is a free software product.
// You can redistribute it and/or modify it under the terms
// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software
// Foundation. In accordance with Section 7(a) of the GNU AGPL 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 details, see
// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
//
// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021.
//
// The interactive user interfaces in modified source and object code versions of the Program must
// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3.
//
// Pursuant to Section 7(b) of the License you must retain the original Product logo when
// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under
// trademark law for use of our trademarks.
//
// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
namespace ASC.Core.Common.Hosting.Extensions;
internal static class InstanceRegistrationExtension
public static class InstanceRegistrationExtension
{
public static ModelBuilderWrapper AddInstanceRegistration(this ModelBuilderWrapper modelBuilder)
{
@ -68,12 +68,12 @@ internal static class InstanceRegistrationExtension
entity.Property(e => e.LastUpdated)
.HasColumnName("last_updated")
.HasColumnType("datetime");
.HasColumnType("datetime");
});
}
public static void PgSqlAddInstanceRegistration(this ModelBuilder modelBuilder)
{
{
modelBuilder.Entity<InstanceRegistration>(entity =>
{
entity.ToTable("hosting_instance_registration");
@ -105,7 +105,7 @@ internal static class InstanceRegistrationExtension
entity.Property(e => e.LastUpdated)
.HasColumnName("last_updated")
.HasColumnType("datetime");
.HasColumnType("datetime");
});
}
}

View File

@ -31,6 +31,8 @@ public class AuditEvent : MessageEvent, IMapFrom<EventMessage>
public string Initiator { get; set; }
public string Target { get; set; }
public DbTenant Tenant { get; set; }
public void Mapping(Profile profile)
{
profile.CreateMap<MessageEvent, AuditEvent>();
@ -43,6 +45,8 @@ public static class AuditEventExtension
{
public static ModelBuilderWrapper AddAuditEvent(this ModelBuilderWrapper modelBuilder)
{
modelBuilder.Entity<AuditEvent>().Navigation(e => e.Tenant).AutoInclude(false);
modelBuilder
.Add(MySqlAddAuditEvent, Provider.MySql)
.Add(PgSqlAddAuditEvent, Provider.PostgreSql);

View File

@ -32,6 +32,8 @@ public class LoginEvent : MessageEvent, IMapFrom<EventMessage>
public string Login { get; set; }
public bool Active { get; set; }
public DbTenant Tenant { get; set; }
public void Mapping(Profile profile)
{
profile.CreateMap<MessageEvent, LoginEvent>();
@ -44,6 +46,8 @@ public static class LoginEventsExtension
{
public static ModelBuilderWrapper AddLoginEvents(this ModelBuilderWrapper modelBuilder)
{
modelBuilder.Entity<LoginEvent>().Navigation(e => e.Tenant).AutoInclude(false);
modelBuilder
.Add(MySqlAddLoginEvents, Provider.MySql)
.Add(PgSqlAddLoginEvents, Provider.PostgreSql);

View File

@ -24,7 +24,6 @@
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
namespace ASC.MessagingSystem.EF.Context;
public class MessagesContext : DbContext
@ -34,11 +33,11 @@ public class MessagesContext : DbContext
public DbSet<DbWebstudioSettings> WebstudioSettings { get; set; }
public DbSet<DbTenant> Tenants { get; set; }
public DbSet<User> Users { get; set; }
public MessagesContext(DbContextOptions<MessagesContext> options) : base(options)
{
}
public MessagesContext(DbContextOptions<MessagesContext> options) : base(options)
{
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{

View File

@ -39,7 +39,7 @@ public class TenantQuota : IMapFrom<DbQuota>
CountRoom = int.MaxValue
};
public int Tenant { get; set; }
public int TenantId { get; set; }
public string Name { get; set; }
public decimal Price { get; set; }
public string PriceCurrencySymbol { get; set; }
@ -271,12 +271,12 @@ public class TenantQuota : IMapFrom<DbQuota>
public TenantQuota(int tenant) : this()
{
Tenant = tenant;
TenantId = tenant;
}
public TenantQuota(TenantQuota quota) : this()
{
Tenant = quota.Tenant;
TenantId = quota.TenantId;
Name = quota.Name;
Price = quota.Price;
ProductId = quota.ProductId;
@ -287,12 +287,12 @@ public class TenantQuota : IMapFrom<DbQuota>
public override int GetHashCode()
{
return Tenant.GetHashCode();
return TenantId.GetHashCode();
}
public override bool Equals(object obj)
{
return obj is TenantQuota q && q.Tenant == Tenant;
return obj is TenantQuota q && q.TenantId == TenantId;
}
public async Task CheckAsync(IServiceProvider serviceProvider)

View File

@ -29,7 +29,7 @@ namespace ASC.Core.Tenants;
[Serializable]
public class TenantQuotaRow : IMapFrom<DbQuotaRow>
{
public int Tenant { get; set; }
public int TenantId { get; set; }
public string Path { get; set; }
public long Counter { get; set; }
public string Tag { get; set; }

View File

@ -182,11 +182,11 @@ public class DbHelper : IDisposable
r[table.Columns["mappeddomain"]] = null;
if (table.Columns.Contains("id"))
{
var tariff = await _coreDbContext.Tariffs.FirstOrDefaultAsync(t => t.Tenant == tenant.Id);
tariff.Tenant = (int)r[table.Columns["id"]];
tariff.CreateOn = DateTime.Now;
// CreateCommand("update tenants_tariff set tenant = " + r[table.Columns["id"]] + " where tenant = " + tenantid).ExecuteNonQuery();
_coreDbContext.Entry(tariff).State = EntityState.Modified;
var tariff = await _coreDbContext.Tariffs.FirstOrDefaultAsync(t => t.TenantId == tenant.Id);
tariff.TenantId = (int)r[table.Columns["id"]];
tariff.CreateOn = DateTime.Now;
// CreateCommand("update tenants_tariff set tenant = " + r[table.Columns["id"]] + " where tenant = " + tenantid).ExecuteNonQuery();
_coreDbContext.Entry(tariff).State = EntityState.Modified;
await _coreDbContext.SaveChangesAsync();
}
}

View File

@ -30,11 +30,11 @@ public class BackupsContext : DbContext
{
public DbSet<BackupRecord> Backups { get; set; }
public DbSet<BackupSchedule> Schedules { get; set; }
public DbSet<DbTenant> Tenants { get; set; }
public DbSet<DbTenant> Tenants { get; set; }
public BackupsContext(DbContextOptions<BackupsContext> options) : base(options)
{
}
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{

View File

@ -41,6 +41,8 @@ public class BackupRecord : BaseEntity
public string StorageParams { get; set; }
public bool Removed { get; set; }
public DbTenant Tenant { get; set; }
public override object[] GetKeys()
{
return new object[] { Id };
@ -51,6 +53,8 @@ public static class BackupRecordExtension
{
public static ModelBuilderWrapper AddBackupRecord(this ModelBuilderWrapper modelBuilder)
{
modelBuilder.Entity<BackupRecord>().Navigation(e => e.Tenant).AutoInclude(false);
modelBuilder
.Add(MySqlAddBackupRecord, Provider.MySql)
.Add(PgSqlAddBackupRecord, Provider.PostgreSql);

View File

@ -29,19 +29,15 @@ namespace ASC.Data.Backup.EF.Model;
public class BackupSchedule : BaseEntity
{
public int TenantId { get; set; }
public string Cron { get; set; }
public int BackupsStored { get; set; }
public BackupStorageType StorageType { get; set; }
public string StorageBasePath { get; set; }
public DateTime LastBackupTime { get; set; }
public string StorageParams { get; set; }
public DbTenant Tenant { get; set; }
public override object[] GetKeys()
{
return new object[] { TenantId };
@ -52,6 +48,8 @@ public static class BackupScheduleExtension
{
public static ModelBuilderWrapper AddBackupSchedule(this ModelBuilderWrapper modelBuilder)
{
modelBuilder.Entity<BackupSchedule>().Navigation(e => e.Tenant).AutoInclude(false);
modelBuilder
.Add(MySqlAddBackupSchedule, Provider.MySql)
.Add(PgSqlAddBackupSchedule, Provider.PostgreSql);
@ -109,6 +107,11 @@ public static class BackupScheduleExtension
.HasCharSet("utf8")
.UseCollation("utf8_general_ci")
.HasDefaultValueSql("NULL");
entity.HasOne(e => e.Tenant)
.WithOne()
.HasForeignKey<BackupSchedule>(b => b.TenantId)
.OnDelete(DeleteBehavior.Cascade);
});
}
public static void PgSqlAddBackupSchedule(this ModelBuilder modelBuilder)
@ -160,6 +163,11 @@ public static class BackupScheduleExtension
.HasCharSet("utf8")
.UseCollation("utf8_general_ci")
.HasDefaultValueSql("NULL");
entity.HasOne(e => e.Tenant)
.WithOne()
.HasForeignKey<BackupSchedule>(b => b.TenantId)
.OnDelete(DeleteBehavior.Cascade);
});
}
}

View File

@ -135,10 +135,10 @@ public class StorageFactory
_coreBaseSettings = coreBaseSettings;
}
public async Task<IDataStore> GetStorageAsync(int? tenant, string module, string region = "current")
public async Task<IDataStore> GetStorageAsync(int tenant, string module, string region = "current")
{
var tenantQuotaController = _serviceProvider.GetService<TenantQuotaController>();
tenantQuotaController.Init(tenant.GetValueOrDefault());
tenantQuotaController.Init(tenant);
return await GetStorageAsync(tenant, module, tenantQuotaController, region);
}

View File

@ -129,7 +129,7 @@ public class TenantQuotaController : IQuotaController
private async Task SetTenantQuotaRowAsync(string module, string domain, long size, string dataTag, bool exchange, Guid userId)
{
await _tenantManager.SetTenantQuotaRowAsync(
new TenantQuotaRow { Tenant = _tenant, Path = $"/{module}/{domain}", Counter = size, Tag = dataTag, UserId = userId, LastModified = DateTime.UtcNow },
new TenantQuotaRow { TenantId = _tenant, Path = $"/{module}/{domain}", Counter = size, Tag = dataTag, UserId = userId, LastModified = DateTime.UtcNow },
exchange);
}

View File

@ -29,7 +29,9 @@ namespace ASC.EventBus.Extensions.Logger.Extensions;
public static class IntegrationEventLogExtension
{
public static ModelBuilderWrapper AddIntegrationEventLog(this ModelBuilderWrapper modelBuilder)
{
{
modelBuilder.Entity<IntegrationEventLogEntry>().Navigation(e => e.Tenant).AutoInclude(false);
modelBuilder
.Add(MySqlAddIntegrationEventLog, Provider.MySql)
.Add(PgSqlAddIntegrationEventLog, Provider.PostgreSql);

View File

@ -24,23 +24,24 @@
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
namespace ASC.EventBus.Extensions.Logger;
public class IntegrationEventLogContext : DbContext
{
public DbSet<IntegrationEventLogEntry> IntegrationEventLogs { get; set; }
namespace ASC.EventBus.Extensions.Logger;
public class IntegrationEventLogContext : DbContext
{
public DbSet<IntegrationEventLogEntry> IntegrationEventLogs { get; set; }
public IntegrationEventLogContext(DbContextOptions<IntegrationEventLogContext> dbContextOptions) : base(dbContextOptions)
{
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
ModelBuilderWrapper.From(modelBuilder, Database)
.AddIntegrationEventLog();
}
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
ModelBuilderWrapper.From(modelBuilder, Database)
.AddIntegrationEventLog()
.AddDbTenant();
}
}

View File

@ -60,6 +60,8 @@ public class IntegrationEventLogEntry
public string TransactionId { get; private set; }
public int TenantId { get; private set; }
public DbTenant Tenant { get; private set; }
public IntegrationEventLogEntry DeserializeJsonContent(Type type)
{
IntegrationEvent = JsonSerializer.Deserialize(Content, type, new JsonSerializerOptions() { PropertyNameCaseInsensitive = true }) as IntegrationEvent;

View File

@ -30,7 +30,7 @@ public class FeedRow
{
public DateTime AggregatedDate { get; set; }
public IList<Guid> Users { get; set; }
public int Tenant { get; set; }
public int TenantId { get; set; }
public string Product { get; set; }
public Aggregator.Feed Feed { get; private set; }
public string Id => Feed.Id;

View File

@ -99,40 +99,40 @@ public class FeedAggregateDataProvider
{
using var feedDbContext = _dbContextFactory.CreateDbContext();
foreach (var f in feeds)
{
if (0 >= f.Users.Count)
foreach (var f in feeds)
{
continue;
}
var feedAggregate = _mapper.Map<FeedRow, FeedAggregate>(f);
feedAggregate.AggregateDate = aggregatedDate;
if (f.ClearRightsBeforeInsert)
{
var fu = feedDbContext.FeedUsers.Where(r => r.FeedId == f.Id).FirstOrDefault();
if (fu != null)
if (0 >= f.Users.Count)
{
feedDbContext.FeedUsers.Remove(fu);
continue;
}
var feedAggregate = _mapper.Map<FeedRow, FeedAggregate>(f);
feedAggregate.AggregateDate = aggregatedDate;
if (f.ClearRightsBeforeInsert)
{
var fu = feedDbContext.FeedUsers.Where(r => r.FeedId == f.Id).FirstOrDefault();
if (fu != null)
{
feedDbContext.FeedUsers.Remove(fu);
}
}
}
await feedDbContext.AddOrUpdateAsync(q => q.FeedAggregates, feedAggregate);
foreach (var u in f.Users)
{
var feedUser = new FeedUsers
foreach (var u in f.Users)
{
FeedId = f.Id,
UserId = u
};
var feedUser = new FeedUsers
{
FeedId = f.Id,
UserId = u
};
await feedDbContext.AddOrUpdateAsync(q => q.FeedUsers, feedUser);
}
}
}
await feedDbContext.SaveChangesAsync();
await feedDbContext.SaveChangesAsync();
}
public async Task RemoveFeedAggregateAsync(DateTime fromTime)
@ -140,10 +140,8 @@ public class FeedAggregateDataProvider
using var feedDbContext = _dbContextFactory.CreateDbContext();
var aggregates = feedDbContext.FeedAggregates.Where(r => r.AggregateDate <= fromTime);
var users = feedDbContext.FeedUsers.Where(r => feedDbContext.FeedAggregates.Where(r => r.AggregateDate <= fromTime).Any(a => a.Id == r.FeedId));
feedDbContext.FeedAggregates.RemoveRange(aggregates);
feedDbContext.FeedUsers.RemoveRange(users);
await feedDbContext.SaveChangesAsync();
}
@ -186,7 +184,7 @@ public class FeedAggregateDataProvider
using var feedDbContext = _dbContextFactory.CreateDbContext();
var tenant = await _tenantManager.GetCurrentTenantAsync();
var q = feedDbContext.FeedAggregates.AsNoTracking()
.Where(r => r.Tenant == tenant.Id);
.Where(r => r.TenantId == tenant.Id);
var feeds = filter.History ? GetFeedsAsHistoryQuery(q, filter) : GetFeedsDefaultQuery(feedDbContext, q, filter);
@ -285,7 +283,7 @@ public class FeedAggregateDataProvider
using var feedDbContext = _dbContextFactory.CreateDbContext();
var tenant = await _tenantManager.GetCurrentTenantAsync();
var query = feedDbContext.FeedAggregates
.Where(r => r.Tenant == tenant.Id)
.Where(r => r.TenantId == tenant.Id)
.Where(r => r.ModifiedBy != _authContext.CurrentAccount.ID)
.Join(feedDbContext.FeedUsers, r => r.Id, u => u.FeedId, (agg, user) => new { agg, user })
.Where(r => r.user.UserId == _authContext.CurrentAccount.ID);
@ -303,7 +301,7 @@ public class FeedAggregateDataProvider
using var feedDbContext = _dbContextFactory.CreateDbContext();
return await feedDbContext.FeedAggregates
.Where(r => r.AggregateDate >= interval.From && r.AggregateDate <= interval.To)
.GroupBy(r => r.Tenant)
.GroupBy(r => r.TenantId)
.Select(r => r.Key)
.ToListAsync();
}
@ -322,10 +320,8 @@ public class FeedAggregateDataProvider
{
using var feedDbContext = _dbContextFactory.CreateDbContext();
var aggregates = feedDbContext.FeedAggregates.Where(r => r.Id == id);
var users = feedDbContext.FeedUsers.Where(r => r.FeedId == id);
feedDbContext.FeedAggregates.RemoveRange(aggregates);
feedDbContext.FeedUsers.RemoveRange(users);
await feedDbContext.SaveChangesAsync();
}

View File

@ -54,7 +54,7 @@ public class FeedReadedDataProvider
{
using var feedDbContext = _dbContextFactory.CreateDbContext();
return await feedDbContext.FeedReaded
.Where(r => r.Tenant == tenant)
.Where(r => r.TenantId == tenant)
.Where(r => r.UserId == user)
.Where(r => r.Module == module)
.MaxAsync(r => r.TimeStamp);
@ -87,7 +87,7 @@ public class FeedReadedDataProvider
UserId = user,
TimeStamp = time,
Module = module,
Tenant = tenant
TenantId = tenant
};
using var feedDbContext = _dbContextFactory.CreateDbContext();
@ -104,7 +104,7 @@ public class FeedReadedDataProvider
{
using var feedDbContext = _dbContextFactory.CreateDbContext();
return await feedDbContext.FeedReaded
.Where(r => r.Tenant == tenant)
.Where(r => r.TenantId == tenant)
.Where(r => r.UserId == user)
.Where(r => r.TimeStamp >= fromTime)
.Select(r => r.Module)

View File

@ -32,8 +32,8 @@ public class FeedDbContext : DbContext
public DbSet<FeedAggregate> FeedAggregates { get; set; }
public DbSet<FeedUsers> FeedUsers { get; set; }
public DbSet<FeedReaded> FeedReaded { get; set; }
public FeedDbContext(DbContextOptions<FeedDbContext> options) : base(options) { }
public FeedDbContext(DbContextOptions<FeedDbContext> options) : base(options) { }
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
@ -42,6 +42,7 @@ public class FeedDbContext : DbContext
.AddFeedUsers()
.AddFeedReaded()
.AddFeedAggregate()
.AddFeedLast();
.AddFeedLast()
.AddDbTenant();
}
}

View File

@ -29,7 +29,7 @@ namespace ASC.Feed.Model;
public class FeedAggregate : BaseEntity, IMapFrom<FeedRow>
{
public string Id { get; set; }
public int Tenant { get; set; }
public int TenantId { get; set; }
public string Product { get; set; }
public string Module { get; set; }
public Guid Author { get; set; }
@ -42,6 +42,8 @@ public class FeedAggregate : BaseEntity, IMapFrom<FeedRow>
public string Keywords { get; set; }
public string ContextId { get; set; }
public DbTenant Tenant { get; set; }
public override object[] GetKeys()
{
return new object[] { Id };
@ -51,6 +53,8 @@ public static class FeedAggregateExtension
{
public static ModelBuilderWrapper AddFeedAggregate(this ModelBuilderWrapper modelBuilder)
{
modelBuilder.Entity<FeedAggregate>().Navigation(e => e.Tenant).AutoInclude(false);
modelBuilder
.Add(MySqlAddFeedAggregate, Provider.MySql)
.Add(PgSqlAddFeedAggregate, Provider.PostgreSql);
@ -63,13 +67,13 @@ public static class FeedAggregateExtension
entity.ToTable("feed_aggregate")
.HasCharSet("utf8");
entity.HasIndex(e => new { e.Tenant, e.AggregateDate })
entity.HasIndex(e => new { e.TenantId, e.AggregateDate })
.HasDatabaseName("aggregated_date");
entity.HasIndex(e => new { e.Tenant, e.ModifiedDate })
entity.HasIndex(e => new { e.TenantId, e.ModifiedDate })
.HasDatabaseName("modified_date");
entity.HasIndex(e => new { e.Tenant, e.Product })
entity.HasIndex(e => new { e.TenantId, e.Product })
.HasDatabaseName("product");
entity.Property(e => e.Id)
@ -137,7 +141,7 @@ public static class FeedAggregateExtension
.HasCharSet("utf8")
.UseCollation("utf8_general_ci");
entity.Property(e => e.Tenant).HasColumnName("tenant");
entity.Property(e => e.TenantId).HasColumnName("tenant");
entity.Property(e => e.ContextId)
.HasColumnName("context_id")
@ -152,13 +156,13 @@ public static class FeedAggregateExtension
{
entity.ToTable("feed_aggregate", "onlyoffice");
entity.HasIndex(e => new { e.Tenant, e.AggregateDate })
entity.HasIndex(e => new { e.TenantId, e.AggregateDate })
.HasDatabaseName("aggregated_date");
entity.HasIndex(e => new { e.Tenant, e.ModifiedDate })
entity.HasIndex(e => new { e.TenantId, e.ModifiedDate })
.HasDatabaseName("modified_date");
entity.HasIndex(e => new { e.Tenant, e.Product })
entity.HasIndex(e => new { e.TenantId, e.Product })
.HasDatabaseName("product");
entity.Property(e => e.Id)
@ -204,7 +208,7 @@ public static class FeedAggregateExtension
.HasColumnName("product")
.HasMaxLength(50);
entity.Property(e => e.Tenant).HasColumnName("tenant");
entity.Property(e => e.TenantId).HasColumnName("tenant");
entity.Property(e => e.ContextId).HasColumnName("context_id");
});

View File

@ -31,11 +31,13 @@ public class FeedReaded : BaseEntity
public Guid UserId { get; set; }
public DateTime TimeStamp { get; set; }
public string Module { get; set; }
public int Tenant { get; set; }
public int TenantId { get; set; }
public DbTenant Tenant { get; set; }
public override object[] GetKeys()
{
return new object[] { Tenant, UserId, Module };
return new object[] { TenantId, UserId, Module };
}
}
@ -43,6 +45,8 @@ public static class FeedReadedExtension
{
public static ModelBuilderWrapper AddFeedReaded(this ModelBuilderWrapper modelBuilder)
{
modelBuilder.Entity<FeedReaded>().Navigation(e => e.Tenant).AutoInclude(false);
modelBuilder
.Add(MySqlAddFeedReaded, Provider.MySql)
.Add(PgSqlAddFeedReaded, Provider.PostgreSql);
@ -52,13 +56,13 @@ public static class FeedReadedExtension
{
modelBuilder.Entity<FeedReaded>(entity =>
{
entity.HasKey(e => new { e.Tenant, e.UserId, e.Module })
entity.HasKey(e => new { e.TenantId, e.UserId, e.Module })
.HasName("PRIMARY");
entity.ToTable("feed_readed")
.HasCharSet("utf8");
entity.Property(e => e.Tenant).HasColumnName("tenant_id");
entity.Property(e => e.TenantId).HasColumnName("tenant_id");
entity.Property(e => e.UserId)
.HasColumnName("user_id")
@ -81,7 +85,7 @@ public static class FeedReadedExtension
{
modelBuilder.Entity<FeedReaded>(entity =>
{
entity.HasKey(e => new { e.UserId, e.Tenant, e.Module })
entity.HasKey(e => new { e.UserId, e.TenantId, e.Module })
.HasName("feed_readed_pkey");
entity.ToTable("feed_readed", "onlyoffice");
@ -90,7 +94,7 @@ public static class FeedReadedExtension
.HasColumnName("user_id")
.HasMaxLength(38);
entity.Property(e => e.Tenant).HasColumnName("tenant_id");
entity.Property(e => e.TenantId).HasColumnName("tenant_id");
entity.Property(e => e.Module)
.HasColumnName("module")

View File

@ -31,6 +31,8 @@ public class FeedUsers : BaseEntity
public string FeedId { get; set; }
public Guid UserId { get; set; }
public FeedAggregate Feed { get; set; }
public override object[] GetKeys()
{
return new object[] { FeedId, UserId };
@ -41,6 +43,8 @@ public static class FeedUsersExtension
{
public static ModelBuilderWrapper AddFeedUsers(this ModelBuilderWrapper modelBuilder)
{
modelBuilder.Entity<FeedUsers>().Navigation(e => e.Feed).AutoInclude(false);
modelBuilder
.Add(MySqlAddFeedUsers, Provider.MySql)
.Add(PgSqlAddFeedUsers, Provider.PostgreSql);

View File

@ -28,41 +28,41 @@ namespace ASC.IPSecurity;
[Scope]
public class IPRestrictionsRepository
{
private readonly IDbContextFactory<TenantDbContext> _dbContextManager;
{
private readonly IDbContextFactory<TenantDbContext> _dbContextManager;
private readonly IMapper _mapper;
public IPRestrictionsRepository(IDbContextFactory<TenantDbContext> dbContextManager, IMapper mapper)
{
_dbContextManager = dbContextManager;
{
_dbContextManager = dbContextManager;
_mapper = mapper;
}
public async Task<List<IPRestriction>> GetAsync(int tenant)
{
public async Task<List<IPRestriction>> GetAsync(int tenant)
{
using var tenantDbContext = _dbContextManager.CreateDbContext();
return await tenantDbContext.TenantIpRestrictions
.Where(r => r.Tenant == tenant)
return await tenantDbContext.TenantIpRestrictions
.Where(r => r.TenantId == tenant)
.ProjectTo<IPRestriction>(_mapper.ConfigurationProvider)
.ToListAsync();
.ToListAsync();
}
public async Task<List<IpRestrictionBase>> SaveAsync(IEnumerable<IpRestrictionBase> ips, int tenant)
{
public async Task<List<IpRestrictionBase>> SaveAsync(IEnumerable<IpRestrictionBase> ips, int tenant)
{
using var tenantDbContext = _dbContextManager.CreateDbContext();
tenantDbContext.TenantIpRestrictions.RemoveRange(tenantDbContext.TenantIpRestrictions.Where(r => r.Tenant == tenant));
tenantDbContext.TenantIpRestrictions.RemoveRange(tenantDbContext.TenantIpRestrictions.Where(r => r.TenantId == tenant));
var ipsList = ips.Select(r => new TenantIpRestrictions
{
Tenant = tenant,
Ip = r.Ip,
ForAdmin = r.ForAdmin
var ipsList = ips.Select(r => new TenantIpRestrictions
{
TenantId = tenant,
Ip = r.Ip,
ForAdmin = r.ForAdmin
});
});
tenantDbContext.TenantIpRestrictions.AddRange(ipsList);
await tenantDbContext.SaveChangesAsync();
tenantDbContext.TenantIpRestrictions.AddRange(ipsList);
await tenantDbContext.SaveChangesAsync();
return ips.ToList();
}

View File

@ -31,7 +31,7 @@ public class IPRestriction : IpRestrictionBase, IMapFrom<TenantIpRestrictions>
{
public int Id { get; set; }
public int Tenant { get; set; }
public int TenantId { get; set; }
}
public class IpRestrictionBase

View File

@ -29,17 +29,18 @@ namespace ASC.Webhooks.Core.EF.Context;
public class WebhooksDbContext : DbContext
{
public DbSet<WebhooksConfig> WebhooksConfigs { get; set; }
public DbSet<WebhooksLog> WebhooksLogs { get; set; }
public DbSet<WebhooksLog> WebhooksLogs { get; set; }
public DbSet<DbWebhook> Webhooks { get; set; }
public WebhooksDbContext(DbContextOptions<WebhooksDbContext> options) : base(options) { }
public WebhooksDbContext(DbContextOptions<WebhooksDbContext> options) : base(options) { }
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
ModelBuilderWrapper
.From(modelBuilder, Database)
.From(modelBuilder, Database)
.AddDbWebhooks()
.AddWebhooksConfig()
.AddWebhooksLog();
.AddWebhooksLog()
.AddDbTenant();
}
}

View File

@ -36,6 +36,8 @@ public class WebhooksConfig : BaseEntity
public bool Enabled { get; set; }
public bool SSL { get; set; }
public DbTenant Tenant { get; set; }
public override object[] GetKeys()
{
return new object[] { Id };
@ -45,7 +47,9 @@ public class WebhooksConfig : BaseEntity
public static class WebhooksConfigExtension
{
public static ModelBuilderWrapper AddWebhooksConfig(this ModelBuilderWrapper modelBuilder)
{
{
modelBuilder.Entity<WebhooksConfig>().Navigation(e => e.Tenant).AutoInclude(false);
modelBuilder
.Add(MySqlAddWebhooksConfig, Provider.MySql)
.Add(PgSqlAddWebhooksConfig, Provider.PostgreSql);
@ -69,8 +73,7 @@ public static class WebhooksConfigExtension
.HasColumnName("id");
entity.Property(e => e.TenantId)
.HasColumnName("tenant_id")
.HasColumnType("int unsigned");
.HasColumnName("tenant_id");
entity.Property(e => e.Uri)
.HasColumnName("uri")
@ -115,11 +118,10 @@ public static class WebhooksConfigExtension
entity.Property(e => e.Id)
.HasColumnType("int")
.HasColumnName("id");
entity.Property(e => e.TenantId)
.HasColumnName("tenant_id")
.HasColumnType("int unsigned");
.HasColumnName("id");
entity.Property(e => e.TenantId)
.HasColumnName("tenant_id");
entity.Property(e => e.Uri)
.HasColumnName("uri")

View File

@ -41,13 +41,16 @@ public class WebhooksLog
public Guid Uid { get; set; }
public DateTime? Delivery { get; set; }
public WebhooksConfig Config { get; set; }
public WebhooksConfig Config { get; set; }
public DbTenant Tenant { get; set; }
}
public static class WebhooksPayloadExtension
{
public static ModelBuilderWrapper AddWebhooksLog(this ModelBuilderWrapper modelBuilder)
{
{
modelBuilder.Entity<WebhooksLog>().Navigation(e => e.Tenant).AutoInclude();
modelBuilder
.Add(MySqlAddWebhooksLog, Provider.MySql)
.Add(PgSqlAddWebhooksLog, Provider.PostgreSql);
@ -84,8 +87,7 @@ public static class WebhooksPayloadExtension
.UseCollation("utf8_general_ci");
entity.Property(e => e.TenantId)
.HasColumnName("tenant_id")
.HasColumnType("int unsigned");
.HasColumnName("tenant_id");
entity.Property(e => e.RequestPayload)
.IsRequired()
@ -154,8 +156,7 @@ public static class WebhooksPayloadExtension
.HasMaxLength(50);
entity.Property(e => e.TenantId)
.HasColumnName("tenant_id")
.HasColumnType("int unsigned");
.HasColumnName("tenant_id");
entity.Property(e => e.RequestPayload)
.IsRequired()

View File

@ -7,27 +7,27 @@
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<PropertyGroup>
<NoWarn>1701;1702;EF1001</NoWarn>
<PropertyGroup>
<NoWarn>1701;1702;EF1001</NoWarn>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="CommandLineParser" Version="2.9.1" />
<PackageReference Include="Microsoft.Build" Version="17.4.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.2">
<PrivateAssets>all</PrivateAssets>
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.2">
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="7.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\migrations\mysql\ASC.Migrations.MySql.csproj" />
<ProjectReference Include="..\..\..\migrations\postgre\ASC.Migrations.PostgreSql.csproj" />
<ProjectReference Include="..\..\..\products\ASC.Files\Core\ASC.Files.Core.csproj" />
<ProjectReference Include="..\..\ASC.ActiveDirectory\ASC.ActiveDirectory.csproj" />
<ProjectReference Include="..\..\ASC.Core.Common\ASC.Core.Common.csproj" />
<ProjectReference Include="..\..\ASC.Data.Backup.Core\ASC.Data.Backup.Core.csproj" />
<ProjectReference Include="..\ASC.Migration.Core\ASC.Migration.Core.csproj" />
<ItemGroup>
<ProjectReference Include="..\..\..\migrations\mysql\ASC.Migrations.MySql.csproj" />
<ProjectReference Include="..\..\..\migrations\postgre\ASC.Migrations.PostgreSql.csproj" />
<ProjectReference Include="..\..\..\products\ASC.Files\Core\ASC.Files.Core.csproj" />
<ProjectReference Include="..\..\ASC.ActiveDirectory\ASC.ActiveDirectory.csproj" />
<ProjectReference Include="..\..\ASC.Core.Common\ASC.Core.Common.csproj" />
<ProjectReference Include="..\..\ASC.Data.Backup.Core\ASC.Data.Backup.Core.csproj" />
<ProjectReference Include="..\ASC.Migrations.Core\ASC.Migrations.Core.csproj" />
</ItemGroup>
</Project>

View File

@ -26,21 +26,14 @@
global using ASC.Common.Logging;
global using ASC.Core.Common.EF;
global using ASC.Core.Common.EF.Context;
global using ASC.Core.Common.EF.Teamlabsite;
global using ASC.Core.Common.EF.Teamlabsite.Context;
global using ASC.Core.Common.Hosting;
global using ASC.Data.Backup.EF.Context;
global using ASC.EventBus.Extensions.Logger;
global using ASC.Feed.Context;
global using ASC.Files.Core.EF;
global using ASC.MessagingSystem.EF.Context;
global using ASC.Webhooks.Core.EF.Context;
global using Microsoft.Extensions.Hosting.WindowsServices;
global using Migration.Core.Models;
global using Migration.Core.Utils;
global using ASC.Migrations.Core.Models;
global using ASC.Migrations.Core.Utils;
global using Migration.Creator;
global using ASC.Migrations.Core;
global using ASC.Migrations;
global using DbContextActivator = Migration.Core.Utils.DbContextActivator;
global using DbContextActivator = ASC.Migrations.Core.Utils.DbContextActivator;

View File

@ -23,66 +23,49 @@
// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
namespace Migration.Creator;
public class MigrationCreator
{
private readonly IServiceProvider _serviceProvider;
public MigrationCreator(IServiceProvider serviceProvider)
{
_serviceProvider = serviceProvider;
}
{
private readonly IServiceProvider _serviceProvider;
public MigrationCreator(IServiceProvider serviceProvider)
{
_serviceProvider = serviceProvider;
}
public void RunCreateMigrations(Options options)
{
var counter = 0;
foreach (var projectInfo in Solution.GetProjects(options.Path))
foreach (var providerInfo in options.Providers)
{
var ctxTypesFinder = new ProjectInfoContextFinder(projectInfo);
CreateMigration(options, typeof(MigrationContext), providerInfo);
}
foreach (var providerInfo in options.TeamlabsiteProviders)
{
CreateMigration(options, typeof(TeamlabSiteContext), providerInfo);
}
Console.WriteLine($"Update migrations");
}
foreach (var contextType in ctxTypesFinder.GetDependetContextsTypes())
{
if (contextType.GetInterfaces().Contains(typeof(ITeamlabsiteDb)))
{
foreach (var providerInfo in options.TeamlabsiteProviders)
{
CreateMigration(options, contextType, providerInfo);
counter++;
}
}
else
{
foreach (var providerInfo in options.Providers)
{
CreateMigration(options, contextType, providerInfo);
counter++;
}
}
}
private void CreateMigration(Options options, Type contextType, ProviderInfo providerInfo)
{
var dbContextActivator = new DbContextActivator(_serviceProvider);
var context = dbContextActivator.CreateInstance(contextType, providerInfo);
var modelDiffChecker = new ModelDifferenceChecker(context);
if (!modelDiffChecker.IsDifferent())
{
return;
}
Console.WriteLine($"Created {counter} migrations");
}
private void CreateMigration(Options options, Type contextType, ProviderInfo providerInfo)
{
var dbContextActivator = new DbContextActivator(_serviceProvider);
var context = dbContextActivator.CreateInstance(contextType, providerInfo);
var modelDiffChecker = new ModelDifferenceChecker(context);
if (!modelDiffChecker.IsDifferent())
{
return;
}
context = dbContextActivator.CreateInstance(contextType, providerInfo); //Hack: refresh context
var providerInfoProjectPath = Solution.GetProviderProjectPath(options.Path, providerInfo);
var migrationGenerator = new MigrationGenerator(context, providerInfo.Provider, providerInfoProjectPath);
migrationGenerator.Generate();
context = dbContextActivator.CreateInstance(contextType, providerInfo); //Hack: refresh context
var providerInfoProjectPath = Solution.GetProviderProjectPath(options.Path, providerInfo);
var migrationGenerator = new MigrationGenerator(context, providerInfo.Provider, providerInfoProjectPath);
migrationGenerator.Generate();
}
}

View File

@ -1,27 +1,27 @@
// (c) Copyright Ascensio System SIA 2010-2022
//
// This program is a free software product.
// You can redistribute it and/or modify it under the terms
// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software
// Foundation. In accordance with Section 7(a) of the GNU AGPL 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 details, see
// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
//
// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021.
//
// The interactive user interfaces in modified source and object code versions of the Program must
// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3.
//
// Pursuant to Section 7(b) of the License you must retain the original Product logo when
// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under
// trademark law for use of our trademarks.
//
// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
// (c) Copyright Ascensio System SIA 2010-2022
//
// This program is a free software product.
// You can redistribute it and/or modify it under the terms
// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software
// Foundation. In accordance with Section 7(a) of the GNU AGPL 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 details, see
// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
//
// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021.
//
// The interactive user interfaces in modified source and object code versions of the Program must
// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3.
//
// Pursuant to Section 7(b) of the License you must retain the original Product logo when
// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under
// trademark law for use of our trademarks.
//
// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
var options = new WebApplicationOptions
@ -36,23 +36,7 @@ builder.Configuration.AddJsonFile($"appsettings.creator.json", true)
.AddCommandLine(args);
builder.Services.AddScoped<EFLoggerFactory>();
builder.Services.AddBaseDbContext<AccountLinkContext>();
builder.Services.AddBaseDbContext<CoreDbContext>();
builder.Services.AddBaseDbContext<TenantDbContext>();
builder.Services.AddBaseDbContext<UserDbContext>();
builder.Services.AddBaseDbContext<TelegramDbContext>();
builder.Services.AddBaseDbContext<CustomDbContext>();
builder.Services.AddBaseDbContext<WebstudioDbContext>();
builder.Services.AddBaseDbContext<InstanceRegistrationContext>();
builder.Services.AddBaseDbContext<IntegrationEventLogContext>();
builder.Services.AddBaseDbContext<FeedDbContext>();
builder.Services.AddBaseDbContext<MessagesContext>();
builder.Services.AddBaseDbContext<WebhooksDbContext>();
builder.Services.AddBaseDbContext<BackupsContext>();
builder.Services.AddBaseDbContext<FilesDbContext>();
builder.Services.AddBaseDbContext<NotifyDbContext>();
builder.Services.AddBaseDbContext<UrlShortenerFakeDbContext>();
builder.Services.AddBaseDbContext<FirebaseDbContext>();
builder.Services.AddBaseDbContext<MigrationContext>();
builder.Services.AddBaseDbContext<TeamlabSiteContext>();
var app = builder.Build();
@ -65,4 +49,4 @@ if (!Path.IsPathRooted(conf.Path))
}
var migrationCreator = new MigrationCreator(app.Services);
migrationCreator.RunCreateMigrations(conf);
migrationCreator.RunCreateMigrations(conf);

View File

@ -7,27 +7,27 @@
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<PropertyGroup>
<NoWarn>1701;1702;EF1001</NoWarn>
<PropertyGroup>
<NoWarn>1701;1702;EF1001</NoWarn>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="CommandLineParser" Version="2.9.1" />
<PackageReference Include="Microsoft.Build" Version="17.4.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.2">
<PrivateAssets>all</PrivateAssets>
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.2">
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="7.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\migrations\mysql\ASC.Migrations.MySql.csproj" />
<ProjectReference Include="..\..\..\migrations\postgre\ASC.Migrations.PostgreSql.csproj" />
<ProjectReference Include="..\..\..\products\ASC.Files\Core\ASC.Files.Core.csproj" />
<ProjectReference Include="..\..\ASC.ActiveDirectory\ASC.ActiveDirectory.csproj" />
<ProjectReference Include="..\..\ASC.Core.Common\ASC.Core.Common.csproj" />
<ProjectReference Include="..\..\ASC.Data.Backup.Core\ASC.Data.Backup.Core.csproj" />
<ProjectReference Include="..\ASC.Migration.Core\ASC.Migration.Core.csproj" />
<ItemGroup>
<ProjectReference Include="..\..\..\migrations\mysql\ASC.Migrations.MySql.csproj" />
<ProjectReference Include="..\..\..\migrations\postgre\ASC.Migrations.PostgreSql.csproj" />
<ProjectReference Include="..\..\..\products\ASC.Files\Core\ASC.Files.Core.csproj" />
<ProjectReference Include="..\..\ASC.ActiveDirectory\ASC.ActiveDirectory.csproj" />
<ProjectReference Include="..\..\ASC.Core.Common\ASC.Core.Common.csproj" />
<ProjectReference Include="..\..\ASC.Data.Backup.Core\ASC.Data.Backup.Core.csproj" />
<ProjectReference Include="..\ASC.Migrations.Core\ASC.Migrations.Core.csproj" />
</ItemGroup>
</Project>

View File

@ -24,26 +24,15 @@
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
global using System.Reflection;
global using ASC.Common.Logging;
global using ASC.Core.Common.EF;
global using ASC.Core.Common.EF.Context;
global using ASC.Core.Common.EF.Teamlabsite;
global using ASC.Core.Common.EF.Teamlabsite.Context;
global using ASC.Core.Common.Hosting;
global using ASC.Data.Backup.EF.Context;
global using ASC.EventBus.Extensions.Logger;
global using ASC.Feed.Context;
global using ASC.Files.Core.EF;
global using ASC.MessagingSystem.EF.Context;
global using ASC.Webhooks.Core.EF.Context;
global using Microsoft.EntityFrameworkCore;
global using Microsoft.EntityFrameworkCore;
global using Microsoft.Extensions.Hosting.WindowsServices;
global using Migration.Core.Models;
global using Migration.Core.Utils;
global using ASC.Migrations.Core.Models;
global using ASC.Migrations.Core.Utils;
global using Migration.Runner;
global using ASC.Migrations.Core;
global using DbContextActivator = Migration.Core.Utils.DbContextActivator;
global using DbContextActivator = ASC.Migrations.Core.Utils.DbContextActivator;

View File

@ -37,38 +37,13 @@ public class MigrationRunner
public void RunApplyMigrations(string path, ProviderInfo dbProvider, ProviderInfo teamlabsiteProvider)
{
var counter = 0;
foreach (var assembly in GetAssemblies(path))
{
var ctxTypesFinder = new AssemblyContextFinder(assembly);
foreach (var contextType in ctxTypesFinder.GetIndependentContextsTypes())
{
DbContext context = null;
if (contextType.GetInterfaces().Contains(typeof(ITeamlabsiteDb)))
{
context = _dbContextActivator.CreateInstance(contextType, teamlabsiteProvider);
}
else
{
context = _dbContextActivator.CreateInstance(contextType, dbProvider);
}
context.Database.Migrate();
counter++;
}
}
Console.WriteLine($"Applied {counter} migrations");
}
private static IEnumerable<Assembly> GetAssemblies(string path)
{
var assemblyPaths = Directory.GetFiles(path, "ASC.*.dll");
foreach (var assembly in assemblyPaths)
{
yield return Assembly.LoadFrom(assembly);
}
var migrationContext = _dbContextActivator.CreateInstance(typeof(MigrationContext), dbProvider);
migrationContext.Database.Migrate();
var teamlabContext = _dbContextActivator.CreateInstance(typeof(TeamlabSiteContext), teamlabsiteProvider);
teamlabContext.Database.Migrate();
Console.WriteLine("Applied migrations");
}
}

View File

@ -1,27 +1,27 @@
// (c) Copyright Ascensio System SIA 2010-2022
//
// This program is a free software product.
// You can redistribute it and/or modify it under the terms
// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software
// Foundation. In accordance with Section 7(a) of the GNU AGPL 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 details, see
// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
//
// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021.
//
// The interactive user interfaces in modified source and object code versions of the Program must
// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3.
//
// Pursuant to Section 7(b) of the License you must retain the original Product logo when
// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under
// trademark law for use of our trademarks.
//
// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
// (c) Copyright Ascensio System SIA 2010-2022
//
// This program is a free software product.
// You can redistribute it and/or modify it under the terms
// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software
// Foundation. In accordance with Section 7(a) of the GNU AGPL 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 details, see
// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
//
// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021.
//
// The interactive user interfaces in modified source and object code versions of the Program must
// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3.
//
// Pursuant to Section 7(b) of the License you must retain the original Product logo when
// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under
// trademark law for use of our trademarks.
//
// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
var options = new WebApplicationOptions
@ -36,23 +36,7 @@ builder.Configuration.AddJsonFile($"appsettings.runner.json", true)
.AddCommandLine(args);
builder.Services.AddScoped<EFLoggerFactory>();
builder.Services.AddBaseDbContext<AccountLinkContext>();
builder.Services.AddBaseDbContext<CoreDbContext>();
builder.Services.AddBaseDbContext<TenantDbContext>();
builder.Services.AddBaseDbContext<UserDbContext>();
builder.Services.AddBaseDbContext<TelegramDbContext>();
builder.Services.AddBaseDbContext<FirebaseDbContext>();
builder.Services.AddBaseDbContext<CustomDbContext>();
builder.Services.AddBaseDbContext<WebstudioDbContext>();
builder.Services.AddBaseDbContext<InstanceRegistrationContext>();
builder.Services.AddBaseDbContext<IntegrationEventLogContext>();
builder.Services.AddBaseDbContext<FeedDbContext>();
builder.Services.AddBaseDbContext<WebhooksDbContext>();
builder.Services.AddBaseDbContext<MessagesContext>();
builder.Services.AddBaseDbContext<BackupsContext>();
builder.Services.AddBaseDbContext<FilesDbContext>();
builder.Services.AddBaseDbContext<NotifyDbContext>();
builder.Services.AddBaseDbContext<UrlShortenerFakeDbContext>();
builder.Services.AddBaseDbContext<MigrationContext>();
builder.Services.AddBaseDbContext<TeamlabSiteContext>();
var app = builder.Build();
@ -63,4 +47,4 @@ foreach (var providerInfo in providersInfo.Providers)
{
var migrationCreator = new MigrationRunner(app.Services);
migrationCreator.RunApplyMigrations(AppContext.BaseDirectory, providerInfo, providersInfo.TeamlabsiteProviders.SingleOrDefault(q => q.Provider == providerInfo.Provider));
}
}

View File

@ -35,7 +35,7 @@
<ProjectReference Include="..\..\ASC.Common\ASC.Common.csproj" />
<ProjectReference Include="..\..\ASC.Core.Common\ASC.Core.Common.csproj" />
<ProjectReference Include="..\..\ASC.Data.Backup.Core\ASC.Data.Backup.Core.csproj" />
<ProjectReference Include="..\ASC.Migration.Core\ASC.Migration.Core.csproj" />
<ProjectReference Include="..\ASC.Migrations.Core\ASC.Migrations.Core.csproj" />
</ItemGroup>
</Project>

View File

@ -135,17 +135,17 @@ public class MigrationCreator
{
if (string.IsNullOrEmpty(_userName))
{
user = userDbContext.Users.FirstOrDefault(q => q.Tenant == _fromTenantId && q.Status == EmployeeStatus.Active && q.Email == _mail);
user = userDbContext.Users.FirstOrDefault(q => q.TenantId == _fromTenantId && q.Status == EmployeeStatus.Active && q.Email == _mail);
_userName = user.UserName;
}
else
{
user = userDbContext.Users.FirstOrDefault(q => q.Tenant == _fromTenantId && q.Status == EmployeeStatus.Active && q.UserName == _userName);
user = userDbContext.Users.FirstOrDefault(q => q.TenantId == _fromTenantId && q.Status == EmployeeStatus.Active && q.UserName == _userName);
}
}
else
{
user = userDbContext.Users.FirstOrDefault(q => q.Tenant == _fromTenantId && q.Status == EmployeeStatus.Active && q.UserName == _userName && q.Email == _mail);
user = userDbContext.Users.FirstOrDefault(q => q.TenantId == _fromTenantId && q.Status == EmployeeStatus.Active && q.UserName == _userName && q.Email == _mail);
}
if (!string.IsNullOrEmpty(_toAlias))
{
@ -158,7 +158,7 @@ public class MigrationCreator
}
else
{
if (userDbContextToregion.Users.Any(q => q.Tenant == tenant.Id && q.UserName == _userName || q.Email == _mail))
if (userDbContextToregion.Users.Any(q => q.TenantId == tenant.Id && q.UserName == _userName || q.Email == _mail))
{
throw new ArgumentException("username already exist in the portal");
}
@ -185,14 +185,14 @@ public class MigrationCreator
using var coreDbContext = _creatorDbContext.CreateDbContext<CoreDbContext>(_toRegion);
var qouta = coreDbContext.Quotas
.Where(r => r.Tenant == tenant.Id)
.Where(r => r.TenantId == tenant.Id)
.ProjectTo<TenantQuota>(_mapper.ConfigurationProvider)
.SingleOrDefault();
using var userDbContextToregion = _creatorDbContext.CreateDbContext<UserDbContext>(_toRegion);
var usersCount = userDbContextToregion.Users
.Join(userDbContextToregion.UserGroups, u => u.Id, ug => ug.Userid, (u, ug) => new { u, ug })
.Where(q => q.u.Tenant == tenant.Id && q.ug.UserGroupId == Common.Security.Authorizing.Constants.DocSpaceAdmin.ID).Count();
.Where(q => q.u.TenantId == tenant.Id && q.ug.UserGroupId == Common.Security.Authorizing.Constants.DocSpaceAdmin.ID).Count();
if (usersCount > qouta.CountRoomAdmin)
{
throw new ArgumentException("user count exceed");

View File

@ -25,15 +25,15 @@
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
namespace ASC.Migration.PersonalToDocspace.Runner;
[Scope]
public class MigrationRunner
{
private readonly DbFactory _dbFactory;
private readonly DbFactory _dbFactory;
private readonly StorageFactory _storageFactory;
private readonly StorageFactoryConfig _storageFactoryConfig;
private readonly ModuleProvider _moduleProvider;
private readonly ILogger<RestoreDbModuleTask> _logger;
private readonly ILogger<RestoreDbModuleTask> _logger;
private readonly CreatorDbContext _creatorDbContext;
private string _backupFile;
@ -46,62 +46,62 @@ public class MigrationRunner
ModuleName.Files2,
ModuleName.Tenants,
ModuleName.WebStudio
};
public MigrationRunner(
DbFactory dbFactory,
StorageFactory storageFactory,
StorageFactoryConfig storageFactoryConfig,
ModuleProvider moduleProvider,
ILogger<RestoreDbModuleTask> logger,
CreatorDbContext creatorDbContext)
{
_dbFactory = dbFactory;
_storageFactory = storageFactory;
_storageFactoryConfig = storageFactoryConfig;
_moduleProvider = moduleProvider;
_logger = logger;
_creatorDbContext = creatorDbContext;
}
};
public MigrationRunner(
DbFactory dbFactory,
StorageFactory storageFactory,
StorageFactoryConfig storageFactoryConfig,
ModuleProvider moduleProvider,
ILogger<RestoreDbModuleTask> logger,
CreatorDbContext creatorDbContext)
{
_dbFactory = dbFactory;
_storageFactory = storageFactory;
_storageFactoryConfig = storageFactoryConfig;
_moduleProvider = moduleProvider;
_logger = logger;
_creatorDbContext = creatorDbContext;
}
public async Task Run(string backupFile, string region, string fromAlias, string toAlias)
{
{
_region = region;
_modules = _moduleProvider.AllModules.Where(m => _namesModules.Contains(m.ModuleName)).ToList();
_backupFile = backupFile;
var columnMapper = new ColumnMapper();
if (!string.IsNullOrEmpty(toAlias))
{
using var dbContextTenant = _creatorDbContext.CreateDbContext<TenantDbContext>();
var fromTenant = dbContextTenant.Tenants.SingleOrDefault(q => q.Alias == fromAlias);
_backupFile = backupFile;
var columnMapper = new ColumnMapper();
if (!string.IsNullOrEmpty(toAlias))
{
using var dbContextTenant = _creatorDbContext.CreateDbContext<TenantDbContext>();
var fromTenant = dbContextTenant.Tenants.SingleOrDefault(q => q.Alias == fromAlias);
using var dbContextToTenant = _creatorDbContext.CreateDbContext<TenantDbContext>(region);
var toTenant = dbContextToTenant.Tenants.SingleOrDefault(q => q.Alias == toAlias);
toTenant.Status = TenantStatus.Restoring;
toTenant.StatusChanged = DateTime.UtcNow;
dbContextTenant.Tenants.Update(toTenant);
dbContextToTenant.SaveChanges();
columnMapper.SetMapping("tenants_tenants", "id", fromTenant.Id, toTenant.Id);
columnMapper.Commit();
using var dbContextToTenant = _creatorDbContext.CreateDbContext<TenantDbContext>(region);
var toTenant = dbContextToTenant.Tenants.SingleOrDefault(q => q.Alias == toAlias);
toTenant.Status = TenantStatus.Restoring;
toTenant.StatusChanged = DateTime.UtcNow;
dbContextTenant.Tenants.Update(toTenant);
dbContextToTenant.SaveChanges();
columnMapper.SetMapping("tenants_tenants", "id", fromTenant.Id, toTenant.Id);
columnMapper.Commit();
}
using (var dataReader = new ZipReadOperator(_backupFile))
{
foreach (var module in _modules)
{
{
Console.WriteLine($"start restore module: {module}");
var restoreTask = new RestoreDbModuleTask(_logger, module, dataReader, columnMapper, _dbFactory, false, false, _region, _storageFactory, _storageFactoryConfig, _moduleProvider);
await restoreTask.RunJob();
await restoreTask.RunJob();
Console.WriteLine($"end restore module: {module}");
}
await DoRestoreStorage(dataReader, columnMapper);
SetTenantActiveaAndTenantOwner(columnMapper.GetTenantMapping());
SetAdmin(columnMapper.GetTenantMapping());
SetTenantActiveaAndTenantOwner(columnMapper.GetTenantMapping());
SetAdmin(columnMapper.GetTenantMapping());
}
}
@ -110,7 +110,7 @@ public class MigrationRunner
var fileGroups = GetFilesToProcess(dataReader).GroupBy(file => file.Module).ToList();
foreach (var group in fileGroups)
{
{
Console.WriteLine($"start restore fileGroup: {group.Key}");
foreach (var file in group)
{
@ -137,7 +137,7 @@ public class MigrationRunner
storage.SetQuotaController(quotaController);
}
}
}
}
Console.WriteLine($"end restore fileGroup: {group.Key}");
}
}
@ -156,46 +156,46 @@ public class MigrationRunner
}
private void SetTenantActiveaAndTenantOwner(int tenantId)
{
{
using var dbContextTenant = _creatorDbContext.CreateDbContext<TenantDbContext>(_region);
using var dbContextUser = _creatorDbContext.CreateDbContext<UserDbContext>(_region);
var tenant = dbContextTenant.Tenants.Single(t => t.Id == tenantId);
tenant.Status = TenantStatus.Active;
Console.WriteLine("set tenant status");
tenant.LastModified = DateTime.UtcNow;
tenant.StatusChanged = DateTime.UtcNow;
if (!dbContextUser.Users.Any(q => q.Id == tenant.OwnerId))
{
var user = dbContextUser.Users.Single(u => u.Tenant == tenantId);
tenant.OwnerId = user.Id;
Console.WriteLine($"set ownerId {user.Id}");
}
dbContextTenant.Tenants.Update(tenant);
var tenant = dbContextTenant.Tenants.Single(t => t.Id == tenantId);
tenant.Status = TenantStatus.Active;
Console.WriteLine("set tenant status");
tenant.LastModified = DateTime.UtcNow;
tenant.StatusChanged = DateTime.UtcNow;
if (!dbContextUser.Users.Any(q => q.Id == tenant.OwnerId))
{
var user = dbContextUser.Users.Single(u => u.TenantId == tenantId);
tenant.OwnerId = user.Id;
Console.WriteLine($"set ownerId {user.Id}");
}
dbContextTenant.Tenants.Update(tenant);
dbContextTenant.SaveChanges();
}
}
private void SetAdmin(int tenantId)
{
using var dbContextTenant = _creatorDbContext.CreateDbContext<TenantDbContext>(_region);
var tenant = dbContextTenant.Tenants.Single(t => t.Id == tenantId);
using var dbContextUser = _creatorDbContext.CreateDbContext<UserDbContext>(_region);
if (!dbContextUser.UserGroups.Any(q => q.Tenant == tenantId))
{
var userGroup = new UserGroup()
{
Tenant = tenantId,
LastModified = DateTime.UtcNow,
RefType = Core.UserGroupRefType.Contains,
Removed = false,
UserGroupId = ASC.Common.Security.Authorizing.Constants.DocSpaceAdmin.ID,
Userid = tenant.OwnerId.Value
};
dbContextUser.UserGroups.Add(userGroup);
dbContextUser.SaveChanges();
{
using var dbContextTenant = _creatorDbContext.CreateDbContext<TenantDbContext>(_region);
var tenant = dbContextTenant.Tenants.Single(t => t.Id == tenantId);
using var dbContextUser = _creatorDbContext.CreateDbContext<UserDbContext>(_region);
if (!dbContextUser.UserGroups.Any(q => q.TenantId == tenantId))
{
var userGroup = new UserGroup()
{
TenantId = tenantId,
LastModified = DateTime.UtcNow,
RefType = ASC.Core.UserGroupRefType.Contains,
Removed = false,
UserGroupId = ASC.Common.Security.Authorizing.Constants.DocSpaceAdmin.ID,
Userid = tenant.OwnerId.Value
};
dbContextUser.UserGroups.Add(userGroup);
dbContextUser.SaveChanges();
}
}
}

View File

@ -6,20 +6,21 @@
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<PropertyGroup>
<NoWarn>1701;1702;EF1001</NoWarn>
<PropertyGroup>
<NoWarn>1701;1702;EF1001</NoWarn>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Build" Version="17.4.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.2">
<PrivateAssets>all</PrivateAssets>
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.2">
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="7.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\ASC.Core.Common\ASC.Core.Common.csproj" />
<ItemGroup>
<ProjectReference Include="..\..\ASC.Core.Common\ASC.Core.Common.csproj" />
<ProjectReference Include="..\..\ASC.Data.Backup.Core\ASC.Data.Backup.Core.csproj" />
</ItemGroup>
</Project>

View File

@ -24,7 +24,7 @@
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
namespace Migration;
namespace ASC.Migrations;
public class AssemblyContextFinder : ContextFinder
{

View File

@ -24,10 +24,10 @@
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
namespace Migration;
namespace ASC.Migrations;
public abstract class ContextFinder
{
private readonly Type _baseType = typeof(DbContext);
private readonly Type _baseType = typeof(DbContext);
public IEnumerable<Type> GetDependetContextsTypes()
{

View File

@ -24,12 +24,12 @@
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
namespace Migration;
namespace ASC.Migrations;
public class MigrationGenerator
{
private readonly DbContext _dbContext;
private readonly string _providerInfoProjectPath;
private readonly DbContext _dbContext;
private readonly string _providerInfoProjectPath;
private readonly string _typeName;
private readonly Regex _pattern = new Regex(@"\d+$", RegexOptions.Compiled);
private readonly string _providerName;
@ -44,8 +44,8 @@ public class MigrationGenerator
public MigrationGenerator(DbContext context, Provider provider, string providerInfoProjectPath)
{
_dbContext = context;
_providerInfoProjectPath = providerInfoProjectPath;
_dbContext = context;
_providerInfoProjectPath = providerInfoProjectPath;
_typeName = _dbContext.GetType().Name;
_providerName = provider.ToString();
}

View File

@ -24,7 +24,7 @@
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
namespace Migration;
namespace ASC.Migrations;
public class ModelDifferenceChecker
{

View File

@ -24,7 +24,7 @@
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
namespace Migration;
namespace ASC.Migrations;
public class ProjectInfoContextFinder : ContextFinder
{
@ -35,15 +35,15 @@ public class ProjectInfoContextFinder : ContextFinder
}
protected override Type[] GetAssemblyTypes()
{
try
{
var coreContextAssembly = Assembly.Load(_projectInfo.AssemblyName);
return coreContextAssembly.GetTypes();
}
catch (Exception)
{
return Array.Empty<Type>();
{
try
{
var coreContextAssembly = Assembly.Load(_projectInfo.AssemblyName);
return coreContextAssembly.GetTypes();
}
catch (Exception)
{
return Array.Empty<Type>();
}
}
}

View File

@ -24,7 +24,7 @@
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
namespace Migration;
namespace ASC.Migrations;
public static class Solution
{
@ -34,7 +34,7 @@ public static class Solution
var currentAssembly = Assembly.GetExecutingAssembly().GetName().Name;
return source.ProjectsInOrder
.Where(p =>
.Where(p =>
p.ProjectType == SolutionProjectType.KnownToBeMSBuildFormat
&& p.ProjectName != currentAssembly)
.Select(p => new ProjectInfo
@ -42,7 +42,7 @@ public static class Solution
AssemblyName = p.ProjectName,
Path = p.AbsolutePath.Replace($"{p.ProjectName}.csproj", string.Empty)
});
}
}
public static string GetProviderProjectPath(string solutionPath, ProviderInfo providerInfo)
{

View File

@ -0,0 +1,175 @@
// (c) Copyright Ascensio System SIA 2010-2022
//
// This program is a free software product.
// You can redistribute it and/or modify it under the terms
// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software
// Foundation. In accordance with Section 7(a) of the GNU AGPL 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 details, see
// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
//
// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021.
//
// The interactive user interfaces in modified source and object code versions of the Program must
// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3.
//
// Pursuant to Section 7(b) of the License you must retain the original Product logo when
// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under
// trademark law for use of our trademarks.
//
// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
using ASC.Core.Common.EF.Model;
using ASC.Core.Common.Hosting;
using ASC.Core.Common.Hosting.Extensions;
using ASC.Data.Backup.EF.Model;
using ASC.EventBus.Extensions.Logger;
using ASC.EventBus.Extensions.Logger.Extensions;
using ASC.Feed.Model;
using ASC.Files.Core.EF;
using ASC.MessagingSystem.EF.Model;
using ASC.Webhooks.Core.EF.Model;
namespace ASC.Migrations.Core;
public class MigrationContext: DbContext
{
public DbSet<AccountLinks> AccountLinks { get; set; }
public DbSet<DbTariff> Tariffs { get; set; }
public DbSet<DbTariffRow> TariffRows { get; set; }
public DbSet<DbQuota> Quotas { get; set; }
public DbSet<DbQuotaRow> QuotaRows { get; set; }
public DbSet<MobileAppInstall> MobileAppInstall { get; set; }
public DbSet<DbIPLookup> DbIPLookup { get; set; }
public DbSet<Regions> Regions { get; set; }
public DbSet<FireBaseUser> FireBaseUsers { get; set; }
public DbSet<NotifyInfo> NotifyInfo { get; set; }
public DbSet<NotifyQueue> NotifyQueue { get; set; }
public DbSet<TelegramUser> TelegramUsers { get; set; }
public DbSet<DbTenant> Tenants { get; set; }
public DbSet<DbTenantVersion> TenantVersion { get; set; }
public DbSet<DbTenantForbiden> TenantForbiden { get; set; }
public DbSet<TenantIpRestrictions> TenantIpRestrictions { get; set; }
public DbSet<DbCoreSettings> CoreSettings { get; set; }
public DbSet<User> Users { get; set; }
public DbSet<UserSecurity> UserSecurity { get; set; }
public DbSet<UserPhoto> Photos { get; set; }
public DbSet<Acl> Acl { get; set; }
public DbSet<DbGroup> Groups { get; set; }
public DbSet<UserGroup> UserGroups { get; set; }
public DbSet<Subscription> Subscriptions { get; set; }
public DbSet<DbSubscriptionMethod> SubscriptionMethods { get; set; }
public DbSet<UserDav> UsersDav { get; set; }
public DbSet<DbWebstudioSettings> WebstudioSettings { get; set; }
public DbSet<DbWebstudioUserVisit> WebstudioUserVisit { get; set; }
public DbSet<DbWebstudioIndex> WebstudioIndex { get; set; }
public DbSet<InstanceRegistration> InstanceRegistrations { get; set; }
public DbSet<AuditEvent> AuditEvents { get; set; }
public DbSet<LoginEvent> LoginEvents { get; set; }
public DbSet<BackupRecord> Backups { get; set; }
public DbSet<BackupSchedule> Schedules { get; set; }
public DbSet<IntegrationEventLogEntry> IntegrationEventLogs { get; set; }
public DbSet<FeedLast> FeedLast { get; set; }
public DbSet<FeedAggregate> FeedAggregates { get; set; }
public DbSet<FeedUsers> FeedUsers { get; set; }
public DbSet<FeedReaded> FeedReaded { get; set; }
public DbSet<WebhooksConfig> WebhooksConfigs { get; set; }
public DbSet<WebhooksLog> WebhooksLogs { get; set; }
public DbSet<DbWebhook> Webhooks { get; set; }
public DbSet<DbFile> Files { get; set; }
public DbSet<DbFolder> Folders { get; set; }
public DbSet<DbFolderTree> Tree { get; set; }
public DbSet<DbFilesBunchObjects> BunchObjects { get; set; }
public DbSet<DbFilesSecurity> Security { get; set; }
public DbSet<DbFilesThirdpartyIdMapping> ThirdpartyIdMapping { get; set; }
public DbSet<DbFilesThirdpartyAccount> ThirdpartyAccount { get; set; }
public DbSet<DbFilesTagLink> TagLink { get; set; }
public DbSet<DbFilesTag> Tag { get; set; }
public DbSet<DbFilesThirdpartyApp> ThirdpartyApp { get; set; }
public DbSet<DbFilesLink> FilesLink { get; set; }
public DbSet<DbFilesProperties> FilesProperties { get; set; }
public DbSet<FilesConverts> FilesConverts { get; set; }
public MigrationContext(DbContextOptions<MigrationContext> options) : base(options) { }
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
ModelBuilderWrapper
.From(modelBuilder, Database)
.AddAccountLinks()
.AddDbQuotaRow()
.AddDbQuota()
.AddDbTariff()
.AddDbTariffRow()
.AddMobileAppInstall()
.AddDbIPLookup()
.AddRegions()
.AddFireBaseUsers()
.AddNotifyInfo()
.AddNotifyQueue()
.AddTelegramUsers()
.AddDbTenant()
.AddCoreSettings()
.AddDbTenantForbiden()
.AddTenantIpRestrictions()
.AddDbTenantVersion()
.AddSubscriptionMethod()
.AddUser()
.AddAcl()
.AddUserSecurity()
.AddUserPhoto()
.AddDbGroup()
.AddUserGroup()
.AddSubscription()
.AddUserDav()
.AddWebstudioSettings()
.AddWebstudioUserVisit()
.AddDbWebstudioIndex()
.AddDbFiles()
.AddDbFolder()
.AddDbFolderTree()
.AddDbFilesThirdpartyAccount()
.AddDbFilesBunchObjects()
.AddDbFilesSecurity()
.AddDbFilesThirdpartyIdMapping()
.AddDbFilesTagLink()
.AddDbFilesTag()
.AddDbDbFilesThirdpartyApp()
.AddDbFilesLink()
.AddDbFilesProperties()
.AddFilesConverts()
.AddInstanceRegistration()
.AddAuditEvent()
.AddLoginEvents()
.AddBackupSchedule()
.AddBackupRecord()
.AddIntegrationEventLog()
.AddFeedUsers()
.AddFeedReaded()
.AddFeedAggregate()
.AddFeedLast()
.AddDbWebhooks()
.AddWebhooksConfig()
.AddWebhooksLog()
.AddDbFunction();
}
}

View File

@ -1,45 +1,42 @@
// (c) Copyright Ascensio System SIA 2010-2022
//
// This program is a free software product.
// You can redistribute it and/or modify it under the terms
// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software
// Foundation. In accordance with Section 7(a) of the GNU AGPL 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 details, see
// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
//
// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021.
//
// The interactive user interfaces in modified source and object code versions of the Program must
// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3.
//
// Pursuant to Section 7(b) of the License you must retain the original Product logo when
// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under
// trademark law for use of our trademarks.
//
// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
global using System.Configuration;
global using System.Reflection;
global using System.Text.RegularExpressions;
// (c) Copyright Ascensio System SIA 2010-2022
//
// This program is a free software product.
// You can redistribute it and/or modify it under the terms
// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software
// Foundation. In accordance with Section 7(a) of the GNU AGPL 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 details, see
// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
//
// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021.
//
// The interactive user interfaces in modified source and object code versions of the Program must
// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3.
//
// Pursuant to Section 7(b) of the License you must retain the original Product logo when
// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under
// trademark law for use of our trademarks.
//
// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
global using System.Reflection;
global using System.Text.RegularExpressions;
global using ASC.Core.Common.EF;
global using Autofac;
global using Microsoft.Build.Construction;
global using Microsoft.Build.Construction;
global using Microsoft.EntityFrameworkCore;
global using Microsoft.EntityFrameworkCore.Design;
global using Microsoft.EntityFrameworkCore.Infrastructure;
global using Microsoft.EntityFrameworkCore.Migrations.Design;
global using Microsoft.EntityFrameworkCore.Migrations.Operations;
global using Microsoft.EntityFrameworkCore.Storage;
global using Microsoft.Extensions.DependencyInjection;
global using Migration.Core.Models;
global using Migration.Core.Utils;
global using Microsoft.EntityFrameworkCore.Migrations.Design;
global using Microsoft.EntityFrameworkCore.Migrations.Operations;
global using Microsoft.EntityFrameworkCore.Storage;
global using Microsoft.Extensions.DependencyInjection;
global using ASC.Migrations.Core.Models;
global using ASC.Migrations.Core.Utils;

View File

@ -24,7 +24,7 @@
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
namespace Migration.Core.Models;
namespace ASC.Migrations.Core.Models;
public class ProjectInfo
{

View File

@ -24,10 +24,10 @@
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
namespace Migration.Core.Models;
namespace ASC.Migrations.Core.Models;
public class ProviderInfo
{
{
public string ConnectionString { get; set; }
public Provider Provider { get; set; }
public string ProviderFullName { get; set; }

View File

@ -1,8 +1,8 @@
{
"profiles": {
"ASC.Migration.Creator": {
"commandName": "Project",
"launchBrowser": false
}
}
{
"profiles": {
"ASC.Migration.Creator": {
"commandName": "Project",
"launchBrowser": false
}
}
}

View File

@ -24,26 +24,26 @@
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
using Microsoft.Extensions.Configuration;
namespace Migration.Core.Utils;
using Microsoft.Extensions.Configuration;
namespace ASC.Migrations.Core.Utils;
public class DbContextActivator
{
private readonly IServiceProvider _serviceProvider;
{
private readonly IServiceProvider _serviceProvider;
public DbContextActivator(IServiceProvider serviceProvider)
{
{
_serviceProvider = serviceProvider;
}
}
public DbContext CreateInstance(Type contextType, ProviderInfo provider)
{
var scope = _serviceProvider.CreateScope();
var configuration = scope.ServiceProvider.GetRequiredService<IConfiguration>();
configuration["testAssembly"] = $"ASC.Migrations.{provider.Provider}";
configuration["ConnectionStrings:default:name"] = "default";
configuration["ConnectionStrings:default:connectionString"] = provider.ConnectionString;
{
var scope = _serviceProvider.CreateScope();
var configuration = scope.ServiceProvider.GetRequiredService<IConfiguration>();
configuration["testAssembly"] = $"ASC.Migrations.{provider.Provider}";
configuration["ConnectionStrings:default:name"] = "default";
configuration["ConnectionStrings:default:connectionString"] = provider.ConnectionString;
configuration["ConnectionStrings:default:providerName"] = provider.ProviderFullName;
return (DbContext)scope.ServiceProvider.GetRequiredService(contextType);
}

View File

@ -24,7 +24,7 @@
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
namespace Migration.Core.Utils;
namespace ASC.Migrations.Core.Utils;
public static class EFCoreDesignTimeServices
{

View File

@ -1,34 +1,35 @@
// (c) Copyright Ascensio System SIA 2010-2022
//
// This program is a free software product.
// You can redistribute it and/or modify it under the terms
// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software
// Foundation. In accordance with Section 7(a) of the GNU AGPL 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 details, see
// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
//
// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021.
//
// The interactive user interfaces in modified source and object code versions of the Program must
// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3.
//
// Pursuant to Section 7(b) of the License you must retain the original Product logo when
// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under
// trademark law for use of our trademarks.
//
// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
namespace Migration.Core.Utils;
public class Options
{
public string Path { get; set; }
public IEnumerable<ProviderInfo> Providers { get; set; }
public IEnumerable<ProviderInfo> TeamlabsiteProviders { get; set; }
}
// (c) Copyright Ascensio System SIA 2010-2022
//
// This program is a free software product.
// You can redistribute it and/or modify it under the terms
// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software
// Foundation. In accordance with Section 7(a) of the GNU AGPL 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 details, see
// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
//
// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021.
//
// The interactive user interfaces in modified source and object code versions of the Program must
// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3.
//
// Pursuant to Section 7(b) of the License you must retain the original Product logo when
// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under
// trademark law for use of our trademarks.
//
// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
namespace ASC.Migrations.Core.Utils;
public class Options
{
public string Path { get; set; }
public IEnumerable<ProviderInfo> Providers { get; set; }
public IEnumerable<ProviderInfo> TeamlabsiteProviders { get; set; }
}

View File

@ -117,7 +117,7 @@ public class PeopleController : ControllerBase
private async Task<string> GetUserProfileLinkAsync(UserInfo user)
{
var tenantDomain = await GetTenantDomainAsync(user.Tenant);
var tenantDomain = await GetTenantDomainAsync(user.TenantId);
return string.Format("{0}{1}{2}/{3}",
_httpContextAccessor.HttpContext.Request.Scheme,
Uri.SchemeDelimiter,

View File

@ -116,7 +116,7 @@ public class TariffController : ControllerBase
var tariff = new Tariff
{
Quotas = new List<Quota> { new Quota(quota.Tenant, 1) },
Quotas = new List<Quota> { new Quota(quota.TenantId, 1) },
DueDate = model.DueDate != default ? model.DueDate : DateTime.MaxValue.AddSeconds(-1),
};
@ -163,7 +163,7 @@ public class TariffController : ControllerBase
var tariffs = (await HostedSolution.GetTenantQuotasAsync())
.Where(q => !q.Trial && !q.Free)
.OrderBy(q => q.CountRoomAdmin)
.ThenByDescending(q => q.Tenant)
.ThenByDescending(q => q.TenantId)
.Select(q => ToTariffWrapper(null, q));
return Ok(new

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