removeUser.jsp
资源名称:NetOffice.rar [点击查看]
上传用户:guhaomin
上传日期:2007-06-10
资源大小:23203k
文件大小:4k
源码类别:
电子政务应用
开发平台:
Java
- <%
- /**
- * $RCSfile: removeUser.jsp,v $
- * $Revision: 1.3 $
- * $Date: 2000/12/18 02:06:21 $
- */
- %>
- <%@ page import="java.util.*,
- com.coolservlets.forum.*,
- com.coolservlets.forum.util.*,
- com.coolservlets.forum.util.admin.*"%>
- <jsp:useBean id="adminBean" scope="session"
- class="com.coolservlets.forum.util.admin.AdminBean"/>
- <% ////////////////////////////////
- // Jive authorization check
- // check the bean for the existence of an authorization token.
- // Its existence proves the user is valid. If it's not found, redirect
- // to the login page
- Authorization authToken = adminBean.getAuthToken();
- if( authToken == null ) {
- response.sendRedirect( "/mainctrl/bbs/admin" );
- return;
- }
- %>
- <% ////////////////////
- // Security check
- // make sure the user is authorized to administer users:
- ForumFactory forumFactory = ForumFactory.getInstance(authToken);
- ForumPermissions permissions = forumFactory.getPermissions(authToken);
- boolean isSystemAdmin = permissions.get(ForumPermissions.SYSTEM_ADMIN);
- boolean isUserAdmin = permissions.get(ForumPermissions.USER_ADMIN);
- // redirect to error page if we're not a user admin or a system admin
- if( !isUserAdmin && !isSystemAdmin ) {
- request.setAttribute("message","您没有权限管理用户!");
- response.sendRedirect("error.jsp");
- return;
- }
- %>
- <% ////////////////////
- // get parameters
- String username = ParamUtils.getParameter(request,"user");
- boolean doDelete = ParamUtils.getBooleanParameter(request,"doDelete");
- %>
- <% //////////////////////////////////
- // global error variables
- String errorMessage = "";
- boolean noUserSpecified = (username == null);
- boolean errors = (noUserSpecified);
- %>
- <% ////////////////////
- // make a profile manager
- ProfileManager manager = forumFactory.getProfileManager();
- %>
- <% /////////////////////
- // delete forum if specified
- if( doDelete && !errors ) {
- String message = "";
- try {
- User user = manager.getUser(username);
- manager.deleteUser(user);
- message = "用户删除成功!";
- }
- catch( UserNotFoundException fnfe ) {
- System.err.println( fnfe );
- message = "没有发现此用户!";
- }
- catch( UnauthorizedException ue ) {
- System.err.println( ue );
- message = "您没有权限删除用户!";
- }
- request.setAttribute("message",message);
- response.sendRedirect("users.jsp");
- return;
- }
- %>
- <html>
- <head>
- <title></title>
- <link rel="stylesheet" href="style/global.css">
- </head>
- <body background="images/shadowBack.gif" bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#800080" alink="#ff0000">
- <% ///////////////////////
- // pageTitleInfo variable (used by include/pageTitle.jsp)
- String[] pageTitleInfo = { "用户", "删除用户" };
- %>
- <% ///////////////////
- // pageTitle include
- %><%@ include file="include/pageTitle.jsp" %>
- <p>
- <% ////////////////////
- // display a list of users to remove if no group was specified:
- if( noUserSpecified ) {
- String formAction = "remove";
- %>
- <%@ include file="userChooser.jsp"%>
- <% out.flush();
- return;
- }
- %>
- <% /////////////////////
- // at this point, we know there is a user to work with:
- User user = null;
- try {
- user = manager.getUser(username);
- isSystemAdmin = (isSystemAdmin && (user.getID()==authToken.getUserID()));
- } catch( UserNotFoundException unfe ) {
- }
- %>
- 删除 <b><%= user.getUsername() %> (<%= user.getName() %>)</b>?
- <p>
- <% if( isSystemAdmin ) { %>
- <span class="errorText">
- 警告!这个用户是系统用户,建议不要删除此用户!
- </span>
- <% } %>
- <p>
- <ul>
- 警告:这将永久删除此用户。你确认要删除他吗?( <b>不会</b>删除用户发的帖子,但此用户先前的
- 帖子将被标记为“匿名者”。)
- </ul>
- <form action="removeUser.jsp" name="deleteForm">
- <input type="hidden" name="doDelete" value="true">
- <input type="hidden" name="user" value="<%= username %>">
- <input type="submit" value=" 删除用户 ">
-
- <input type="submit" name="cancel" value=" 取消 "
- onclick="location.href='users.jsp';return false;">
- </form>
- <script language="JavaScript" type="text/javascript">
- <!--
- document.deleteForm.cancel.focus();
- //-->
- </script>
- </body>
- </html>