fix: refresh overseas authorization on user status change
This commit is contained in:
@@ -106,6 +106,8 @@ class MemberServiceTest {
|
||||
assertEquals("DISABLED", result.status());
|
||||
verify(repository).save(member);
|
||||
verify(repository).saveUser(user);
|
||||
verify(securityEvents).userStatus(40L, 100L, "MERCHANT", "DISABLED");
|
||||
verify(securityEvents).permissionChanged(40L, 100L, "MERCHANT", "MEMBER_STATUS_CHANGED");
|
||||
}
|
||||
|
||||
@Test void shouldHandleCase05() {
|
||||
|
||||
@@ -142,6 +142,19 @@ class PlatformInternalUserServiceTest {
|
||||
verify(auth, never()).status(anyString(), anyLong(), any());
|
||||
}
|
||||
|
||||
@Test
|
||||
void statusChangePublishesMatchingAuthorizationSnapshot() {
|
||||
when(auth.status(anyString(), eq(10L), any())).thenReturn(ApiResponse.success(null));
|
||||
|
||||
InternalUserResponse result = service.changeStatus(30L,
|
||||
new ChangeInternalUserStatusRequest("DISABLED"), 99L);
|
||||
|
||||
assertEquals("DISABLED", result.status());
|
||||
verify(securityEvents).userStatus(10L, 0L, "PLATFORM", "DISABLED");
|
||||
verify(securityEvents).permissionChanged(10L, 0L, "PLATFORM",
|
||||
"PLATFORM_INTERNAL_USER_STATUS_CHANGED");
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldHandleCase05() {
|
||||
when(auth.status(anyString(), eq(10L), any())).thenReturn(ApiResponse.success(null));
|
||||
|
||||
@@ -224,6 +224,20 @@ class PlatformUserManagementServiceTest {
|
||||
verify(auth, never()).status(anyString(), anyLong(), any());
|
||||
}
|
||||
|
||||
@Test
|
||||
void statusChangePublishesMatchingAuthorizationSnapshot() {
|
||||
when(auth.status(anyString(), eq(10L), any())).thenReturn(ApiResponse.success(null));
|
||||
when(auth.summary("internal-token", 10L)).thenReturn(ApiResponse.success(
|
||||
new AuthAccountClient.AccountSummary(10L, "operator", "平台运营", "ACTIVE")));
|
||||
when(members.findRoleIds(0L, 30L)).thenReturn(List.of(40001L));
|
||||
|
||||
UserResponse result = service.changeStatus(30L, new ChangeStatusRequest("ACTIVE"), 99L);
|
||||
|
||||
assertEquals("ACTIVE", result.status());
|
||||
verify(securityEvents).userStatus(10L, 0L, "PLATFORM", "ACTIVE");
|
||||
verify(securityEvents).permissionChanged(10L, 0L, "PLATFORM", "PLATFORM_USER_STATUS_CHANGED");
|
||||
}
|
||||
|
||||
@Test
|
||||
void builtInPlatformAdministratorCannotBeDisabled() {
|
||||
IamRole platformAdmin = new IamRole();
|
||||
|
||||
Reference in New Issue
Block a user