Skip to content

Commit

Permalink
NEXT-36834 - Fix persist default permission when switching customer
Browse files Browse the repository at this point in the history
  • Loading branch information
rittou authored and keulinho committed Jun 20, 2024
1 parent 4f1c273 commit 2b81dc1
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
title: Fix persist default permissions when switching customer
issue: NEXT-36834
---
# Core
* Changed persist default permissions when you call API switching customer with empty permissions in the request body
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ private function persistPermissions(Request $request, SalesChannelContext $sales

$payload[SalesChannelContextService::PERMISSIONS] = $requestPermissions
? \array_fill_keys($requestPermissions, true)
: [self::ADMIN_ORDER_PERMISSIONS];
: self::ADMIN_ORDER_PERMISSIONS;

$this->contextPersister->save($contextToken, $payload, $salesChannelId);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,9 @@ public function testSwitchCustomer(): void
$payload = $this->contextPersister->load($response->headers->get(PlatformRequest::HEADER_CONTEXT_TOKEN, ''), $salesChannel['id']);
static::assertArrayHasKey('customerId', $payload);
static::assertEquals($customerId, $payload['customerId']);
static::assertArrayHasKey('permissions', $payload);
static::assertArrayHasKey('allowProductPriceOverwrites', $payload['permissions']);
static::assertTrue($payload['permissions']['allowProductPriceOverwrites']);
}

public function testSwitchCustomerWithPermissions(): void
Expand Down

0 comments on commit 2b81dc1

Please sign in to comment.