Skip to content

Commit

Permalink
fix Bug 65277
Browse files Browse the repository at this point in the history
  • Loading branch information
SuhorukovAnton committed Dec 7, 2023
1 parent 502c124 commit bc7ecf0
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion web/ASC.Web.Api/Api/Settings/TfaappController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public class TfaappController : BaseSettingsController
private readonly InstanceCrypto _instanceCrypto;
private readonly Signature _signature;
private readonly SecurityContext _securityContext;
private readonly TenantManager _tenantManager;

public TfaappController(
MessageService messageService,
Expand All @@ -69,7 +70,8 @@ public TfaappController(
InstanceCrypto instanceCrypto,
Signature signature,
SecurityContext securityContext,
IHttpContextAccessor httpContextAccessor) : base(apiContext, memoryCache, webItemManager, httpContextAccessor)
IHttpContextAccessor httpContextAccessor,
TenantManager tenantManager) : base(apiContext, memoryCache, webItemManager, httpContextAccessor)
{
_smsProviderManager = smsProviderManager;
_messageService = messageService;
Expand All @@ -88,6 +90,7 @@ public TfaappController(
_instanceCrypto = instanceCrypto;
_signature = signature;
_securityContext = securityContext;
_tenantManager = tenantManager;
}

/// <summary>
Expand Down Expand Up @@ -435,6 +438,11 @@ public async Task<object> TfaAppNewAppAsync(TfaRequestsDto inDto)
throw new SecurityAccessDeniedException(Resource.ErrorAccessDenied);
}

if (!isMe && _tenantManager.GetCurrentTenant().OwnerId != _authContext.CurrentAccount.ID)
{
throw new SecurityAccessDeniedException(Resource.ErrorAccessDenied);
}

if (!_tfaAppAuthSettingsHelper.IsVisibleSettings || !await TfaAppUserSettings.EnableForUserAsync(_settingsManager, user.Id))
{
throw new Exception(Resource.TfaAppNotAvailable);
Expand Down

0 comments on commit bc7ecf0

Please sign in to comment.