1、动作:白名单,阻断,监测
2、白名单业务为原有的域名白名单,阻断和监测业务为HTTP的阻断和监测业务
This commit is contained in:
leijun
2018-10-05 02:26:15 +08:00
parent bcf66ef52d
commit c06d7e11cb
5 changed files with 134 additions and 73 deletions

View File

@@ -21,10 +21,12 @@ import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import com.nis.domain.Page;
import com.nis.domain.configuration.BaseStringCfg;
import com.nis.domain.configuration.CfgIndexInfo;
import com.nis.domain.configuration.HttpUrlCfg;
import com.nis.domain.configuration.IpPortCfg;
import com.nis.domain.configuration.NtcSubscribeIdCfg;
import com.nis.domain.configuration.template.WhiteListIpTemplate;
import com.nis.exceptions.MaatConvertException;
import com.nis.util.Constants;
import com.nis.web.controller.configuration.CommonController;
import com.nis.web.security.UserUtils;
@@ -134,8 +136,20 @@ public class WhiteListController extends CommonController{
public String domainForm(Model model,String ids,CfgIndexInfo entity) {
if(StringUtils.isNotBlank(ids)){
entity = domainService.getDomainCfg(Long.parseLong(ids));
HttpUrlCfg urlCfg = new HttpUrlCfg();
urlCfg.setCfgType(Constants.HTTP_URL_REGION);
entity.setHttpUrl(urlCfg);
if(entity.getHttpUrlList().size()==0){
entity.getHttpUrlList().add(urlCfg);
}
initUpdateFormCondition(model,entity);
}else{
HttpUrlCfg urlCfg = new HttpUrlCfg();
urlCfg.setCfgType(Constants.HTTP_URL_REGION);
entity.setHttpUrl(urlCfg);
List<HttpUrlCfg> urlList=new ArrayList<HttpUrlCfg>();
urlList.add(urlCfg);
entity.setHttpUrlList(urlList);
initFormCondition(model,entity);
}
model.addAttribute("_cfg", entity);

View File

@@ -424,6 +424,13 @@ public class DomainService extends CrudService<DomainDao,HttpUrlCfg> {
return entity;
}
public void saveDomainCfg(CfgIndexInfo entity){
if(entity.getAction()==128){
entity.setRequestId(0);
entity.setClassify("0");
entity.setAttribute("0");
entity.setLable("0");
entity.setIsAreaEffective(0);
}
//设置区域运营商信息
setAreaEffectiveIds(entity);

View File

@@ -6,3 +6,6 @@ update function_region_dict set function_id='6' , config_service_type='http_url
#ip复用地址池
INSERT INTO `function_service_dict` ( `function_id`, `protocol_id`, `action`, `action_code`, `service_id`, `service_name`, `service_desc`, `is_valid`, `creator_id`, `create_time`, `editor_id`, `edit_time`, `region_code`) VALUES ( '633', '0', '96', 'loop', '832', 'ip_reuse_adress_pool_loop', NULL, '1', NULL, NULL, NULL, NULL, NULL);
INSERT INTO `function_region_dict` (`config_service_type`, `config_multi_keywords`, `config_expr_type`, `config_hex`, `config_match_method`, `function_id`, `config_region_code`, `config_region_value`, `config_district`, `config_desc`, `is_valid`, `creator_id`, `create_time`, `editor_id`, `edit_time`, `is_maat`, `region_type`, `config_ip_type`, `config_ip_pattern`, `config_port_pattern`, `config_direction`, `config_protocol`, `config_ip_port_show`, `config_region_sort`) VALUES (NULL, NULL, NULL, NULL, NULL, '633', '1', 'IR_STATIC_IP_POOL_CB', NULL, 'IP复用地址池配置', '1', NULL, NULL, NULL, NULL, '2', '2', '4,6', '1,2,3', '1,2', '0', '0', '1', '1');
#http_url白名单
update function_region_dict set function_id='6' where dict_id='15';

View File

@@ -16,6 +16,15 @@
$(".action").on("change", function() {
$("#serviceId").val($(this).attr("serviceId"));
$("#protocolId").val($(this).attr("protocolId"));
if($(this).val()!=128){
$("#http_url").removeClass("hidden");
$(".httpurlCfg").removeClass("hidden").removeClass("disabled");
$(".httpwhite").addClass("hidden").addClass("disabled");
}else{
$(".httpwhite").removeClass("hidden").removeClass("disabled");
$(".httpurlCfg").addClass("hidden").addClass("disabled");
$("#http_url").addClass("hidden");
}
});
$("#serviceId").val($(".action:checked").attr("serviceId"));
$("#protocolId").val($(".action:checked").attr("protocolId"));
@@ -80,37 +89,39 @@
},
errorContainer : "#messageBox",
});
var actions=$("input[name='action']:checked").val();
if(actions!=128){
$("#http_url").removeClass("hidden");
$(".httpurlCfg").removeClass("hidden").removeClass("disabled");
$(".httpwhite").addClass("hidden").addClass("disabled");
}else{
$(".httpwhite").removeClass("hidden").removeClass("disabled");
$(".httpurlCfg").addClass("hidden").addClass("disabled");
$("#http_url").addClass("hidden");
}
});
//业务窗口打开
var addContent = function(obj, contentClassName) {
/* var addContent = function(obj, contentClassName) {
var showDiv = $(obj).parent().parent().next();
$(showDiv).removeClass("hidden").removeClass(
"disabled");
/* $("."+contentClassName+"0").find("input,select").each(function(){
$(showDiv).removeClass("hidden").removeClass("disabled");
$("."+contentClassName+"0").find("input,select").each(function(){
$(this).removeAttr("disabled");
}); */
});
$(obj).addClass("hidden");
}
} */
//业务窗口关闭
var delContent = function(contentClassName, addBtnClassName) {
/* var delContent = function(contentClassName, addBtnClassName) {
$("." + contentClassName).addClass("hidden").addClass("disabled");
/* $("."+contentClassName).find("input,select").each(function(){
$(this).attr("disabled","true");
}); */
$("." + addBtnClassName).removeClass("hidden");
}
} */
</script>
</head>
<body>
<span id="keywordError" style="display:none"><spring:message code="required"></spring:message></span>
<span id="tagsinputTip" style="display:none"><spring:message code="multiple_keywords_tip"></spring:message></span>
<div class="page-content">
<h3 class="page-title">
<spring:message code="${_cfg.menuNameCode }"></spring:message>
</h3>
<div class="row">
<div class="col-md-12">
<div class="portlet box blue">
@@ -132,14 +143,9 @@
<input type="hidden" name="cfgId" value="${_cfg.cfgId}">
<input type="hidden" name="compileId" value="${_cfg.compileId}">
<input type="hidden" name="functionId" value="${_cfg.functionId}">
<input type="hidden" name="doLog" value="0" >
<input type="hidden" name="isAreaEffective" value="0" >
<input type="hidden" id="serviceId" name="serviceId"
value="${_cfg.serviceId}">
<div class="form-body">
<div class="row">
<div class="col-md-6">
<div class="form-group">
@@ -179,51 +185,73 @@
</div>
</div>
</div>
<h4 class="form-section">
<spring:message code="domain_whitelist" />
</h4>
<div class="row">
<div class="col-md-6">
<div class="form-group ">
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="domain_name"/></label>
<div class="col-md-6">
<input class="form-control required domainCheck" type="text" name="httpUrlList[0].cfgKeywords" value="${_cfg.httpUrlList[0].cfgKeywords}">
<input type="hidden" name="httpUrlList[0].exprType" value="0">
<input type="hidden" name="httpUrlList[0].matchMethod" value="0">
<input type="hidden" name="httpUrlList[0].isHexbin" value="0">
</div>
<div for="httpUrlList[0].cfgKeywords"></div>
</div>
</div>
</div>
<!-- dolog begin-->
<%-- <div class="row">
<div class="col-md-6">
<div class="form-group">
<label class="control-label col-md-3"><spring:message code="do_log" /></label>
<c:forEach items="${fns:getDictList('DO_LOG') }" var="dict">
<c:choose>
<c:when test="${dict.itemCode eq _cfg.doLog}">
<label class="radio-inline">
<input type="radio" name="doLog" checked value="${dict.itemCode}" ><spring:message code="${dict.itemValue}"/>
</label>
</c:when>
<c:otherwise>
<label class="radio-inline">
<input type="radio" name="doLog" value="${dict.itemCode}" ><spring:message code="${dict.itemValue}"/>
</label>
</c:otherwise>
</c:choose>
</c:forEach>
<div class="row doLog">
<div class="col-md-6">
<div class="form-group">
<label class="control-label col-md-3"><spring:message code="do_log" /></label>
<c:forEach items="${fns:getDictList('DO_LOG') }" var="dict">
<c:choose>
<c:when test="${dict.itemCode eq _cfg.doLog}">
<label class="radio-inline">
<input type="radio" name="doLog" checked value="${dict.itemCode}" ><spring:message code="${dict.itemValue}"/>
</label>
</c:when>
<c:otherwise>
<label class="radio-inline">
<input type="radio" name="doLog" value="${dict.itemCode}" ><spring:message code="${dict.itemValue}"/>
</label>
</c:otherwise>
</c:choose>
</c:forEach>
</div>
</div>
</div>
</div> --%>
<!-- dolog end-->
</div>
<h4 class="form-section">
<spring:message code="http_url_title" />
</h4>
<c:set var="strCfgIndex" value="0"></c:set>
<c:set var="subscribeIdIndex" value="0"></c:set>
<c:forEach items="${regionList}" var="region" varStatus="status">
<c:if test="${region.regionType eq 2 and region.configServiceType ne 'subscribe_id'}">
<c:if test="${region.configRegionValue eq 'WHITE_LIST_DOMAIN' }">
<div class="httpwhite">
<c:set var="tabName" value="httpUrlTab"></c:set>
<c:forEach items="${_cfg.httpUrlList}" var="cfg"
varStatus="status">
<c:set var="cfgName" value="httpUrlList[${status.index}]"></c:set>
<div class="row boxSolid ${tabName}${status.index}" >
<div class="col-md-6">
<div class="form-group " style="margin-top: 15px;">
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="URL"/></label>
<div class="col-md-6">
<input class="form-control required domainCheck" type="text" name="httpUrlList[0].cfgKeywords" value="${_cfg.httpUrlList[0].cfgKeywords}">
<input type="hidden" name="httpUrlList[0].exprType" value="0">
<input type="hidden" name="httpUrlList[0].matchMethod" value="0">
<input type="hidden" name="httpUrlList[0].isHexbin" value="0">
<input type="hidden" name="httpUrlList[0].cfgType" value="WHITE_LIST_DOMAIN">
</div>
<div for="httpUrlList[0].cfgKeywords"></div>
</div>
</div>
</div>
</c:forEach>
</div>
</c:if>
<c:if test="${region.configRegionValue eq _cfg.httpUrl.cfgType }">
<div class="httpurlCfg">
<c:set var="tabName" value="httpUrlTab"></c:set>
<%-- <c:set var="regionValue" value="${_cfg.httpUrl.cfgType}"></c:set> --%>
<c:forEach items="${_cfg.httpUrlList}" var="cfg"
varStatus="status">
<c:set var="cfgName" value="httpUrlList[${status.index}]"></c:set>
<div class="row boxSolid ${tabName}${status.index}" >
<%@include file="/WEB-INF/views/cfg/complexCfgForm.jsp"%>
</div>
</c:forEach>
</div>
</c:if>
<%-- <c:if test="${region.regionType eq 2 and region.configServiceType ne 'subscribe_id'}">
<input type="hidden" name="httpUrlList[0].cfgType" value="${region.configRegionValue}">
<input type="hidden" name="httpUrlList[0].cfgRegionCode" value="${region.configRegionCode}">
</c:if>
@@ -237,7 +265,7 @@
onClick="addContent(this,'${tabName}')" title="add"></span></small>
</h4>
<c:set var="cfgName" value="ntcSubscribeIdCfgList[${subscribeIdIndex}]"></c:set>
<%-- <c:set var="regionValue" value="${region.configRegionValue}"></c:set> --%>
<c:set var="regionValue" value="${region.configRegionValue}"></c:set>
<c:choose>
<c:when test="${fn:length(_cfg.ntcSubscribeIdCfgList)>0}">
<c:set var="isBreak" value="false" ></c:set>
@@ -270,15 +298,13 @@
</c:if>
</c:otherwise>
</c:choose>
</c:if>
</c:if> --%>
</c:forEach>
<br>
<%--@include file="/WEB-INF/include/form/areaInfo.jsp"--%>
<%--@include file="/WEB-INF/include/form/basicInfo.jsp"--%>
<input type="hidden" name="requestId" value="0"/>
<input type="hidden" name="classify" value="0"/>
<input type="hidden" name="attribute" value="0"/>
<input type="hidden" name="lable" value="0"/>
<div id="http_url">
<%@include file="/WEB-INF/include/form/areaInfo.jsp" %>
<%@include file="/WEB-INF/include/form/basicInfo.jsp" %>
</div>
<div class="form-actions">
<div class="row">
<div class="col-md-6">

