%--
- $RCSfile$
- $Revision$
- $Date$
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--%>
<%@ page import="org.jivesoftware.util.ParamUtils,
org.jivesoftware.openfire.XMPPServer,
org.jivesoftware.openfire.audit.AuditManager,
org.jivesoftware.openfire.user.UserNotFoundException,
org.xmpp.packet.JID,
java.io.File"
errorPage="error.jsp"
%>
<%@ page import="java.util.*"%>
<%@ taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt" %>
<% webManager.init(request, response, session, application, out ); %>
<% // Get parameters:
boolean update = request.getParameter("update") != null;
boolean auditEnabled = ParamUtils.getBooleanParameter(request,"auditEnabled");
boolean auditMessages = ParamUtils.getBooleanParameter(request,"auditMessages");
boolean auditPresence = ParamUtils.getBooleanParameter(request,"auditPresence");
boolean auditIQ = ParamUtils.getBooleanParameter(request,"auditIQ");
String maxTotalSize = ParamUtils.getParameter(request,"maxTotalSize");
String maxFileSize = ParamUtils.getParameter(request,"maxFileSize");
String maxDays = ParamUtils.getParameter(request,"maxDays");
String logTimeout = ParamUtils.getParameter(request,"logTimeout");
String logDir = ParamUtils.getParameter(request,"logDir");
String ignore = ParamUtils.getParameter(request,"ignore");
// Get an audit manager:
AuditManager auditManager = XMPPServer.getInstance().getAuditManager();
Map errors = new HashMap();
if (update) {
auditManager.setEnabled(auditEnabled);
auditManager.setAuditMessage(auditMessages);
auditManager.setAuditPresence(auditPresence);
auditManager.setAuditIQ(auditIQ);
/*
auditManager.setAuditXPath(auditXPath);
if (newXpathQuery != null) {
auditManager.addXPath(newXpathQuery);
}
for (int i=0; i());
}
else {
// Set the new ignore list
Collection newIgnoreList = new HashSet(ignore.length());
StringTokenizer tokenizer = new StringTokenizer(ignore, ", \t\n\r\f");
while (tokenizer.hasMoreTokens()) {
String tok = tokenizer.nextToken();
String username = tok;
if (tok.contains("@")) {
if (tok.contains("@" + webManager.getServerInfo().getXMPPDomain())) {
username = new JID(tok).getNode();
}
else {
// Skip this JID since it belongs to a remote server
continue;
}
}
try {
webManager.getUserManager().getUser(username);
newIgnoreList.add(username);
}
catch (UserNotFoundException e){
}
}
auditManager.setIgnoreList(newIgnoreList);
}
// Log the event
// TODO: Should probably log more here
webManager.logEvent("updated stanza audit policy", null);
// All done, redirect
%>
<%
}
}
// Set page vars
if (errors.size() == 0) {
auditEnabled = auditManager.isEnabled();
auditMessages = auditManager.isAuditMessage();
auditPresence = auditManager.isAuditPresence();
auditIQ = auditManager.isAuditIQ();
maxTotalSize = Integer.toString(auditManager.getMaxTotalSize());
maxFileSize = Integer.toString(auditManager.getMaxFileSize());
maxDays = Integer.toString(auditManager.getMaxDays());
logTimeout = Integer.toString(auditManager.getLogTimeout() / 1000);
logDir = auditManager.getLogDir();
StringBuilder ignoreList = new StringBuilder();
for (String username : auditManager.getIgnoreList()) {
if (ignoreList.length() == 0) {
ignoreList.append(username);
}
else {
ignoreList.append(", ").append(username);
}
}
ignore = ignoreList.toString();
}
%>