diff --git a/li.strolch.agent/src/main/java/li/strolch/agent/api/StrolchComponent.java b/li.strolch.agent/src/main/java/li/strolch/agent/api/StrolchComponent.java index 4b30e0599..ea6bc1515 100644 --- a/li.strolch.agent/src/main/java/li/strolch/agent/api/StrolchComponent.java +++ b/li.strolch.agent/src/main/java/li/strolch/agent/api/StrolchComponent.java @@ -339,6 +339,26 @@ public class StrolchComponent { this.container.getPrivilegeHandler().runAs(username, runnable); } + /** + * Performs the given {@link PrivilegedRunnable} as the given system user + * + * @param username + * the name of the system user to perform the action as + * @param runnable + * the runnable to perform + * + * @return the result + * + * @throws PrivilegeException + * if the given username is not allowed to perform the action + * @throws Exception + * if anything else goes wrong during execution + */ + protected T runAsWithResult(String username, PrivilegedRunnableWithResult runnable) + throws PrivilegeException, Exception { + return this.container.getPrivilegeHandler().runWithResult(username, runnable); + } + /** * Performs the given {@link PrivilegedRunnable} as the given system user *