Add customer pricing permissions and update related tests
This commit is contained in:
@@ -144,10 +144,25 @@ it('limits department customer pricing to assigned limited-backoffice department
|
||||
$otherFixture = department_customer_pricing_setup(['name' => 'Denied Scoped Customer Pricing Department']);
|
||||
$session = api_fixtures()->createUserSession([
|
||||
limited_backoffice_service::PERMISSION_ACCESS,
|
||||
limited_backoffice_service::PERMISSION_MANAGE_PRICES,
|
||||
limited_backoffice_service::PERMISSION_VIEW_CUSTOMER_PRICING,
|
||||
limited_backoffice_service::PERMISSION_MANAGE_CUSTOMER_PRICING,
|
||||
'department_access_' . (int)$fixture['department']['id'],
|
||||
]);
|
||||
|
||||
api_client()
|
||||
->get(
|
||||
'/limited-backoffice/departments/' . (int)$fixture['department']['id'] .
|
||||
'/customer-pricing?user_id=' . (int)$fixture['customer']['id'],
|
||||
api_fixtures()->createUserSession([
|
||||
limited_backoffice_service::PERMISSION_ACCESS,
|
||||
'department_access_' . (int)$fixture['department']['id'],
|
||||
])['headers']
|
||||
)
|
||||
->assertStatus(403)
|
||||
->assertEnvelope()
|
||||
->assertSuccess(false)
|
||||
->assertMissingPermissions([limited_backoffice_service::PERMISSION_VIEW_CUSTOMER_PRICING]);
|
||||
|
||||
api_client()
|
||||
->get(
|
||||
'/limited-backoffice/departments/' . (int)$otherFixture['department']['id'] .
|
||||
@@ -159,6 +174,24 @@ it('limits department customer pricing to assigned limited-backoffice department
|
||||
->assertSuccess(false)
|
||||
->assertMissingPermissions(['department_access_' . (int)$otherFixture['department']['id']]);
|
||||
|
||||
api_client()
|
||||
->put(
|
||||
'/limited-backoffice/departments/' . (int)$fixture['department']['id'] . '/customer-pricing',
|
||||
[
|
||||
'user_id' => $fixture['customer']['id'],
|
||||
'overrides' => [],
|
||||
],
|
||||
api_fixtures()->createUserSession([
|
||||
limited_backoffice_service::PERMISSION_ACCESS,
|
||||
limited_backoffice_service::PERMISSION_VIEW_CUSTOMER_PRICING,
|
||||
'department_access_' . (int)$fixture['department']['id'],
|
||||
])['headers']
|
||||
)
|
||||
->assertStatus(403)
|
||||
->assertEnvelope()
|
||||
->assertSuccess(false)
|
||||
->assertMissingPermissions([limited_backoffice_service::PERMISSION_MANAGE_CUSTOMER_PRICING]);
|
||||
|
||||
$updated = api_client()->put(
|
||||
'/limited-backoffice/departments/' . (int)$fixture['department']['id'] . '/customer-pricing',
|
||||
[
|
||||
|
||||
Reference in New Issue
Block a user