Files: added comunity compability
This commit is contained in:
parent
5bcbae5711
commit
30d0ca4b97
@ -730,7 +730,7 @@ internal class TagDao<T> : AbstractDao, ITagDao<T>
|
||||
.Where(r => r.mapping.TenantId == r.tagLink.Link.TenantId)
|
||||
.Join(ctx.ThirdpartyAccount, r => r.mapping.TenantId, r => r.TenantId, (tagLinkMapping, account) => new { tagLinkMapping.tagLink, tagLinkMapping.mapping, account })
|
||||
.Where(r => r.account.UserId != subject &&
|
||||
r.account.RootFolderType == FolderType.USER &&
|
||||
r.account.FolderType == FolderType.USER &&
|
||||
(r.mapping.Id.StartsWith("sbox-" + r.account.Id) ||
|
||||
r.mapping.Id.StartsWith("box-" + r.account.Id) ||
|
||||
r.mapping.Id.StartsWith("dropbox-" + r.account.Id) ||
|
||||
@ -801,7 +801,7 @@ internal class TagDao<T> : AbstractDao, ITagDao<T>
|
||||
.Join(ctx.ThirdpartyIdMapping, r => r.Link.EntryId, r => r.HashId, (tagLink, mapping) => new { tagLink, mapping })
|
||||
.Where(r => r.mapping.TenantId == tenantId && r.tagLink.Tag.Owner == subject && r.tagLink.Link.EntryType == FileEntryType.Folder)
|
||||
.Join(ctx.ThirdpartyAccount, r => r.mapping.Id, r => r.FolderId, (tagLinkData, account) => new { tagLinkData, account })
|
||||
.Where(r => r.tagLinkData.mapping.Id == r.account.FolderId && r.account.RootFolderType == FolderType.VirtualRooms)
|
||||
.Where(r => r.tagLinkData.mapping.Id == r.account.FolderId && r.account.FolderType == FolderType.VirtualRooms)
|
||||
.Select(r => r.tagLinkData.tagLink).Distinct()
|
||||
);
|
||||
|
||||
@ -815,7 +815,7 @@ internal class TagDao<T> : AbstractDao, ITagDao<T>
|
||||
static readonly Func<FilesDbContext, int, FolderType, Guid, IAsyncEnumerable<int>> _getThirdpartyAccountQuery = Microsoft.EntityFrameworkCore.EF.CompileAsyncQuery((FilesDbContext ctx, int tenantId, FolderType folderType, Guid subject) =>
|
||||
ctx.ThirdpartyAccount
|
||||
.Where(r => r.TenantId == tenantId)
|
||||
.Where(r => r.RootFolderType == folderType)
|
||||
.Where(r => r.FolderType == folderType)
|
||||
.Where(r => folderType != FolderType.USER || r.UserId == subject)
|
||||
.Select(r => r.Id));
|
||||
|
||||
|
@ -35,8 +35,8 @@ public class DbFilesThirdpartyAccount : BaseEntity, IDbFile, IDbSearch
|
||||
public string Password { get; set; }
|
||||
public string Token { get; set; }
|
||||
public Guid UserId { get; set; }
|
||||
public FolderType RootFolderType { get; set; }
|
||||
public FolderType FolderType { get; set; }
|
||||
public FolderType RoomType { get; set; }
|
||||
public DateTime CreateOn { get; set; }
|
||||
public string Url { get; set; }
|
||||
public int TenantId { get; set; }
|
||||
@ -80,8 +80,8 @@ public static class DbFilesThirdpartyAccountExtension
|
||||
.HasCharSet("utf8")
|
||||
.UseCollation("utf8_general_ci");
|
||||
|
||||
entity.Property(e => e.RootFolderType).HasColumnName("root_folder_type");
|
||||
entity.Property(e => e.FolderType).HasColumnName("folder_type");
|
||||
entity.Property(e => e.RoomType).HasColumnName("room_type");
|
||||
|
||||
entity.Property(e => e.Password)
|
||||
.IsRequired()
|
||||
@ -150,8 +150,8 @@ public static class DbFilesThirdpartyAccountExtension
|
||||
.HasColumnName("customer_title")
|
||||
.HasMaxLength(400);
|
||||
|
||||
entity.Property(e => e.RootFolderType).HasColumnName("root_folder_type");
|
||||
entity.Property(e => e.FolderType).HasColumnType("folder_type");
|
||||
entity.Property(e => e.FolderType).HasColumnName("root_folder_type");
|
||||
entity.Property(e => e.RoomType).HasColumnType("folder_type");
|
||||
|
||||
entity.Property(e => e.Password)
|
||||
.IsRequired()
|
||||
|
@ -137,7 +137,7 @@ internal class ProviderAccountDao : IProviderDao
|
||||
.Where(r => r.TenantId == tenantId)
|
||||
.Where(r => !(folderType == FolderType.USER || folderType == FolderType.DEFAULT && linkId == -1) || r.UserId == userId)
|
||||
.Where(r => linkId == -1 || r.Id == linkId)
|
||||
.Where(r => folderType == FolderType.DEFAULT || r.RootFolderType == folderType)
|
||||
.Where(r => folderType == FolderType.DEFAULT || r.FolderType == folderType)
|
||||
.Where(r => searchText == "" || r.Title.ToLower().Contains(searchText)));
|
||||
|
||||
private IAsyncEnumerable<IProviderInfo> GetProvidersInfoInternalAsync(int linkId = -1, FolderType folderType = FolderType.DEFAULT, string searchText = null)
|
||||
@ -186,7 +186,7 @@ internal class ProviderAccountDao : IProviderDao
|
||||
Title = Global.ReplaceInvalidCharsAndTruncate(customerTitle),
|
||||
UserName = authData.Login ?? "",
|
||||
Password = EncryptPassword(authData.Password),
|
||||
RootFolderType = folderType,
|
||||
FolderType = folderType,
|
||||
CreateOn = _tenantUtil.DateTimeToUtc(_tenantUtil.DateTimeNow()),
|
||||
UserId = _securityContext.CurrentAccount.ID,
|
||||
Token = EncryptPassword(authData.Token ?? ""),
|
||||
@ -216,7 +216,7 @@ internal class ProviderAccountDao : IProviderDao
|
||||
return false;
|
||||
}
|
||||
|
||||
forUpdate.RootFolderType = rootFolderType;
|
||||
forUpdate.FolderType = rootFolderType;
|
||||
|
||||
await FilesDbContext.SaveChangesAsync().ConfigureAwait(false);
|
||||
|
||||
@ -235,7 +235,7 @@ internal class ProviderAccountDao : IProviderDao
|
||||
return false;
|
||||
}
|
||||
|
||||
forUpdate.FolderType = folderType;
|
||||
forUpdate.RoomType = folderType;
|
||||
forUpdate.FolderId = folderId;
|
||||
|
||||
await FilesDbContext.SaveChangesAsync().ConfigureAwait(false);
|
||||
@ -325,7 +325,7 @@ internal class ProviderAccountDao : IProviderDao
|
||||
|
||||
if (folderType != FolderType.DEFAULT)
|
||||
{
|
||||
t.RootFolderType = folderType;
|
||||
t.FolderType = folderType;
|
||||
}
|
||||
|
||||
if (userId.HasValue)
|
||||
@ -409,7 +409,7 @@ internal class ProviderAccountDao : IProviderDao
|
||||
UserName = authData.Login,
|
||||
Password = EncryptPassword(authData.Password),
|
||||
UserId = owner,
|
||||
RootFolderType = type,
|
||||
FolderType = type,
|
||||
CreateOn = createOn,
|
||||
Provider = providerKey.ToString()
|
||||
};
|
||||
@ -428,8 +428,8 @@ internal class ProviderAccountDao : IProviderDao
|
||||
var providerTitle = input.Title ?? string.Empty;
|
||||
var token = DecryptToken(input.Token, id);
|
||||
var owner = input.UserId;
|
||||
var rootFolderType = input.RootFolderType;
|
||||
var folderType = input.FolderType;
|
||||
var rootFolderType = input.FolderType;
|
||||
var folderType = input.RoomType;
|
||||
var folderId = input.FolderId;
|
||||
var createOn = _tenantUtil.DateTimeFromUtc(input.CreateOn);
|
||||
var authData = new AuthData(input.Url, input.UserName, DecryptPassword(input.Password, id), token);
|
||||
|
Loading…
Reference in New Issue
Block a user