Improve committer accuracy

Changes made by the SCM-Manager, like those through the editor and pull requests, now more accurately define the committer on the underlying changeset.

Committed-by: Eduard Heimbuch <eduard.heimbuch@cloudogu.com>
Co-authored-by: Eduard Heimbuch <eduard.heimbuch@cloudogu.com>
This commit is contained in:
Konstantin Schaper
2023-04-06 10:16:41 +02:00
committed by SCM-Manager
parent 8eb2687e10
commit 7e83d34fc0
5 changed files with 31 additions and 9 deletions

View File

@@ -91,6 +91,14 @@ public class SvnModifyCommand implements ModifyCommand {
}
}
private String getCurrentUserName() {
if (SecurityUtils.getSubject() != null && SecurityUtils.getSubject().getPrincipal() != null) {
return SecurityUtils.getSubject().getPrincipal().toString();
} else {
return "SCM-Manager";
}
}
private String commitChanges(SVNClientManager clientManager, File workingDirectory, String commitMessage) {
try {
clientManager.setAuthenticationManager(SVNWCUtil.createDefaultAuthenticationManager(getCurrentUserName(), new char[0]));
@@ -110,14 +118,6 @@ public class SvnModifyCommand implements ModifyCommand {
}
}
private String getCurrentUserName() {
if (SecurityUtils.getSubject() != null && SecurityUtils.getSubject().getPrincipal() != null) {
return SecurityUtils.getSubject().getPrincipal().toString();
} else {
return "SCM-Manager";
}
}
private void modifyWorkingDirectory(ModifyCommandRequest request, SVNClientManager clientManager, File workingDirectory) {
for (ModifyCommandRequest.PartialRequest partialRequest : request.getRequests()) {
try {