Skip to content

Commit

Permalink
Merge pull request #141 from ONLYOFFICE/bugfix/65836
Browse files Browse the repository at this point in the history
Bugfix/65836
  • Loading branch information
pavelbannov authored Jan 12, 2024
2 parents 173ec16 + fe5b885 commit d5d87d4
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion common/ASC.Socket.IO/app/hubs/files.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@

changeFunc(roomParts);

if (individual && !session.anonymous) {
if (individual) {
if (Array.isArray(roomParts)) {
changeFunc(roomParts.map((p) => `${p}-${userId}`));
} else {
Expand Down
7 changes: 4 additions & 3 deletions common/ASC.Socket.IO/app/middleware/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,16 +92,17 @@ 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);
}

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();
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ public class ExternalShareDto : IMapFrom<ValidationInfo>
/// <summary>Specifies whether to share the external data or not</summary>
/// <type>System.Boolean, System</type>
public bool Shared { get; set; }

/// <summary>Link ID</summary>
/// <type>System.Guid, System</type>
public Guid LinkId { get; set; }

public void Mapping(Profile profile)
{
Expand Down
4 changes: 4 additions & 0 deletions products/ASC.Files/Core/Core/Security/ExternalShare.cs
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,10 @@ public class ValidationInfo
/// <summary>Specifies whether to share the external data or not</summary>
/// <type>System.Boolean, System</type>
public bool Shared { get; set; }

/// <summary>Link ID</summary>
/// <type>System.Guid, System</type>
public Guid LinkId { get; set; }
}

public class ExternalShareData
Expand Down
1 change: 1 addition & 0 deletions products/ASC.Files/Core/Helpers/ExternalLinkHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ public async Task<ValidationInfo> ValidateAsync(string key, string password = nu

result.Access = record.Share;
result.TenantId = record.TenantId;
result.LinkId = linkId;

if (_securityContext.IsAuthenticated)
{
Expand Down

0 comments on commit d5d87d4

Please sign in to comment.