From e3043fddcaf5e3ea4beb022c04d411661a3499bd Mon Sep 17 00:00:00 2001 From: ulrich <undisclosed> Date: Tue, 14 Mar 2017 14:27:13 +0000 Subject: [PATCH] Syntax-Check fuer Java, Gutter Marker fuer Fehler, Tooltips fuer Fehlermeldungen --- src/java/de/uhilger/filecms/pub/SessionManager.java | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-) diff --git a/src/java/de/uhilger/filecms/pub/SessionManager.java b/src/java/de/uhilger/filecms/pub/SessionManager.java index 97bac3d..0a394cc 100644 --- a/src/java/de/uhilger/filecms/pub/SessionManager.java +++ b/src/java/de/uhilger/filecms/pub/SessionManager.java @@ -21,6 +21,7 @@ package de.uhilger.filecms.pub; import de.uhilger.filecms.api.Api; +import java.security.Principal; import java.util.logging.Logger; /** @@ -35,5 +36,16 @@ return "Die aktuelle Sitzung ist nicht mehr gueltig."; } + public String getSessionUser() { + String id = null; + Object p = getRequest().getUserPrincipal(); + if(p instanceof Principal) { + id = ((Principal) p).getName(); + logger.finer("User-ID: " + id); + } else { + logger.finer("getUserPrincipal returned null or no Principal"); + } + return id; + } } -- Gitblit v1.9.3