View File

@@ -114,16 +114,27 @@
</c:if>
<c:if test="${(region[0] eq 2) && (fn:length(_cfg.httpUrlList) >0)}">
<c:forEach items="${_cfg.httpUrlList}" var="cfg">
<c:if test="${region[1] eq cfg.cfgType }">
<c:if test="${'WHITE_LIST_DOMAIN' eq cfg.cfgType }">
<div id="${region[1]}Info${index}" class="content content${region[0]}" name="subCfg${index}">
<div class="row">
<div class="col-md-8">
<div class="form-group">
<label><spring:message code='domain' />: ${fn:replace(cfg.cfgKeywords, "***and***", " ")}</label>
<label><spring:message code='URL' />: ${fn:replace(cfg.cfgKeywords, "***and***", " ")}</label>
</div>
</div>
</div>
<%-- <div class="row">
</c:if>
<c:if test="${'NTC_HTTP_URL' eq cfg.cfgType }">
<div id="${region[1]}Info${index}" class="content content${region[0]}" name="subCfg${index}">
<div class="row">
<div class="col-md-8">
<div class="form-group">
<label><spring:message code='URL' />: ${fn:replace(cfg.cfgKeywords, "***and***", " ")}</label>
</div>
</div>
</div>
<div class="row">
<div class="col-md-4">
<div class="form-group">
<label><spring:message code='expression_type' />:</label>
@@ -159,7 +170,7 @@
</label>
</div>
</div>
</div> --%>
</div>
</div>
</c:if>
</c:forEach>