diff --git a/gerrit-extension-api/src/main/java/com/google/gerrit/extensions/api/groups/GroupApi.java b/gerrit-extension-api/src/main/java/com/google/gerrit/extensions/api/groups/GroupApi.java index 417e3714f4..f5a89c05c6 100644 --- a/gerrit-extension-api/src/main/java/com/google/gerrit/extensions/api/groups/GroupApi.java +++ b/gerrit-extension-api/src/main/java/com/google/gerrit/extensions/api/groups/GroupApi.java @@ -15,6 +15,7 @@ package com.google.gerrit.extensions.api.groups; import com.google.gerrit.extensions.common.AccountInfo; +import com.google.gerrit.extensions.common.GroupAuditEventInfo; import com.google.gerrit.extensions.common.GroupInfo; import com.google.gerrit.extensions.common.GroupOptionsInfo; import com.google.gerrit.extensions.restapi.RestApiException; @@ -132,4 +133,12 @@ public interface GroupApi { * @throws RestApiException */ void removeGroups(String... groups) throws RestApiException; + + /** + * Returns the audit log of the group. + * + * @return list of audit events of the group. + * @throws RestApiException + */ + List auditLog() throws RestApiException; } diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/api/groups/GroupApiImpl.java b/gerrit-server/src/main/java/com/google/gerrit/server/api/groups/GroupApiImpl.java index b7c8cd9f61..f11ed86dce 100644 --- a/gerrit-server/src/main/java/com/google/gerrit/server/api/groups/GroupApiImpl.java +++ b/gerrit-server/src/main/java/com/google/gerrit/server/api/groups/GroupApiImpl.java @@ -17,6 +17,7 @@ package com.google.gerrit.server.api.groups; import com.google.gerrit.common.errors.NoSuchGroupException; import com.google.gerrit.extensions.api.groups.GroupApi; import com.google.gerrit.extensions.common.AccountInfo; +import com.google.gerrit.extensions.common.GroupAuditEventInfo; import com.google.gerrit.extensions.common.GroupInfo; import com.google.gerrit.extensions.common.GroupOptionsInfo; import com.google.gerrit.extensions.restapi.ResourceNotFoundException; @@ -25,6 +26,7 @@ import com.google.gerrit.server.group.AddIncludedGroups; import com.google.gerrit.server.group.AddMembers; import com.google.gerrit.server.group.DeleteIncludedGroups; import com.google.gerrit.server.group.DeleteMembers; +import com.google.gerrit.server.group.GetAuditLog; import com.google.gerrit.server.group.GetDescription; import com.google.gerrit.server.group.GetDetail; import com.google.gerrit.server.group.GetGroup; @@ -67,6 +69,7 @@ class GroupApiImpl implements GroupApi { private final ListIncludedGroups listGroups; private final AddIncludedGroups addGroups; private final DeleteIncludedGroups deleteGroups; + private final GetAuditLog getAuditLog; private final GroupResource rsrc; @AssistedInject @@ -87,6 +90,7 @@ class GroupApiImpl implements GroupApi { ListIncludedGroups listGroups, AddIncludedGroups addGroups, DeleteIncludedGroups deleteGroups, + GetAuditLog getAuditLog, @Assisted GroupResource rsrc) { this.getGroup = getGroup; this.getDetail = getDetail; @@ -104,6 +108,7 @@ class GroupApiImpl implements GroupApi { this.listGroups = listGroups; this.addGroups = addGroups; this.deleteGroups = deleteGroups; + this.getAuditLog = getAuditLog; this.rsrc = rsrc; } @@ -258,4 +263,12 @@ class GroupApiImpl implements GroupApi { } } + @Override + public List auditLog() throws RestApiException { + try { + return getAuditLog.apply(rsrc); + } catch (OrmException e) { + throw new RestApiException("Cannot get audit log", e); + } + } }