fix: preserve merchant warehouse authorities overseas
This commit is contained in:
@@ -31,6 +31,7 @@ public class OverseasTokenService {
|
||||
"platform:overseas-warehouse:",
|
||||
"platform:overseas-business:",
|
||||
"platform:overseas-master-data:",
|
||||
"merchant:warehouse:",
|
||||
"lastleg:"
|
||||
);
|
||||
|
||||
|
||||
@@ -49,10 +49,12 @@ class OverseasTokenServiceTest {
|
||||
account.setId(42L); account.setAccountStatus("ACTIVE"); account.setDefaultTenantId(999L);
|
||||
account.setDefaultMembershipId(84L); account.setDefaultAppCode("MERCHANT");
|
||||
String authority = "platform:overseas-master-data:quote:list";
|
||||
String merchantAuthority = "merchant:warehouse:delivery:list";
|
||||
String lastlegAuthority = "lastleg:pda:operate";
|
||||
String domesticAuthority = "platform:firstleg:order:list";
|
||||
AuthorizationSnapshot snapshot = new AuthorizationSnapshot(42L, 0L, 84L, "PLATFORM", "WEB",
|
||||
Set.of("OVERSEAS_WAREHOUSE_PDA_OPERATOR"), Set.of(authority, lastlegAuthority, domesticAuthority), 7L, 900L);
|
||||
Set.of("OVERSEAS_WAREHOUSE_PDA_OPERATOR"),
|
||||
Set.of(authority, merchantAuthority, lastlegAuthority, domesticAuthority), 7L, 900L);
|
||||
Jwt encoded = org.mockito.Mockito.mock(Jwt.class);
|
||||
when(accounts.findById(42L)).thenReturn(account);
|
||||
when(authorizationLoader.load(account)).thenReturn(snapshot);
|
||||
@@ -75,7 +77,7 @@ class OverseasTokenServiceTest {
|
||||
.containsEntry("token_version", 0)
|
||||
.containsEntry("overseas_warehouse_id", 900L)
|
||||
.containsEntry("roles", Set.of("OVERSEAS_WAREHOUSE_PDA_OPERATOR"))
|
||||
.containsEntry("authorities", Set.of(authority, lastlegAuthority))
|
||||
.containsEntry("authorities", Set.of(authority, merchantAuthority, lastlegAuthority))
|
||||
.doesNotContainKeys("userId", "tenantId", "appCode", "permissionVersion");
|
||||
assertThat(response.expiresIn()).isEqualTo(900);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user