Merge pull request #790 from ONLYOFFICE/feature/rooms-info
Feature/rooms info
This commit is contained in:
commit
da6c47e1d8
@ -105,7 +105,7 @@ public class AbstractDao
|
||||
using var filesDbContext = _dbContextFactory.CreateDbContext();
|
||||
var folders = await filesDbContext.Folders
|
||||
.Where(r => r.TenantId == TenantID)
|
||||
.Where(r => filesDbContext.Tree.Where(r => r.FolderId == folderId).Any(a => r.ParentId == r.Id))
|
||||
.Where(r => filesDbContext.Tree.Where(r => r.FolderId == folderId).Any(a => a.ParentId == r.Id))
|
||||
.ToListAsync();
|
||||
|
||||
foreach (var f in folders)
|
||||
|
@ -47,10 +47,29 @@ public class VirtualRoomsInternalController : VirtualRoomsController<int>
|
||||
FileSecurityCommon fileSecurityCommon,
|
||||
EmailValidationKeyProvider emailValidationKeyProvider,
|
||||
FolderDtoHelper folderDtoHelper,
|
||||
FileDtoHelper fileDtoHelper) : base(foldersControllerHelper, globalFolderHelper, fileOperationDtoHelper, securityControllerHelper, coreBaseSettings, authContext, roomLinksService, customTagsService, roomLogoManager, studioNotifyService, fileStorageService, fileSecurity, fileSecurityCommon, emailValidationKeyProvider, folderDtoHelper, fileDtoHelper)
|
||||
FileDtoHelper fileDtoHelper,
|
||||
FileShareDtoHelper fileShareDtoHelper) : base(
|
||||
foldersControllerHelper,
|
||||
globalFolderHelper,
|
||||
fileOperationDtoHelper,
|
||||
securityControllerHelper,
|
||||
coreBaseSettings,
|
||||
authContext,
|
||||
roomLinksService,
|
||||
customTagsService,
|
||||
roomLogoManager,
|
||||
studioNotifyService,
|
||||
fileStorageService,
|
||||
fileSecurity,
|
||||
fileSecurityCommon,
|
||||
emailValidationKeyProvider,
|
||||
folderDtoHelper,
|
||||
fileDtoHelper,
|
||||
fileShareDtoHelper)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Create a room in the virtual rooms section
|
||||
/// </summary>
|
||||
@ -95,7 +114,25 @@ public class VirtualRoomsThirdPartyController : VirtualRoomsController<string>
|
||||
FileSecurityCommon fileSecurityCommon,
|
||||
EmailValidationKeyProvider emailValidationKeyProvider,
|
||||
FolderDtoHelper folderDtoHelper,
|
||||
FileDtoHelper fileDtoHelper) : base(foldersControllerHelper, globalFolderHelper, fileOperationDtoHelper, securityControllerHelper, coreBaseSettings, authContext, roomLinksService, customTagsService, roomLogoManager, studioNotifyService, fileStorageService, fileSecurity, fileSecurityCommon, emailValidationKeyProvider, folderDtoHelper, fileDtoHelper)
|
||||
FileDtoHelper fileDtoHelper,
|
||||
FileShareDtoHelper fileShareDtoHelper) : base(
|
||||
foldersControllerHelper,
|
||||
globalFolderHelper,
|
||||
fileOperationDtoHelper,
|
||||
securityControllerHelper,
|
||||
coreBaseSettings,
|
||||
authContext,
|
||||
roomLinksService,
|
||||
customTagsService,
|
||||
roomLogoManager,
|
||||
studioNotifyService,
|
||||
fileStorageService,
|
||||
fileSecurity,
|
||||
fileSecurityCommon,
|
||||
emailValidationKeyProvider,
|
||||
folderDtoHelper,
|
||||
fileDtoHelper,
|
||||
fileShareDtoHelper)
|
||||
{
|
||||
}
|
||||
|
||||
@ -144,10 +181,26 @@ public abstract class VirtualRoomsController<T> : ApiControllerBase
|
||||
private readonly FileSecurity _fileSecurity;
|
||||
private readonly FileSecurityCommon _fileSecurityCommon;
|
||||
private readonly EmailValidationKeyProvider _emailValidationKeyProvider;
|
||||
private readonly FileShareDtoHelper _fileShareDtoHelper;
|
||||
|
||||
protected VirtualRoomsController(FoldersControllerHelper<T> foldersControllerHelper, GlobalFolderHelper globalFolderHelper, FileOperationDtoHelper fileOperationDtoHelper, SecurityControllerHelper<T> securityControllerHelper, CoreBaseSettings coreBaseSettings, AuthContext authContext, RoomInvitationLinksService roomLinksService, CustomTagsService<T> customTagsService, RoomLogoManager roomLogoManager, StudioNotifyService studioNotifyService, FileStorageService<T> fileStorageService, FileSecurity fileSecurity, FileSecurityCommon fileSecurityCommon, EmailValidationKeyProvider emailValidationKeyProvider,
|
||||
protected VirtualRoomsController(
|
||||
FoldersControllerHelper<T> foldersControllerHelper,
|
||||
GlobalFolderHelper globalFolderHelper,
|
||||
FileOperationDtoHelper fileOperationDtoHelper,
|
||||
SecurityControllerHelper<T> securityControllerHelper,
|
||||
CoreBaseSettings coreBaseSettings,
|
||||
AuthContext authContext,
|
||||
RoomInvitationLinksService roomLinksService,
|
||||
CustomTagsService<T> customTagsService,
|
||||
RoomLogoManager roomLogoManager,
|
||||
StudioNotifyService studioNotifyService,
|
||||
FileStorageService<T> fileStorageService,
|
||||
FileSecurity fileSecurity,
|
||||
FileSecurityCommon fileSecurityCommon,
|
||||
EmailValidationKeyProvider emailValidationKeyProvider,
|
||||
FolderDtoHelper folderDtoHelper,
|
||||
FileDtoHelper fileDtoHelper) : base(folderDtoHelper, fileDtoHelper)
|
||||
FileDtoHelper fileDtoHelper,
|
||||
FileShareDtoHelper fileShareDtoHelper) : base(folderDtoHelper, fileDtoHelper)
|
||||
{
|
||||
_foldersControllerHelper = foldersControllerHelper;
|
||||
_globalFolderHelper = globalFolderHelper;
|
||||
@ -163,44 +216,26 @@ public abstract class VirtualRoomsController<T> : ApiControllerBase
|
||||
_fileSecurity = fileSecurity;
|
||||
_fileSecurityCommon = fileSecurityCommon;
|
||||
_emailValidationKeyProvider = emailValidationKeyProvider;
|
||||
_fileShareDtoHelper = fileShareDtoHelper;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Getting the contents of a virtual room
|
||||
/// Getting virtual room information
|
||||
/// </summary>
|
||||
/// <param name="id">
|
||||
/// Room ID
|
||||
/// </param>
|
||||
/// <param name="startIndex">
|
||||
/// The value of the beginning of the enumeration
|
||||
/// </param>
|
||||
/// <param name="count">
|
||||
/// Quantity
|
||||
/// </param>
|
||||
/// <param name="filterValue">
|
||||
/// Filter by name
|
||||
/// </param>
|
||||
/// <param name="userOrGroupId">
|
||||
/// User or Group ID
|
||||
/// </param>
|
||||
/// <param name="filterType">
|
||||
/// Content filtering type
|
||||
/// </param>
|
||||
/// <param name="searchInContent">
|
||||
/// Full-text content search
|
||||
/// </param>
|
||||
/// <param name="withSubFolders">
|
||||
/// Search by subfolders
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// Room content
|
||||
/// Room info
|
||||
/// </returns>
|
||||
[HttpGet("rooms/{id}")]
|
||||
public async Task<FolderContentDto<T>> GetRoomAsync(T id, Guid? userOrGroupId, FilterType? filterType, bool? searchInContent, bool? withSubFolders)
|
||||
public async Task<FolderDto<T>> GetRoomInfoAsync(T id)
|
||||
{
|
||||
ErrorIfNotDocSpace();
|
||||
|
||||
return await _foldersControllerHelper.GetFolderAsync(id, userOrGroupId, filterType, searchInContent, withSubFolders);
|
||||
var folder = await _fileStorageService.GetFolderAsync(id).NotFoundIfNull("Folder not found");
|
||||
|
||||
return await _folderDtoHelper.GetAsync(folder);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -354,6 +389,24 @@ public abstract class VirtualRoomsController<T> : ApiControllerBase
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Getting security information about a room
|
||||
/// </summary>
|
||||
/// <param name="id">
|
||||
/// Room ID
|
||||
/// </param>
|
||||
/// <returns>Room security info</returns>
|
||||
[HttpGet("rooms/{id}/share")]
|
||||
public async IAsyncEnumerable<FileShareDto> GetRoomSecurityInfo(T id)
|
||||
{
|
||||
var fileShares = await _fileStorageService.GetSharedInfoAsync(Array.Empty<T>(), new[] { id });
|
||||
|
||||
foreach (var fileShareDto in fileShares)
|
||||
{
|
||||
yield return await _fileShareDtoHelper.Get(fileShareDto);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Getting an invitation link to a virtual room
|
||||
/// </summary>
|
||||
|
@ -60,6 +60,8 @@ public class CommonLinkUtility : BaseCommonLinkUtility
|
||||
|
||||
public const string ParamName_ProductSysName = "product";
|
||||
public const string ParamName_UserUserID = "uid";
|
||||
public const string AbsoluteAccountsPath = "/accounts/";
|
||||
public const string VirtualAccountsPath = "~/accounts/";
|
||||
|
||||
private readonly UserManager _userManager;
|
||||
private readonly WebItemManagerSecurity _webItemManagerSecurity;
|
||||
@ -173,7 +175,7 @@ public class CommonLinkUtility : BaseCommonLinkUtility
|
||||
queryParams = guid != Guid.Empty ? GetUserParamsPair(guid) : HttpUtility.UrlEncode(user.ToLowerInvariant());
|
||||
}
|
||||
|
||||
var url = absolute ? ToAbsolute("~/products/people/") : "/products/people/";
|
||||
var url = absolute ? ToAbsolute(VirtualAccountsPath) : AbsoluteAccountsPath;
|
||||
url += "view/";
|
||||
url += queryParams;
|
||||
|
||||
@ -184,7 +186,7 @@ public class CommonLinkUtility : BaseCommonLinkUtility
|
||||
{
|
||||
var queryParams = user.Id != Guid.Empty ? GetUserParamsPair(user) : HttpUtility.UrlEncode(user.UserName.ToLowerInvariant());
|
||||
|
||||
var url = absolute ? ToAbsolute("~/products/people/") : "/products/people/";
|
||||
var url = absolute ? ToAbsolute(VirtualAccountsPath) : AbsoluteAccountsPath;
|
||||
url += "view/";
|
||||
url += queryParams;
|
||||
|
||||
@ -194,7 +196,7 @@ public class CommonLinkUtility : BaseCommonLinkUtility
|
||||
{
|
||||
var queryParams = GetUserParamsPair(user);
|
||||
|
||||
var url = absolute ? ToAbsolute("~/products/people/") : "/products/people/";
|
||||
var url = absolute ? ToAbsolute(VirtualAccountsPath) : AbsoluteAccountsPath;
|
||||
url += "view/";
|
||||
url += queryParams;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user