Don't adjust store mode if user is performing an action

This commit is contained in:
Umar Bolatov 2021-09-19 16:19:14 -07:00 committed by Andrew Camilleri
parent 3dc663f4d8
commit 82675384c4

View file

@ -228,6 +228,14 @@ namespace BTCPayServer.Controllers
}
else if (wanted?.Any() ?? false)
{
var commandParts = vm.Command?.Split(':', StringSplitOptions.RemoveEmptyEntries) ?? Array.Empty<string>();
var command = commandParts.Length > 1 ? commandParts[1] : null;
var isPerformingAnAction = command == "change-store-mode" || command == "add-store";
// Don't want to accidentally change mode for the user if they are explicitly performing some action
if (isPerformingAnAction) {
continue;
}
if (vm.SelectiveStores && Policies.IsStorePolicy(permissionValue.Permission) &&
wanted.Any(permission => !string.IsNullOrEmpty(permission.Scope)))
{