Merge branch 'stable-3.3'
* stable-3.3:
Add missing @Override to SSHLog.toAuditLog
Fix config.md keys using @PLUGIN@ placeholder
Revert "Remove getCacheKey() from AuditUser"
Change-Id: I9ca77f1ae443b81f13d5b59ad473a6050ab52624
diff --git a/src/main/java/com/googlesource/gerrit/plugins/auditsl4j/AuditRendererToJson.java b/src/main/java/com/googlesource/gerrit/plugins/auditsl4j/AuditRendererToJson.java
index 2c4133b..922a789 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/auditsl4j/AuditRendererToJson.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/auditsl4j/AuditRendererToJson.java
@@ -21,6 +21,7 @@
import com.google.gerrit.server.AccessPath;
import com.google.gerrit.server.AuditEvent;
import com.google.gerrit.server.CurrentUser;
+import com.google.gerrit.server.PropertyMap;
import com.google.gson.ExclusionStrategy;
import com.google.gson.FieldAttributes;
import com.google.gson.Gson;
@@ -34,9 +35,9 @@
import java.util.Optional;
public class AuditRendererToJson implements AuditFormatRenderer {
- private final ExclusionStrategy INCLUDE_ONLY_WHITELISTED =
+ private final ExclusionStrategy INCLUDE_ONLY_ALLOWED =
new ExclusionStrategy() {
- private final HashSet<Class<?>> WHITELIST_CLASSES =
+ private final HashSet<Class<?>> ALLOWLIST_CLASSES =
new HashSet<>(
Arrays.asList(
String.class,
@@ -47,15 +48,15 @@
Integer.class,
Integer.TYPE,
AccessPath.class,
- CurrentUser.PropertyKey.class,
+ PropertyMap.Key.class,
Account.Id.class,
AuditRecord.class));
- private final HashSet<String> BLACKLIST_FIELDS =
+ private final HashSet<String> FORBIDDEN_FIELDS =
new HashSet<>(Arrays.asList("anonymousCowardName"));
@Override
public boolean shouldSkipField(FieldAttributes f) {
- return BLACKLIST_FIELDS.contains(f.getName());
+ return FORBIDDEN_FIELDS.contains(f.getName());
}
@Override
@@ -65,7 +66,7 @@
&& !ListMultimap.class.isAssignableFrom(clazz)
&& !AuditEvent.UUID.class.isAssignableFrom(clazz)
&& !Response.class.isAssignableFrom(clazz)
- && !WHITELIST_CLASSES.contains(clazz);
+ && !ALLOWLIST_CLASSES.contains(clazz);
}
};
@@ -94,7 +95,7 @@
private final Gson gson =
OutputFormat.JSON_COMPACT
.newGsonBuilder()
- .setExclusionStrategies(INCLUDE_ONLY_WHITELISTED)
+ .setExclusionStrategies(INCLUDE_ONLY_ALLOWED)
.registerTypeAdapter(CurrentUser.class, CURRENT_USER_SERIALIZER)
.create();
diff --git a/src/main/java/com/googlesource/gerrit/plugins/auditsl4j/AuditUser.java b/src/main/java/com/googlesource/gerrit/plugins/auditsl4j/AuditUser.java
index 2e6dd8a..f57db23 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/auditsl4j/AuditUser.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/auditsl4j/AuditUser.java
@@ -39,4 +39,9 @@
public void setUserName(String username) {
this.username = username;
}
+
+ @Override
+ public Object getCacheKey() {
+ return getAccountId();
+ }
}