-
-
Notifications
You must be signed in to change notification settings - Fork 10.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add apollo audit log common solution backend #4985
Merged
Merged
Changes from 48 commits
Commits
Show all changes
54 commits
Select commit
Hold shift + click to select a range
4911b87
7.3
BlackBear2003 b7b7b61
Merge branch 'apolloconfig:master' into add-audit-logs
BlackBear2003 687b73b
Merge branch 'apolloconfig:master' into add-audit-logs
BlackBear2003 d1b4574
plc success except jpa part
BlackBear2003 57eb3d6
successfully run by EntityScan annotation(not a good way)
BlackBear2003 83e7021
successfully run by add packages to bean registrar
BlackBear2003 d291b7d
'app create' audit log and query poc success
BlackBear2003 bf4105d
App create/update/delete poc success.
BlackBear2003 4031cc2
add License
BlackBear2003 85a2403
add License
BlackBear2003 b556305
try to pass tests
BlackBear2003 668a34e
try to pass tests
BlackBear2003 ff6fb0e
fix ${revision} to ${project.version}
BlackBear2003 ac42630
add no-op implement and no-op autoconfiguration.
BlackBear2003 154a17b
Merge branch 'apolloconfig:master' into add-audit-logs
BlackBear2003 7608549
rebase and add license
BlackBear2003 721cd4f
add audit controller
BlackBear2003 50a1ee5
- change controller
BlackBear2003 a6e7b3c
- make ApolloAuditHttpInterceptor uses Api while not tracer
BlackBear2003 ca7469e
- retry workflows
BlackBear2003 21b061f
- change for code review
BlackBear2003 1da08c3
- basically finish front-end part.
BlackBear2003 7be4d34
- fix for hound
BlackBear2003 c43217e
- update
BlackBear2003 bae4aad
- update
BlackBear2003 39491ef
Merge remote-tracking branch 'origin/add-audit-logs' into add-audit-logs
BlackBear2003 c345830
- add ApolloAuditLogApiNoOpImpl.class to @ContextConfiguration at App…
BlackBear2003 87ef435
- add license and fix for hound
BlackBear2003 4ce1f9d
- fix front-end bug
BlackBear2003 8a45abf
- fix front-end bug
BlackBear2003 beecd44
- remove query for auditing AppNamespace
BlackBear2003 c73c8d7
fix for changed requested
BlackBear2003 0e4f852
- change: always record if the method have no annotation
BlackBear2003 2dc02c0
- add test cover manually add dataInfluence when delete app
BlackBear2003 bbdd361
- try to write part of tests in impl
BlackBear2003 d0654b3
- finish ApolloAuditLogApiJpaImplTest
BlackBear2003 f0eaa34
- finish most part of context's unit-tests
BlackBear2003 ba3c354
- finish some unit-tests
BlackBear2003 ad324de
- fix database design bug
BlackBear2003 add5f0d
- add prompt sheet for disabling audit log feature
BlackBear2003 a154f53
- fix test bugs
BlackBear2003 62cbdc9
- change the way of getting op-type for data influences
BlackBear2003 b7a2c25
- enhance front-end design
BlackBear2003 08f6fb9
- enhance front-end design
BlackBear2003 a6ff3a6
Merge branch 'master' into add-audit-logs
BlackBear2003 37a8148
- add AuditLog Search dropdown
BlackBear2003 ee5c271
- add any-match data influences for batch-delete operation auditing
BlackBear2003 1e04137
- fix bugs
BlackBear2003 93b2907
- fix front-end bugs
BlackBear2003 36f0d75
- fix test failure
BlackBear2003 37c1458
- fix test failure
BlackBear2003 5430d0b
- update javadoc
BlackBear2003 c670758
- update README
BlackBear2003 f4de3b3
- update README
BlackBear2003 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
~ Copyright 2023 Apollo Authors | ||
~ | ||
~ Licensed under the Apache License, Version 2.0 (the "License"); | ||
~ you may not use this file except in compliance with the License. | ||
~ You may obtain a copy of the License at | ||
~ | ||
~ http://www.apache.org/licenses/LICENSE-2.0 | ||
~ | ||
~ Unless required by applicable law or agreed to in writing, software | ||
~ distributed under the License is distributed on an "AS IS" BASIS, | ||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
~ See the License for the specific language governing permissions and | ||
~ limitations under the License. | ||
~ | ||
--> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<parent> | ||
<artifactId>apollo-audit</artifactId> | ||
<groupId>com.ctrip.framework.apollo</groupId> | ||
<version>${revision}</version> | ||
</parent> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<artifactId>apollo-audit-annotation</artifactId> | ||
<version>${revision}</version> | ||
|
||
</project> |
31 changes: 31 additions & 0 deletions
31
...-annotation/src/main/java/com/ctrip/framework/apollo/audit/annotation/ApolloAuditLog.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* | ||
* Copyright 2023 Apollo Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
package com.ctrip.framework.apollo.audit.annotation; | ||
|
||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
@Target(ElementType.METHOD) | ||
@Retention(RetentionPolicy.RUNTIME) | ||
public @interface ApolloAuditLog { | ||
OpType type(); | ||
String name() default ""; | ||
String description() default "no description"; | ||
} | ||
|
28 changes: 28 additions & 0 deletions
28
...rc/main/java/com/ctrip/framework/apollo/audit/annotation/ApolloAuditLogDataInfluence.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
* Copyright 2023 Apollo Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
package com.ctrip.framework.apollo.audit.annotation; | ||
|
||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
@Target(ElementType.PARAMETER) | ||
@Retention(RetentionPolicy.RUNTIME) | ||
public @interface ApolloAuditLogDataInfluence { | ||
|
||
} |
30 changes: 30 additions & 0 deletions
30
...in/java/com/ctrip/framework/apollo/audit/annotation/ApolloAuditLogDataInfluenceTable.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* Copyright 2023 Apollo Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
package com.ctrip.framework.apollo.audit.annotation; | ||
|
||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
@Target({ElementType.TYPE, ElementType.PARAMETER}) | ||
@Retention(RetentionPolicy.RUNTIME) | ||
public @interface ApolloAuditLogDataInfluenceTable { | ||
|
||
String tableName(); | ||
|
||
} |
30 changes: 30 additions & 0 deletions
30
...va/com/ctrip/framework/apollo/audit/annotation/ApolloAuditLogDataInfluenceTableField.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* Copyright 2023 Apollo Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
package com.ctrip.framework.apollo.audit.annotation; | ||
|
||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
@Target({ElementType.FIELD, ElementType.PARAMETER}) | ||
@Retention(RetentionPolicy.RUNTIME) | ||
public @interface ApolloAuditLogDataInfluenceTableField { | ||
|
||
String fieldName(); | ||
|
||
} |
21 changes: 21 additions & 0 deletions
21
...lo-audit-annotation/src/main/java/com/ctrip/framework/apollo/audit/annotation/OpType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* | ||
* Copyright 2023 Apollo Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
package com.ctrip.framework.apollo.audit.annotation; | ||
|
||
public enum OpType { | ||
CREATE, UPDATE, DELETE, RPC | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
~ Copyright 2023 Apollo Authors | ||
~ | ||
~ Licensed under the Apache License, Version 2.0 (the "License"); | ||
~ you may not use this file except in compliance with the License. | ||
~ You may obtain a copy of the License at | ||
~ | ||
~ http://www.apache.org/licenses/LICENSE-2.0 | ||
~ | ||
~ Unless required by applicable law or agreed to in writing, software | ||
~ distributed under the License is distributed on an "AS IS" BASIS, | ||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
~ See the License for the specific language governing permissions and | ||
~ limitations under the License. | ||
~ | ||
--> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<parent> | ||
<artifactId>apollo-audit</artifactId> | ||
<groupId>com.ctrip.framework.apollo</groupId> | ||
<version>${revision}</version> | ||
</parent> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<artifactId>apollo-audit-api</artifactId> | ||
<version>${revision}</version> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>com.ctrip.framework.apollo</groupId> | ||
<artifactId>apollo-audit-annotation</artifactId> | ||
</dependency> | ||
</dependencies> | ||
|
||
</project> |
66 changes: 66 additions & 0 deletions
66
...t-api/src/main/java/com/ctrip/framework/apollo/audit/api/ApolloAuditEntityDefinition.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/* | ||
* Copyright 2023 Apollo Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
package com.ctrip.framework.apollo.audit.api; | ||
|
||
import java.lang.reflect.Field; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
public class ApolloAuditEntityDefinition { | ||
|
||
private String entityName; | ||
|
||
private List<Field> dataInfluenceFields; | ||
|
||
private Field entityIdField; | ||
|
||
public ApolloAuditEntityDefinition() { | ||
this.dataInfluenceFields = new ArrayList<>(); | ||
} | ||
|
||
public ApolloAuditEntityDefinition entityName(String val) { | ||
this.entityName = val; | ||
return this; | ||
} | ||
|
||
public ApolloAuditEntityDefinition entityIdField(Field f) { | ||
this.entityIdField = f; | ||
return this; | ||
} | ||
|
||
public ApolloAuditEntityDefinition dataInfluenceFields(List<Field> val) { | ||
this.dataInfluenceFields = val; | ||
return this; | ||
} | ||
|
||
public ApolloAuditEntityDefinition addDataInfluenceFields(Field f) { | ||
this.dataInfluenceFields.add(f); | ||
return this; | ||
} | ||
|
||
public String getEntityName() { | ||
return entityName; | ||
} | ||
|
||
public Field getEntityIdField() { | ||
return entityIdField; | ||
} | ||
|
||
public List<Field> getDataInfluenceFields() { | ||
return dataInfluenceFields; | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
...pollo-audit-api/src/main/java/com/ctrip/framework/apollo/audit/api/ApolloAuditLogApi.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* | ||
* Copyright 2023 Apollo Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
package com.ctrip.framework.apollo.audit.api; | ||
|
||
public interface ApolloAuditLogApi extends ApolloAuditLogRecordApi, ApolloAuditLogQueryApi{ | ||
|
||
} |
39 changes: 39 additions & 0 deletions
39
...-audit-api/src/main/java/com/ctrip/framework/apollo/audit/api/ApolloAuditLogQueryApi.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* Copyright 2023 Apollo Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
package com.ctrip.framework.apollo.audit.api; | ||
|
||
import com.ctrip.framework.apollo.audit.dto.ApolloAuditLogDTO; | ||
import com.ctrip.framework.apollo.audit.dto.ApolloAuditLogDataInfluenceDTO; | ||
import com.ctrip.framework.apollo.audit.dto.ApolloAuditLogDetailsDTO; | ||
import java.util.Date; | ||
import java.util.List; | ||
|
||
public interface ApolloAuditLogQueryApi { | ||
|
||
List<ApolloAuditLogDTO> queryLogs(int page, int size); | ||
|
||
List<ApolloAuditLogDTO> queryLogsByOpName(String opName, Date startDate, Date endDate, int page, | ||
int size); | ||
|
||
List<ApolloAuditLogDetailsDTO> queryTraceDetails(String traceId); | ||
|
||
List<ApolloAuditLogDataInfluenceDTO> queryDataInfluencesByField(String entityName, | ||
String entityId, String fieldName, int page, int size); | ||
|
||
List<ApolloAuditLogDTO> searchLogByNameOrTypeOrOperator(String query, int page, int size); | ||
|
||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need javadoc in all annotation and api