package com.tiger.oa.action; import javax.annotation.Resource; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Controller; import com.opensymphony.xwork2.ActionContext; import com.opensymphony.xwork2.ActionSupport; import com.opensymphony.xwork2.ModelDriven; import com.tiger.oa.dto.AclDTO; import com.tiger.oa.manager.ModuleManager; import com.tiger.oa.manager.RoleManager; import com.tiger.oa.manager.UserManager; import com.tiger.oa.model.ACL; import com.tiger.oa.util.PagerModel; import com.tiger.oa.util.SystemContext; import com.tiger.oa.util.SystemException; @Controller("aclAction") @Scope("prototype") public class AclAction extends ActionSupport implements ModelDriven{ private RoleManager roleManager; private UserManager userManager; private ModuleManager moduleManager; private AclDTO aclDTO = new AclDTO(); public RoleManager getRoleManager() { return roleManager; } @Resource public void setRoleManager(RoleManager roleManager) { this.roleManager = roleManager; } public UserManager getUserManager() { return userManager; } @Resource public void setUserManager(UserManager userManager) { this.userManager = userManager; } public ModuleManager getModuleManager() { return moduleManager; } @Resource public void setModuleManager(ModuleManager moduleManager) { this.moduleManager = moduleManager; } //打开ACL授权界面 //接收的参数:principalType,principalSn //输出的参数:模块列表、角色或用户对象 @Override public String execute() throws Exception { //如果主体类型是角色 if(ACL.TYPE_ROLE.equals( aclDTO.getPrincipalType())){ ActionContext.getContext().put("role", roleManager.findRole(aclDTO.getPrincipalSn())); }else if(ACL.TYPE_USER.equals(aclDTO.getPrincipalType())){ ActionContext.getContext().put("user", userManager.findUser(aclDTO.getPrincipalSn())); }else{ throw new SystemException("无效的主体类型!!!!"); } //获得所有顶级模块列表 SystemContext.setOffset(0); SystemContext.setPagesize(Integer.MAX_VALUE); PagerModel pm = moduleManager.searchModules(0); ActionContext.getContext().put("modules", pm.getDatas()); return "index"; } public AclDTO getAclDTO() { return aclDTO; } public void setAclDTO(AclDTO aclDTO) { this.aclDTO = aclDTO; } @Override public Object getModel() { return aclDTO; } }
最近下载更多
carloscarlos LV1
2023年9月13日
15029223037 LV1
2023年7月18日
linmou LV8
2023年3月19日
微信网友_6376279687794688 LV1
2023年3月5日
快乐的程序员 LV25
2023年1月21日
微信网友_6292700852981760 LV1
2023年1月5日
15342201772 LV7
2022年12月10日
swd287797983 LV1
2022年12月6日
wazp4071 LV1
2022年6月24日
C_mohen
2022年6月8日
暂无贡献等级
最近浏览更多
vluobo LV1
3月19日
cbddbc LV1
2023年12月26日
vanweiai2023
2023年11月30日
暂无贡献等级
fesfefe LV13
2023年11月16日
yuan_bin1990 LV7
2023年11月13日
molu123456
2023年10月16日
暂无贡献等级
2036495585 LV9
2023年9月26日
漫步的海星 LV4
2023年9月21日
carloscarlos LV1
2023年9月13日
3334004690 LV3
2023年8月19日