域名拦截功能完成
This commit is contained in:
@@ -40,29 +40,19 @@ import com.nis.web.security.UserUtils;
|
||||
@Controller
|
||||
@RequestMapping("${adminPath}/proxy/intercept")
|
||||
public class InterceptController extends CommonController{
|
||||
@RequestMapping(value = {"/ip/list"})
|
||||
// @RequiresPermissions(value={"website:dns:config"})
|
||||
@RequestMapping(value = {"/ip/list","domain/list"})
|
||||
public String ipList(Model model,@ModelAttribute("cfg")CfgIndexInfo cfg,HttpServletRequest request,HttpServletResponse response) {
|
||||
Page<CfgIndexInfo> searchPage=new Page<CfgIndexInfo>(request,response,"a");
|
||||
Page<CfgIndexInfo> page = websiteCfgService.getWebsiteList(searchPage, cfg);
|
||||
model.addAttribute("page", page);
|
||||
initPageCondition(model,cfg);
|
||||
return "/cfg/intercept/interceptIpList";
|
||||
return "/cfg/intercept/interceptList";
|
||||
}
|
||||
@RequestMapping(value = {"/domain/list"})
|
||||
// @RequiresPermissions(value={"intercept:domain:config","intercept:domain:confirm"},logical=Logical.OR)
|
||||
public String domainList(String cfgName,Model model,@ModelAttribute("cfg")HttpUrlCfg cfg,HttpServletRequest request,HttpServletResponse response) {
|
||||
this._domainList(cfgName,model, cfg, request, response);
|
||||
model.addAttribute("urlPrefix","/proxy/intercept/domain");
|
||||
model.addAttribute("requiresPermissionPrefix","intercept:domain");
|
||||
return "/cfg/common/domainList";
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"/interceptIpForm"})
|
||||
@RequiresPermissions(value={"intercept:ip:config"})
|
||||
@RequestMapping(value = {"/interceptIpForm","interceptDomainForm"})
|
||||
@RequiresPermissions(value={"intercept:ip:config","intercept:domain:config"})
|
||||
public String interceptIpForm(Model model,String ids,CfgIndexInfo entity) {
|
||||
if(StringUtils.isNotBlank(ids)){
|
||||
entity = interceptCfgService.getInterceptIpCfg(Long.parseLong(ids));
|
||||
entity = interceptCfgService.getInterceptCfg(Long.parseLong(ids));
|
||||
initUpdateFormCondition(model,entity);
|
||||
}else{
|
||||
initFormCondition(model,entity);
|
||||
@@ -72,20 +62,12 @@ public class InterceptController extends CommonController{
|
||||
//model.addAttribute("dnsResStrategys", resStrategys);
|
||||
|
||||
model.addAttribute("_cfg", entity);
|
||||
return "/cfg/intercept/interceptIpForm";
|
||||
return "/cfg/intercept/interceptForm";
|
||||
}
|
||||
@RequestMapping(value = {"/domain/form"})
|
||||
@RequiresPermissions(value={"intercept:domain:config"})
|
||||
public String domainForm(String cfgName,Model model,String ids,Integer functionId,HttpUrlCfg entity) {
|
||||
this._domainForm(cfgName, model, ids, functionId, entity);
|
||||
model.addAttribute("urlPrefix","/proxy/intercept/domain");
|
||||
model.addAttribute("requiresPermissionPrefix","intercept:domain");
|
||||
return "/cfg/common/domainForm";
|
||||
}
|
||||
@RequestMapping(value = {"/ip/saveOrUpdate"})
|
||||
@RequestMapping(value = {"/ip/saveOrUpdate","/domain/saveOrUpdate"})
|
||||
public String saveInterceptIpCfg(RedirectAttributes redirectAttributes,Model model,HttpServletRequest request,HttpServletResponse response,String ids,CfgIndexInfo entity) {
|
||||
try {
|
||||
interceptCfgService.saveInterceptIpCfg(entity);
|
||||
interceptCfgService.saveInterceptCfg(entity);
|
||||
addMessage(redirectAttributes,"save_success");
|
||||
} catch (Exception e) {
|
||||
addMessage(redirectAttributes,"save_failed");
|
||||
@@ -93,9 +75,9 @@ public class InterceptController extends CommonController{
|
||||
return "redirect:" + adminPath +"/proxy/intercept/ip/list?functionId="+entity.getFunctionId();
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"/ajaxInterceptIpSubList"})
|
||||
@RequestMapping(value = {"/ajaxInterceptIpSubList","/ajaxInterceptDomainSubList"})
|
||||
public String ajaxInterceptIpSubList(Model model,Long cfgId,Integer index) {
|
||||
CfgIndexInfo cfg = interceptCfgService.getInterceptIpCfg(cfgId);
|
||||
CfgIndexInfo cfg = interceptCfgService.getInterceptCfg(cfgId);
|
||||
List<String[]> tabList = new ArrayList();
|
||||
if(cfg.getIpPortList()!=null){
|
||||
String cfgType = null;
|
||||
@@ -115,19 +97,28 @@ public class InterceptController extends CommonController{
|
||||
}
|
||||
}
|
||||
}
|
||||
if(cfg.getHttpUrlList()!=null){
|
||||
String cfgType = null;
|
||||
for(BaseStringCfg keyword:cfg.getHttpUrlList()){
|
||||
if(!keyword.getCfgType().equals(cfgType)){
|
||||
tabList.add(new String[]{"2",keyword.getCfgType()});
|
||||
cfgType = keyword.getCfgType();
|
||||
}
|
||||
}
|
||||
}
|
||||
model.addAttribute("_cfg", cfg);
|
||||
model.addAttribute("index", index);
|
||||
model.addAttribute("tabList", tabList);
|
||||
return "/cfg/intercept/interceptIpSubList";
|
||||
return "/cfg/intercept/interceptSubList";
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"auditInterceptIpCfg"})
|
||||
@RequiresPermissions(value={"intercept:ip:confirm"})
|
||||
@RequestMapping(value = {"auditInterceptIpCfg","auditInterceptDomainCfg"})
|
||||
@RequiresPermissions(value={"intercept:ip:confirm","intercept:domain:confirm"})
|
||||
public String auditInterceptIpCfg(Integer isAudit,Integer isValid,String ids,Integer functionId, RedirectAttributes redirectAttributes) {
|
||||
CfgIndexInfo entity = new CfgIndexInfo();
|
||||
String[] idArray = ids.split(",");
|
||||
for(String id :idArray){
|
||||
entity = interceptCfgService.getInterceptIpCfg(Long.parseLong(id));
|
||||
entity = interceptCfgService.getInterceptCfg(Long.parseLong(id));
|
||||
entity.setIsAudit(isAudit);
|
||||
entity.setIsValid(isValid);
|
||||
entity.setAuditorId(UserUtils.getUser().getId());
|
||||
@@ -144,8 +135,8 @@ public class InterceptController extends CommonController{
|
||||
return "redirect:" + adminPath +"/proxy/intercept/ip/list?functionId="+functionId;
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"updateInterceptIpValid"})
|
||||
@RequiresPermissions(value={"intercept:ip:config"})
|
||||
@RequestMapping(value = {"updateInterceptIpValid","updateInterceptDomainValid"})
|
||||
@RequiresPermissions(value={"intercept:ip:config","intercept:domain:config"})
|
||||
public String updateInterceptIpValid(Integer isValid,String ids,Integer functionId, RedirectAttributes redirectAttributes) {
|
||||
try {
|
||||
interceptCfgService.updatInterceptValid(isValid,ids,functionId);
|
||||
@@ -157,28 +148,7 @@ public class InterceptController extends CommonController{
|
||||
return "redirect:" + adminPath +"/proxy/intercept/ip/list?functionId="+functionId;
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"/domain/saveOrUpdate"})
|
||||
public String saveOrUpdateDomain(String cfgName,RedirectAttributes model, HttpUrlCfg cfg) {
|
||||
this._saveOrUpdateDomain(cfgName, model, cfg);
|
||||
return "redirect:" + adminPath +"/proxy/intercept/domain/list?functionId="+cfg.getFunctionId();
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"/domain/delete"})
|
||||
@RequiresPermissions("intercept:domain:config")
|
||||
public String deleteDomain(String cfgName,String ids,String compileIds,Integer functionId,RedirectAttributes model) {
|
||||
this._deleteDomain(cfgName, ids, compileIds, functionId, model);
|
||||
model.addAttribute("urlPrefix","/proxy/intercept/domain");
|
||||
model.addAttribute("requiresPermissionPrefix","intercept:domain");
|
||||
return "redirect:" + adminPath +"/proxy/intercept/domain/list?functionId="+functionId;
|
||||
}
|
||||
@RequestMapping(value = {"/domain/audit"})
|
||||
@RequiresPermissions("intercept:domain:confirm")
|
||||
public String auditDomain(String ids,HttpUrlCfg cfg,RedirectAttributes redirectAttributes) {
|
||||
this._auditDomain(ids, cfg, redirectAttributes);
|
||||
redirectAttributes.addAttribute("urlPrefix","/proxy/intercept/domain");
|
||||
redirectAttributes.addAttribute("requiresPermissionPrefix","intercept:domain");
|
||||
return "redirect:" + adminPath +"/proxy/intercept/domain/list?functionId="+cfg.getFunctionId();
|
||||
}
|
||||
/*
|
||||
//ip配置导入
|
||||
@RequestMapping(value = "/ip/import", method=RequestMethod.POST)
|
||||
public String importIp(String cfgName,RedirectAttributes redirectAttributes,
|
||||
@@ -198,5 +168,5 @@ public class InterceptController extends CommonController{
|
||||
public void exportIp(String columns,Model model,HttpServletRequest request,HttpServletResponse response,
|
||||
@ModelAttribute("cfg")IpPortCfg entity,String ids,RedirectAttributes redirectAttributes){
|
||||
this._exportIp(columns,model, request, response, entity, ids, redirectAttributes);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user