%--
- $Revision$
- $Date$
-
- Copyright (C) 2004-2008 Jive Software. All rights reserved.
-
- 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.openfire.security.SecurityAuditManager,
org.jivesoftware.openfire.session.ClientSession,
org.jivesoftware.openfire.user.User"
errorPage="error.jsp"
%>
<%@ page import="org.jivesoftware.openfire.user.UserManager" %>
<%@ page import="org.jivesoftware.util.ParamUtils" %>
<%@ page import="org.xmpp.packet.JID" %>
<%@ page import="org.xmpp.packet.StreamError" %>
<%@ page import="java.net.URLEncoder" %>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt" %>
<% webManager.init(request, response, session, application, out ); %>
<% // Get parameters //
boolean cancel = request.getParameter("cancel") != null;
boolean delete = request.getParameter("delete") != null;
String username = ParamUtils.getParameter(request,"username");
// Handle a cancel
if (cancel) {
response.sendRedirect("user-properties.jsp?username=" + URLEncoder.encode(username, "UTF-8"));
return;
}
// Load the user object
User user = webManager.getUserManager().getUser(username);
// Handle a user delete:
if (delete) {
// Delete the user
webManager.getUserManager().deleteUser(user);
if (!SecurityAuditManager.getSecurityAuditProvider().blockUserEvents()) {
// Log the event
JID userAddress = new JID(username, webManager.getServerInfo().getXMPPDomain(), null);
webManager.logEvent("deleted user "+username, "full jid was "+userAddress);
}
// Close the user's connection
final StreamError error = new StreamError(StreamError.Condition.not_authorized);
for (ClientSession sess : webManager.getSessionManager().getSessions(user.getUsername()) )
{
sess.deliverRawText(error.toXML());
sess.close();
}
// Deleted your own user account, force login
if (username.equals(webManager.getAuthToken().getUsername())){
session.removeAttribute("jive.admin.authToken");
response.sendRedirect("login.jsp");
}
else {
// Done, so redirect
response.sendRedirect("user-summary.jsp?deletesuccess=true");
}
return;
}
%>
"/>
<% if (UserManager.getUserProvider().isReadOnly()) { %>
<% } %>
"><%= JID.unescapeNode(user.getUsername()) %>
<% // Disable the form if a read-only user provider.
if (UserManager.getUserProvider().isReadOnly()) { %>
<% } %>