📄 addright_jsp.java
字号:
package org.apache.jsp;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import com.yoyorock.svnadmin.*;
import java.util.*;
import java.net.*;
public final class addright_jsp extends org.apache.jasper.runtime.HttpJspBase
implements org.apache.jasper.runtime.JspSourceDependent {
private static java.util.Vector _jspx_dependants;
static {
_jspx_dependants = new java.util.Vector(1);
_jspx_dependants.add("/define.jsp");
}
public java.util.List getDependants() {
return _jspx_dependants;
}
public void _jspService(HttpServletRequest request, HttpServletResponse response)
throws java.io.IOException, ServletException {
JspFactory _jspxFactory = null;
PageContext pageContext = null;
HttpSession session = null;
ServletContext application = null;
ServletConfig config = null;
JspWriter out = null;
Object page = this;
JspWriter _jspx_out = null;
PageContext _jspx_page_context = null;
try {
_jspxFactory = JspFactory.getDefaultFactory();
response.setContentType("text/html; charset=GBK");
pageContext = _jspxFactory.getPageContext(this, request, response,
null, true, 8192, true);
_jspx_page_context = pageContext;
application = pageContext.getServletContext();
config = pageContext.getServletConfig();
session = pageContext.getSession();
out = pageContext.getOut();
_jspx_out = out;
out.write("\r\n\r\n\r\n\r\n");
out.write('\r');
out.write('\n');
response.setHeader("Cache-Control", "no-store");
response.setHeader("Pragma", "no-cache");
response.setDateHeader("Expires",0);
request.setCharacterEncoding("GBK");
final String RESPOSITORY_ROOT = "C:/test";
out.write('\r');
out.write('\n');
out.write("\r\n<html>\r\n<head>\r\n<title>\r\nSVNADMIN,增加修改目录权限\r\n</title>\r\n</head>\r\n<body >\r\n");
String strLogined;
String strUsername;
String strRepository;
String strPath;
String strRight;
String strRightUser;
String strShow;
RightControl rightCtrl;
try
{
rightCtrl =(RightControl)session.getAttribute("rightCtrl");
strLogined = (String)session.getAttribute("strLogined");
strUsername = (String)session.getAttribute("strUsername");
strRepository = (String)session.getAttribute("strRepository");
if (null == strLogined)
{
strLogined = "no";
}
if (!strLogined.equals("yes") || null == rightCtrl
|| null == strUsername || null == strRepository)
{
response.sendRedirect(response.encodeRedirectURL("index.jsp"));
return;
}
strPath = request.getParameter("path");
strRight = request.getParameter("right");
strRightUser = request.getParameter("rightuser");
strShow = request.getParameter("show");
if (null == strRightUser)
{
//out.write("strPath = "+strPath+"<br>\r\n");
//out.write("strRight = "+strRight+"<br>\r\n");
//out.write("strRightUser = "+strRightUser+"<br>\r\n");
response.sendRedirect(response.encodeRedirectURL("listpath.jsp"));
return;
}
else if (!strUsername.equals(strRepository+"admin".toLowerCase()))
{
//不是管理员没有权限
out.write("<B>只有管理员才可以增加用户权限 <a href=\"listpath.jsp\">返回目录列表</a></B><br>\r\n");
out.write("</body>\r\n</html>\r\n");
return;
}
else if (null != strPath && null != strRight && null == strShow)
{
//权限值转换
strRightUser = strRightUser.toLowerCase();
if (!rightCtrl.syncFromFiles(RESPOSITORY_ROOT, strRepository))
{
out.write("<B>读权限文件失败,请稍后重试,如果再次出现问题请与管理员联系</B><br>\r\n");
}
else if (!rightCtrl.SetUserRight(strRightUser, strPath, strRight))
{
out.write("<B>用户["+strRightUser+"]不存在, <a href=\"listpath.jsp\">返回目录列表</a> </B><br>\r\n");
}
else if (!rightCtrl.SaveAccessFile())
{
out.write("<B>写权限文件失败,请稍后重试,如果再次出现问题请与管理员联系</B><br>\r\n");
}
else
{
//成功,要在session中保存最后的值
session.setAttribute("rightCtrl", rightCtrl);
out.write("<B>增加/修改权限成功 <a href=\"listpath.jsp\">返回目录列表</a></B><br>\r\n");
out.write("</body>\r\n</html>\r\n");
return;
}
}
if (null == strPath)
strPath = "";
if (null == strRight)
strRight = "";
out.write("\r\n<form action=\"addright.jsp\" method=\"POST\">\r\n<input type=\"hidden\" name=\"rightuser\" value=\"");
out.print(strRightUser);
out.write("\"/>\r\n目录:\r\n<input type=\"text\" name=\"path\" size=\"100\" value=\"");
out.print(strPath);
out.write("\"/>\r\n<br/>\r\n权限:\r\n<SELECT name=\"right\">\r\n<OPTION value=\"\"\r\n");
if (strRight.equals(""))
out.write(" selected ");
out.write(" >不可访问</OPTION>\r\n<OPTION value=\"r\"\r\n");
if (strRight.equals("r"))
out.write(" selected ");
out.write(" >只读</OPTION>\r\n<OPTION value=\"rw\"\r\n");
if (strRight.equals("rw"))
out.write(" selected ");
out.write(" >读写</OPTION>\r\n</SELECT>\r\n<br/>\r\n<input type=\"submit\" value=\"提交\"/>\r\n</form>\r\n<br/>\r\n<font color=\"red\">注:目录为仓库名下的相对路径,<br />\r\n如testsvn仓库下的path1的在网页访问的是http://192.168.1.3/svn/testsvn/path1 ,<br />\r\n则要填写的目录为\"/path1\"; 根目录为\"/\" 。\r\n</font>\r\n");
}
catch(Exception e)
{
out.write(e.getMessage());
}
out.write("\r\n</body>\r\n</html>\r\n\r\n");
} catch (Throwable t) {
if (!(t instanceof SkipPageException)){
out = _jspx_out;
if (out != null && out.getBufferSize() != 0)
out.clearBuffer();
if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
}
} finally {
if (_jspxFactory != null) _jspxFactory.releasePageContext(_jspx_page_context);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -