Commit 223e2f2a authored by Gradl, Tobias's avatar Gradl, Tobias
Browse files

374: Reflect user role in schema editor

Task-Url: https://home.tgradl.de/mantisbt/view.php?id=374
360: Implement activities / history 

Task-Url: https://home.tgradl.de/mantisbt/view.php?id=360
parent 2ed1573f
......@@ -5,6 +5,7 @@ import java.util.List;
public class AuthPojo {
private boolean auth;
private String userId;
private String sessionId;
private int level;
private String displayName;
private String language;
......@@ -16,6 +17,9 @@ public class AuthPojo {
public String getUserId() { return userId; }
public void setUserId(String userId) { this.userId = userId; }
public String getSessionId() { return sessionId; }
public void setSessionId(String sessionId) { this.sessionId = sessionId; }
public int getLevel() { return level; }
public void setLevel(int level) { this.level = level; }
......
......@@ -28,16 +28,20 @@ public class AuthInfoHelper {
public AuthPojo getCurrentUserDetails(HttpServletRequest request) {
Authentication auth = SecurityContextHolder.getContext().getAuthentication();
AuthPojo authPojo;
if (auth!=null && auth.isAuthenticated()==true) {
if (auth.getDetails()!=null && auth.getDetails() instanceof UserDetails) {
return this.getAuthFromUserDetails((UserDetails)auth.getDetails());
authPojo = this.getAuthFromUserDetails((UserDetails)auth.getDetails());
} else if (auth.getPrincipal()!=null && auth.getPrincipal() instanceof User) {
return this.handleLocalUser((User)auth.getPrincipal());
authPojo = this.handleLocalUser((User)auth.getPrincipal());
} else {
return this.handleAnonymousLocalUser(auth);
authPojo = this.handleAnonymousLocalUser(auth);
}
authPojo.setSessionId(request.getSession(true).getId());
} else {
authPojo = new AuthPojo();
}
return new AuthPojo();
return authPojo;
}
private AuthPojo getAuthFromUserDetails(UserDetails user) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment