增加DNS阻断无策略检验.
This commit is contained in:
@@ -180,6 +180,22 @@ public class DnsIpCfgController extends BaseController {
|
||||
return "redirect:" + adminPath +"/cfg/dnsIp/list?functionId="+functionId;
|
||||
}
|
||||
|
||||
/**
|
||||
* DNS阻断无策略时检验
|
||||
* @param entity
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@ResponseBody
|
||||
@RequestMapping(value = {"/dnsNoStrategyCheck"})
|
||||
public boolean dnsNoStrategyCheck(DnsIpCfg entity, HttpServletRequest request, HttpServletResponse response){
|
||||
List<DnsIpCfg> list = dnsIpCfgService.getValidCfgInfo(entity);
|
||||
if(list.size() > 0){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//dnsIp配置导出
|
||||
@RequestMapping(value = "exportDnsIp")
|
||||
|
||||
@@ -13,4 +13,5 @@ public interface DnsIpCfgDao extends CrudDao<DnsIpCfg> {
|
||||
List<DnsIpCfg> findPage(DnsIpCfg dnsIpCfg);
|
||||
DnsIpCfg getDnsIpCfg(Long cfgId);
|
||||
List<DnsIpCfg> findDnsIpCfg(DnsIpCfg entity);
|
||||
List<DnsIpCfg> getValidCfgInfo(DnsIpCfg cfg);
|
||||
}
|
||||
|
||||
@@ -203,6 +203,14 @@
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="getValidCfgInfo" resultMap="dnsIpCfgMap">
|
||||
SELECT
|
||||
<include refid="columns"></include>
|
||||
FROM
|
||||
dns_ip_cfg r
|
||||
WHERE r.dns_strategy_id = #{dnsStrategyId} AND r.is_valid = 1 AND r.is_audit = 1
|
||||
</select>
|
||||
|
||||
<insert id="insert" parameterType="com.nis.domain.configuration.DnsIpCfg" >
|
||||
insert into dns_ip_cfg (
|
||||
CFG_DESC,
|
||||
|
||||
@@ -54,6 +54,10 @@ public class DnsIpCfgService extends BaseService{
|
||||
public DnsIpCfg getDnsIpCfg(Long cfgId) {
|
||||
return dnsIpCfgDao.getDnsIpCfg(cfgId);
|
||||
}
|
||||
public List<DnsIpCfg> getValidCfgInfo(DnsIpCfg cfg) {
|
||||
return dnsIpCfgDao.getValidCfgInfo(cfg);
|
||||
}
|
||||
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void saveOrUpdate(DnsIpCfg entity){
|
||||
Date createTime=new Date();
|
||||
|
||||
@@ -224,13 +224,14 @@
|
||||
<label class="control-label col-md-3"><spring:message
|
||||
code="policy_name" /></label>
|
||||
<div class="col-md-6">
|
||||
<select name="dnsStrategyId" class="selectpicker show-tick form-control">
|
||||
<select name="dnsStrategyId" class="selectpicker show-tick form-control noStrategyCheck" ctx="${ctx }">
|
||||
<option value="0" ><spring:message code="no_strategy"/></option>
|
||||
<c:forEach items="${dnsResStrategys }" var="dnsStrategy">
|
||||
<option value="${dnsStrategy.cfgId}" <c:if test="${_cfg.dnsStrategyId==dnsStrategy.cfgId }">selected</c:if>><spring:message code="${dnsStrategy.cfgDesc}"/></option>
|
||||
</c:forEach>
|
||||
</select>
|
||||
</div>
|
||||
<div for="dnsStrategyId"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1010,5 +1010,24 @@ jQuery.validator.addMethod("ipMaskSole",function(value,element) {
|
||||
});
|
||||
}
|
||||
|
||||
return flag;
|
||||
});
|
||||
|
||||
// DNS阻断无策略校验
|
||||
jQuery.validator.addMethod("noStrategyCheck",function(value,element) {
|
||||
var flag = true;
|
||||
if(value == 0){
|
||||
var ctx = $(element).attr("ctx");
|
||||
var url = ctx+"/cfg/dnsIp/dnsNoStrategyCheck";
|
||||
$.ajax({
|
||||
type:'post',
|
||||
async:false,
|
||||
url: url,
|
||||
data:{"dnsStrategyId":0},
|
||||
success:function(data){
|
||||
flag = data;
|
||||
}
|
||||
});
|
||||
}
|
||||
return flag;
|
||||
});
|
||||
@@ -80,6 +80,7 @@
|
||||
asnNoUnique:"ASN already exists.",
|
||||
areaUnique:"Area already exists.",
|
||||
config_sync_tip:"The system is being maintained and temporarily inaccessible.",
|
||||
ipMaskSole:"IP already exists."
|
||||
ipMaskSole:"IP already exists.",
|
||||
noStrategyCheck:"Spoofing IP Configuration Not Approved"
|
||||
});
|
||||
}(jQuery));
|
||||
|
||||
@@ -80,6 +80,7 @@
|
||||
asnNoUnique:"ASN уже существует.",
|
||||
areaUnique:"Регион уже существует.",
|
||||
config_sync_tip:"Система находится под техническим обслуживанием и временно недоступна.",
|
||||
ipMaskSole:"IP уже существует."
|
||||
ipMaskSole:"IP уже существует.",
|
||||
noStrategyCheck:"Spoofing IP Configuration Not Approved"
|
||||
});
|
||||
}(jQuery));
|
||||
|
||||
@@ -80,6 +80,7 @@
|
||||
asnNoUnique:"ASN号已存在",
|
||||
areaUnique:"该区域已存在",
|
||||
config_sync_tip:"系统正在维护中,暂时不可访问!",
|
||||
ipMaskSole:"IP已存在"
|
||||
ipMaskSole:"IP已存在",
|
||||
noStrategyCheck:"无审核通过的欺骗IP配置"
|
||||
});
|
||||
}(jQuery));
|
||||
|
||||
Reference in New Issue
Block a user