---
title: "我的工程权限设计思想"
author: "conect"
date: "2008-05-30T20:03:44Z"
tags: []
slug: "untitled"
draft: false
lastmod: "2008-05-30T20:03:44Z"
id: 198808
url: "https://conect.iteye.com/blog/198808"
---

一：继承关系

XxxAction  &lt;--  ManagerAcionSupport  &lt;--  BasicActionSupport  &lt;--  ActionSupport

从左到右依次继承

二：流程

在BasicActionSupport中执行最原始的execute()方法，返回basic()方法，

在ManagerActionSupport中，重写basic()方法，在其中做权限判断。并扩充返回空值的right()方法，

                    public String right()  
                    {  
                          return "";  
                     }      

权限判断中，如果在XxxAction中重写的right()方法返回不为空并且权限本身不为

空，则执行checkRights()方法，

checkRights()方法写在AdminServiceImpl中，

在checkRights()方法中，根据right()方法return的权限名做参数，看是否匹配角色中对

应的权限(在这个方法中，角色中的权限通过getRights()方法得到，getRights()通过

RoseServiceImpl中的setRights()方法得到，setRights()根据传递过来的sFunctionNames参

数即我们打勾选中的权限来设定)，最后返回相应的msg信息。