优化
This commit is contained in:
@@ -349,6 +349,22 @@ class RbacServiceTest {
|
||||
eq(new AuthAccountClient.RevokeAccountSessionsRequest(Set.of(501L))));
|
||||
}
|
||||
|
||||
@Test
|
||||
void permissionStatusChangeRevokesMembersOfEveryGrantedRole() {
|
||||
IamPermission custom = permission(21L, 100L, "merchant:custom:edit");
|
||||
when(repository.findOwnedPermission(21L, 100L, "MERCHANT")).thenReturn(custom);
|
||||
when(repository.findRoleIdsByPermission(100L, 21L)).thenReturn(Set.of(11L, 12L));
|
||||
when(repository.findAssignedAuthUserIds(100L, 11L)).thenReturn(List.of(501L, 502L));
|
||||
when(repository.findAssignedAuthUserIds(100L, 12L)).thenReturn(List.of(502L, 503L));
|
||||
when(authClient.revokeSessions(any(), any())).thenReturn(ApiResponse.success(null));
|
||||
|
||||
service.changePermissionStatus(100L, "MERCHANT", 21L,
|
||||
new ChangePermissionStatusRequest("DISABLED"));
|
||||
|
||||
verify(authClient).revokeSessions(eq("test-internal-token"),
|
||||
eq(new AuthAccountClient.RevokeAccountSessionsRequest(Set.of(501L, 502L, 503L))));
|
||||
}
|
||||
|
||||
@Test
|
||||
void authFailureRejectsRoleStatusChangeSoIamTransactionCanRollBack() {
|
||||
IamRole role = role(11L, 100L, "MERCHANT", "CUSTOM");
|
||||
|
||||
Reference in New Issue
Block a user