优化
This commit is contained in:
@@ -13,7 +13,7 @@ public final class AuditPlatformScopeGuard {
|
||||
if (user == null || user.userId() == null) {
|
||||
throw new BizException(ResultCode.UNAUTHORIZED, "请先登录");
|
||||
}
|
||||
if (!"PLATFORM".equals(user.appCode())) {
|
||||
if (!"PLATFORM".equals(user.appCode()) || !Long.valueOf(0L).equals(user.tenantId())) {
|
||||
throw new BizException(ResultCode.FORBIDDEN, "仅平台端可查看操作日志");
|
||||
}
|
||||
}
|
||||
|
||||
+11
@@ -51,6 +51,17 @@ class PlatformAuditLogControllerContractTest {
|
||||
verifyNoInteractions(service);
|
||||
}
|
||||
|
||||
@Test
|
||||
void platformApplicationWithCustomerTenantCannotReadLogs() {
|
||||
AuthenticatedUser malformed = new AuthenticatedUser(7L, 10001L, 10001L, 1L,
|
||||
"异常平台账号", "PLATFORM", "WEB", Set.of("platform:audit:list"));
|
||||
|
||||
assertThatThrownBy(() -> controller.page(malformed, 1, 20, null, null, null, null,
|
||||
null, null, null, null, null)).isInstanceOf(BizException.class)
|
||||
.hasMessage("仅平台端可查看操作日志");
|
||||
verifyNoInteractions(service);
|
||||
}
|
||||
|
||||
@Test
|
||||
void platformCanReadLogDetail() {
|
||||
AuditLogResponses.Detail detail = new AuditLogResponses.Detail(8L, "audit-1", "ROLE_UPDATE", "ROLE", "9", null,
|
||||
|
||||
Reference in New Issue
Block a user