diff --git a/common/ASC.Socket.IO/app/hubs/files.js b/common/ASC.Socket.IO/app/hubs/files.js index b2651afb9a2..c68bfea88ff 100644 --- a/common/ASC.Socket.IO/app/hubs/files.js +++ b/common/ASC.Socket.IO/app/hubs/files.js @@ -89,7 +89,7 @@ changeFunc(roomParts); - if (individual && !session.anonymous) { + if (individual) { if (Array.isArray(roomParts)) { changeFunc(roomParts.map((p) => `${p}-${userId}`)); } else { diff --git a/common/ASC.Socket.IO/app/middleware/auth.js b/common/ASC.Socket.IO/app/middleware/auth.js index bd58d098de8..4c5e261eacc 100644 --- a/common/ASC.Socket.IO/app/middleware/auth.js +++ b/common/ASC.Socket.IO/app/middleware/auth.js @@ -92,8 +92,8 @@ module.exports = (socket, next) => { headers, basePath, }) - .then((validation) => { - if (validation.status !== 0) { + .then(({ status, tenantId, linkId } = { }) => { + if (status !== 0) { const err = new Error("Invalid share key"); logger.error("WS: share key validation failure:", err); return next(err); @@ -101,7 +101,8 @@ module.exports = (socket, next) => { logger.info(`WS: share key validation successful: key='${share}' sessionId='sess:${session.id}'`); session.anonymous = true; - session.portal = { tenantId: validation.tenantId }; + session.portal = { tenantId }; + session.user = { id: linkId } session.save(); next(); }) diff --git a/products/ASC.Files/Core/ApiModels/ResponseDto/ExternalShareDto.cs b/products/ASC.Files/Core/ApiModels/ResponseDto/ExternalShareDto.cs index d47fc8ff051..a177079c3d2 100644 --- a/products/ASC.Files/Core/ApiModels/ResponseDto/ExternalShareDto.cs +++ b/products/ASC.Files/Core/ApiModels/ResponseDto/ExternalShareDto.cs @@ -60,6 +60,10 @@ public class ExternalShareDto : IMapFrom /// Specifies whether to share the external data or not /// System.Boolean, System public bool Shared { get; set; } + + /// Link ID + /// System.Guid, System + public Guid LinkId { get; set; } public void Mapping(Profile profile) { diff --git a/products/ASC.Files/Core/Core/Security/ExternalShare.cs b/products/ASC.Files/Core/Core/Security/ExternalShare.cs index 0d1c5530a0d..668bda8f01c 100644 --- a/products/ASC.Files/Core/Core/Security/ExternalShare.cs +++ b/products/ASC.Files/Core/Core/Security/ExternalShare.cs @@ -362,6 +362,10 @@ public class ValidationInfo /// Specifies whether to share the external data or not /// System.Boolean, System public bool Shared { get; set; } + + /// Link ID + /// System.Guid, System + public Guid LinkId { get; set; } } public class ExternalShareData diff --git a/products/ASC.Files/Core/Helpers/ExternalLinkHelper.cs b/products/ASC.Files/Core/Helpers/ExternalLinkHelper.cs index e03a18efa69..bfde92a8dbb 100644 --- a/products/ASC.Files/Core/Helpers/ExternalLinkHelper.cs +++ b/products/ASC.Files/Core/Helpers/ExternalLinkHelper.cs @@ -89,6 +89,7 @@ public async Task ValidateAsync(string key, string password = nu result.Access = record.Share; result.TenantId = record.TenantId; + result.LinkId = linkId; if (_securityContext.IsAuthenticated) {