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
61
62
63
64
65
66
67
<%--
- $RCSfile$
- $Revision$
- $Date$
-
- Copyright (C) 2004 Jive Software. All rights reserved.
-
- This software is published under the terms of the GNU Public License (GPL),
- a copy of which is included in this distribution.
--%>
<%@ page import="org.jivesoftware.messenger.auth.AuthToken,
org.jivesoftware.util.ClassUtils,
org.jivesoftware.messenger.XMPPServer,
org.jivesoftware.messenger.user.*"
%>
<% // Security check
AuthToken authToken = (AuthToken)session.getAttribute("jive.admin.authToken");
if (authToken == null) {
response.sendRedirect("login.jsp");
return;
}
else {
// check for an anonymous user token
if (authToken.isAnonymous()) {
response.sendRedirect("login.jsp");
return;
}
}
// Handle an admin logout requst:
if (request.getParameter("logout") != null) {
session.removeAttribute("jive.admin.authToken");
response.sendRedirect("index.jsp");
return;
}
// Check to see if we're in "setup" mode:
if (XMPPServer.getInstance().isSetupMode()) {
response.sendRedirect("setup-index.jsp");
return;
}
// Should only be set to true if logged in user is an admin.
// Since anyone that logged in is an admin, it's redundant to recheck.
boolean isSystemAdmin = true;
// Otherwise, get the xmpp server
XMPPServer xmppServer = XMPPServer.getInstance();
// The user object of the logged-in user
UserManager userManager = xmppServer.getUserManager();
User pageUser = null;
try {
pageUser = userManager.getUser(authToken.getUsername());
}
catch (UserNotFoundException ignored) {}
// embedded mode?
boolean embeddedMode = false;
try {
ClassUtils.forName("org.jivesoftware.messenger.starter.ServerStarter");
embeddedMode = true;
}
catch (Exception ignored) {}
%>