This commit is contained in:
2026-08-28 11:28:30 +08:00
parent 1e5ce54858
commit f998bed09c
9 changed files with 140 additions and 31 deletions
@@ -163,6 +163,10 @@ public class PlatformUserManagementService {
call(() -> authClient.revokeSessions(internalToken,
new AuthAccountClient.RevokeAccountSessionsRequest(Set.of(user.getAuthUserId()))));
}
if (rolesChanged || warehouseChanged || scopeChanged) {
securityEvents.permissionChanged(user.getAuthUserId(), newTenantId,
appCode(newTenantId), "PLATFORM_USER_AUTHORIZATION_CHANGED");
}
} catch (RuntimeException localFailure) {
compensateUpdate(user.getAuthUserId(), membershipId, oldTenantId, oldAccount,
profileChanged, scopeChanged, localFailure);
@@ -159,6 +159,8 @@ class PlatformUserManagementServiceTest {
assertEquals(900L, membership.getOverseasWarehouseId());
assertEquals(900L, response.overseasWarehouseId());
verify(auth).revokeSessions(eq("internal-token"), any());
verify(securityEvents).permissionChanged(10L, 0L, "PLATFORM",
"PLATFORM_USER_AUTHORIZATION_CHANGED");
}
@Test
@@ -195,6 +197,8 @@ class PlatformUserManagementServiceTest {
assertEquals(901L, response.overseasWarehouseId());
verify(auth).revokeSessions(eq("internal-token"),
eq(new AuthAccountClient.RevokeAccountSessionsRequest(Set.of(10L))));
verify(securityEvents).permissionChanged(10L, 0L, "PLATFORM",
"PLATFORM_USER_AUTHORIZATION_CHANGED");
}
@Test
@@ -209,6 +213,8 @@ class PlatformUserManagementServiceTest {
assertNull(response.overseasWarehouseId());
verify(auth).revokeSessions(eq("internal-token"),
eq(new AuthAccountClient.RevokeAccountSessionsRequest(Set.of(10L))));
verify(securityEvents).permissionChanged(10L, 0L, "PLATFORM",
"PLATFORM_USER_AUTHORIZATION_CHANGED");
}
@Test