Skip to content

Commit

Permalink
权限管理功能
Browse files Browse the repository at this point in the history
  • Loading branch information
angilin committed Apr 30, 2014
1 parent 623581d commit 17d35a3
Show file tree
Hide file tree
Showing 11 changed files with 599 additions and 22 deletions.
72 changes: 51 additions & 21 deletions WebRoot/WEB-INF/.struts-config.mex
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,18 @@
<StrutsActivity path="/accountModify.do" location="950,250" dimension="303,104" />
<StrutsActivity path="/roleList.do" location="350,450" dimension="261,104" />
<StrutsActivity path="/roleModify.do" location="50,650" dimension="283,104" />
<StrutsActivity path="/pwdModify.do" location="950,650" dimension="266,104" />
<StrutsActivity path="/actionList.do" location="350,850" dimension="264,104" />
<StrutsActivity path="/actionModify.do" location="50,1050" dimension="293,104" />
<StrutsActivity path="/index.jsp" location="350,50" dimension="88,53" />
<StrutsActivity path="/login.jsp" location="650,50" dimension="86,53" />
<StrutsActivity path="/system/accountList.jsp" location="650,250" dimension="166,53" />
<StrutsActivity path="/system/accountModify.jsp" location="50,450" dimension="188,53" />
<StrutsActivity path="/system/roleList.jsp" location="950,450" dimension="144,53" />
<StrutsActivity path="/system/roleModify.jsp" location="650,650" dimension="166,53" />
<StrutsActivity path="/pwdModify.do" location="950,650" dimension="266,104" />
<StrutsActivity path="/user/pwdModify.jsp" location="50,850" dimension="153,53" />
<StrutsTransition id="/system/accountList.jsp,null,/accountList.do,2" routingType="0">
<AutomaticBendpoints>
<AbsolutePoint location="650,276" />
<AbsolutePoint location="331,276" />
</AutomaticBendpoints>
</StrutsTransition>
<StrutsTransition id="/user/pwdModify.jsp,null,/pwdModify.do,2" routingType="0">
<AutomaticBendpoints>
<AbsolutePoint location="203,876" />
<AbsolutePoint location="1083,876" />
<AbsolutePoint location="1083,754" />
</AutomaticBendpoints>
</StrutsTransition>
<StrutsActivity path="/system/actionList.jsp" location="950,850" dimension="156,53" />
<StrutsActivity path="/system/actionModify.jsp" location="650,1050" dimension="178,53" />
<StrutsTransition id="/roleModify.do,success,/roleList.do,1" routingType="0">
<AutomaticBendpoints>
<AbsolutePoint location="191,702" />
Expand All @@ -39,10 +30,44 @@
<AbsolutePoint location="333,676" />
</AutomaticBendpoints>
</StrutsTransition>
<StrutsTransition id="/system/roleList.jsp,null,/roleList.do,2" routingType="0">
<StrutsTransition id="/actionModify.do,success,/system/actionList.jsp,1" routingType="0">
<AutomaticBendpoints>
<AbsolutePoint location="950,476" />
<AbsolutePoint location="611,476" />
<AbsolutePoint location="343,1118" />
<AbsolutePoint location="1028,1118" />
<AbsolutePoint location="1028,903" />
</AutomaticBendpoints>
</StrutsTransition>
<StrutsTransition id="/login.jsp,null,/login.do,2" routingType="0">
<AutomaticBendpoints>
<AbsolutePoint location="693,103" />
<AbsolutePoint location="693,118" />
<AbsolutePoint location="283,118" />
</AutomaticBendpoints>
</StrutsTransition>
<StrutsTransition id="/system/actionModify.jsp,null,/actionModify.do,2" routingType="0">
<AutomaticBendpoints>
<AbsolutePoint location="650,1076" />
<AbsolutePoint location="343,1076" />
</AutomaticBendpoints>
</StrutsTransition>
<StrutsTransition id="/system/accountList.jsp,null,/accountList.do,2" routingType="0">
<AutomaticBendpoints>
<AbsolutePoint location="650,276" />
<AbsolutePoint location="331,276" />
</AutomaticBendpoints>
</StrutsTransition>
<StrutsTransition id="/user/pwdModify.jsp,null,/pwdModify.do,2" routingType="0">
<AutomaticBendpoints>
<AbsolutePoint location="126,850" />
<AbsolutePoint location="126,799" />
<AbsolutePoint location="1083,799" />
<AbsolutePoint location="1083,754" />
</AutomaticBendpoints>
</StrutsTransition>
<StrutsTransition id="/actionModify.do,success,/actionList.do,1" routingType="0">
<AutomaticBendpoints>
<AbsolutePoint location="196,1102" />
<AbsolutePoint location="482,902" />
</AutomaticBendpoints>
</StrutsTransition>
<StrutsTransition id="/logout.do,success,/login.jsp,1" routingType="0">
Expand All @@ -51,11 +76,10 @@
<AbsolutePoint location="736,88" />
</AutomaticBendpoints>
</StrutsTransition>
<StrutsTransition id="/login.jsp,null,/login.do,2" routingType="0">
<StrutsTransition id="/system/roleList.jsp,null,/roleList.do,2" routingType="0">
<AutomaticBendpoints>
<AbsolutePoint location="693,103" />
<AbsolutePoint location="693,118" />
<AbsolutePoint location="283,118" />
<AbsolutePoint location="950,476" />
<AbsolutePoint location="611,476" />
</AutomaticBendpoints>
</StrutsTransition>
<StrutsTransition id="/system/accountModify.jsp,null,/accountModify.do,2" routingType="0">
Expand All @@ -66,6 +90,12 @@
<AbsolutePoint location="1101,354" />
</AutomaticBendpoints>
</StrutsTransition>
<StrutsTransition id="/system/actionList.jsp,null,/actionList.do,2" routingType="0">
<AutomaticBendpoints>
<AbsolutePoint location="950,876" />
<AbsolutePoint location="614,876" />
</AutomaticBendpoints>
</StrutsTransition>
<StrutsTransition id="/accountModify.do,success,/accountList.do,1" routingType="0">
<AutomaticBendpoints>
<AbsolutePoint location="1101,302" />
Expand Down
18 changes: 18 additions & 0 deletions WebRoot/WEB-INF/struts-config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
<form-bean name="roleListForm" type="com.rbac.form.system.RoleListForm" />
<form-bean name="roleModifyForm" type="com.rbac.form.system.RoleModifyForm" />
<form-bean name="pwdModifyForm" type="com.rbac.form.user.PwdModifyForm" />
<form-bean name="actionListForm" type="com.rbac.form.system.ActionListForm" />
<form-bean name="actionModifyForm" type="com.rbac.form.system.ActionModifyForm" />

</form-beans>

Expand Down Expand Up @@ -65,6 +67,22 @@
path="/pwdModify"
scope="request"
type="com.rbac.action.user.PwdModifyAction" />
<action
attribute="actionListForm"
input="/system/actionList.jsp"
name="actionListForm"
path="/actionList"
scope="request"
type="com.rbac.action.system.ActionListAction" />
<action
attribute="actionModifyForm"
input="/system/actionModify.jsp"
name="actionModifyForm"
path="/actionModify"
scope="request"
type="com.rbac.action.system.ActionModifyAction">
<forward name="success" path="/actionList.do" />
</action>

</action-mappings>

Expand Down
8 changes: 7 additions & 1 deletion WebRoot/login.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,15 @@
document.forms[0].submit();
}
}
function relocation(){
if(window.top!=window && '${error_msg}'!=''){
parent.location.href=window.location.href;
}
}
</script>
</head>
<body>
<body onload="relocation();">
<html:form action="login.do">
<div style="margin:0px auto;width:300px;">
<h1>RBAC系统</h1>
Expand Down
71 changes: 71 additions & 0 deletions WebRoot/system/actionList.jsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<html>
<head>
<title>权限管理</title>
<style type="text/css">
</style>
</head>
<body>
<html:form action="actionList.do">
<html:hidden property="deleteIds" />
<h1>
权限列表
</h1>
<ul>
<li>
权限名称
<html:text property="nameQry" />
</li>
<li>
权限路径
<html:text property="urlQry" />
</li>
</ul>
<html:submit property="query" value="查询" />
<html:submit property="del" value="批量删除" style="display:none" />
<input type="button" value="新增"
onclick="window.location.href='actionModify.do'" />
<table border="1" width="80%">
<thead>
<tr>
<th>
权限名称
</th>
<th>
权限路径
</th>
<th width="8%">
编辑
</th>
<th width="8%">
删除
</th>
</tr>
</thead>
<c:if test="${not empty actionList}">
<c:forEach items="${actionList}" var="action">
<tr>
<td>
<c:out value="${action.name }" />
</td>
<td>
<c:out value="${action.url }" />
</td>
<td align="center">
<a href="actionModify.do?id=${action.id }">编辑</a>
</td>
<td align="center">
<a
href="javascript:if(confirm('是否确定删除这条记录?')){document.forms[0].deleteIds.value='${action.id}';document.forms[0].del.click();}">删除</a>
</td>
</tr>
</c:forEach>
</c:if>
</table>
</html:form>
</body>
</html>
49 changes: 49 additions & 0 deletions WebRoot/system/actionModify.jsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<html>
<head>
<title>权限维护</title>
<style type="text/css">
</style>
<script type="text/javascript" src="extjs/ext-all.js"></script>
<script type="text/javascript" src="js/common.js"></script>
<script type="text/javascript">
function checkActionModify(){
with(document.forms[0]){
if(isBlank(name.value)){
alert('权限名称必须填写!');
return false;
}
if(isBlank(url.value)){
alert('权限路径必须填写!');
return false;
}
}
document.getElementById('submit').click();
return true;
}
</script>
</head>
<body>
<html:form action="actionModify.do">
<h1>权限维护</h1>
<input type="button" value="返回" onclick="history.go(-1);" />
<html:submit property="submit" value="保存" onclick="return checkActionModify();"/>
<html:hidden property="id"/>
<ul>
<li>
权限名称<span style="color:red" title="必填">(*)</span>
<html:text property="name"/>
</li>
<li>
权限路径<span style="color:red" title="必填">(*)</span>
<html:text property="url" />
</li>
</ul>
</html:form>
</body>
</html>
52 changes: 52 additions & 0 deletions src/com/rbac/action/system/ActionListAction.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*
* Generated by MyEclipse Struts
* Template path: templates/java/JavaClass.vtl
*/
package com.rbac.action.system;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.rbac.common.BaseAction;
import com.rbac.form.system.ActionListForm;
import com.rbac.service.ActionService;
import com.rbac.util.CommonUtils;

/**
* MyEclipse Struts
* Creation date: 04-30-2014
*
* XDoclet definition:
* @struts.action path="/actionList" name="actionListForm" input="/system/actionList.jsp" scope="request" validate="true"
*/
public class ActionListAction extends BaseAction {

/**
* Method execute
* @param mapping
* @param form
* @param request
* @param response
* @return ActionForward
*/
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
ActionListForm actionListForm = (ActionListForm) form;
ActionService actionService = (ActionService) super
.getBean("actionService");
if (CommonUtils.isNotBlank(actionListForm.getDel())) {
actionService.deleteAction(Long.parseLong(actionListForm
.getDeleteIds()), super.getCurrentAccountId(request));
}
List actionList = actionService.getSysActionList(actionListForm
.getNameQry(), actionListForm.getUrlQry());
request.setAttribute("actionList", actionList);
return mapping.getInputForward();
}
}
Loading

0 comments on commit 17d35a3

Please sign in to comment.