From 5306a1e6826762ae89065f5c542a8e51a9308361 Mon Sep 17 00:00:00 2001 From: Mutzi Date: Sat, 31 Aug 2024 22:12:42 +0200 Subject: [PATCH] Fixed unSudo --- src/main/java/de/mattv/fileserver/data/Token.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/de/mattv/fileserver/data/Token.java b/src/main/java/de/mattv/fileserver/data/Token.java index 95b5c3b..f17bd00 100644 --- a/src/main/java/de/mattv/fileserver/data/Token.java +++ b/src/main/java/de/mattv/fileserver/data/Token.java @@ -27,7 +27,11 @@ public class Token implements Authentication { public boolean isAdmin() { return (sudoRealUser != null) || user.admin; } public User getRealUser() { return sudoRealUser != null ? sudoRealUser : user; } - public void unSudo() { if (sudoRealUser != null) user = sudoRealUser; } + public void unSudo() { + if (sudoRealUser != null) + user = sudoRealUser; + sudoRealUser = null; + } public void sudo(@NonNull User newUser) { if (this.sudoRealUser == null) sudoRealUser = user;