blob: 92eaff666b996fcb624469a31459dd51f03d8f13 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
package com.gitblit.wicket;
import java.util.TimeZone;
import org.apache.wicket.Request;
import org.apache.wicket.Session;
import org.apache.wicket.protocol.http.WebSession;
import org.apache.wicket.protocol.http.request.WebClientInfo;
public final class GitBlitWebSession extends WebSession {
private static final long serialVersionUID = 1L;
protected TimeZone timezone = null;
private User user = null;
public GitBlitWebSession(Request request) {
super(request);
}
public void invalidate() {
super.invalidate();
user = null;
}
public boolean isLoggedIn() {
return user != null;
}
public boolean canAdmin() {
if (user == null) {
return false;
}
return user.canAdmin();
}
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
public TimeZone getTimezone() {
if (timezone == null) {
timezone = ((WebClientInfo) getClientInfo()).getProperties().getTimeZone();
}
// use server timezone if we can't determine the client timezone
if (timezone == null) {
timezone = TimeZone.getDefault();
}
return timezone;
}
public static GitBlitWebSession get() {
return (GitBlitWebSession) Session.get();
}
}
|