1.操控配置去除Block Method 2.修改Block配置下发userRegion

This commit is contained in:
zhangwenqing
2019-05-27 18:17:40 +08:00
parent dd31466774
commit 84c10eac7d
8 changed files with 37 additions and 35 deletions

View File

@@ -357,13 +357,14 @@ public class ManipulatPolicyController extends BaseController {
if (!str.getUserRegion5().equals("85") && !str.getUserRegion5().equals("90")) {
String value = "";
if(str.getUserRegion5().equals("16")) {// Block
/*if(str.getUserRegion5().equals("16")) {// Block
value = blockDict.get(str.getUserRegion1());
str.setResponseCode(prop.getProperty(value));
str.setUserRegion1(str.getUserRegion2());
str.setUserRegion2(null);
}else if(str.getUserRegion5().equals("48")) {// Redirect
}else*/
if(str.getUserRegion5().equals("48")) {// Redirect
value = redirectDict.get(str.getUserRegion1());
str.setResponseCode(prop.getProperty(value));
str.setUserRegion1(null);
@@ -378,7 +379,7 @@ public class ManipulatPolicyController extends BaseController {
}
if (str.getUserRegion5().equals("16") || str.getUserRegion5().equals("48")) {
/*if (str.getUserRegion5().equals("16") || str.getUserRegion5().equals("48")) {
if (!StringUtil.isEmpty(str.getUserRegion3())) { // 是否存在文件策略
searchResponseFile.setCompileId(Integer.valueOf(str.getUserRegion3()));
List<ProxyFileResponsePageCfg> allProxyFileStrategys = proxyFileResponsePageService.getProxyFileResponsePageCfgList(searchResponseFile);
@@ -388,11 +389,11 @@ public class ManipulatPolicyController extends BaseController {
str.setUserRegion3(null);
}
}
}*/
}
if(str.getUserRegion5().equals("16") || str.getUserRegion5().equals("48") || str.getUserRegion5().equals("85") ||
if(str.getUserRegion5().equals("48") || str.getUserRegion5().equals("85") ||
str.getUserRegion5().equals("90")) {
if(str.getUserRegion5().equals("85")) {
Page<ProxyFileHijackCfg> page = proxyFileHijackService.findPage(new Page<ProxyFileHijackCfg>(request, response, "a"), searchHijackFile);
@@ -429,7 +430,7 @@ public class ManipulatPolicyController extends BaseController {
}
}
String cfgIndexInfoNoExport = ",policy_name,group_name,&method_export:method-responseCode:response_code-userregion1:response_content-userregion2:redirect_url-userregion3:replace_zone-userregion4:replaced_content-userregion5:replace_content-";
String cfgIndexInfoNoExport = ",policy_name,group_name,userregion1,&method_export:method-responseCode:response_code-userregion2:redirect_url-userregion3:replace_zone-userregion4:replaced_content-userregion5:replace_content-";
String httpUrlCfgNoExport = ",do_log,action,config_describe,valid_identifier,is_audit,creator,creator"
+ ",config_time,editor,edit_time,auditor,audit_time"

View File

@@ -3290,11 +3290,6 @@ public abstract class BaseService {
ReplaceCfgList.add(replaceCfg);
actionParam.setMethod("replace");
actionParam.setRules(ReplaceCfgList);
}else if(cfg.getUserRegion5().equals("16")) {
actionParam.setMethod("block");
actionParam.setCode(Integer.valueOf(cfg.getUserRegion1()));
actionParam.setMessage(StringUtils.isNotBlank(cfg.getUserRegion2())?cfg.getUserRegion2():"");
actionParam.setHtml_profile(Integer.valueOf(StringUtils.isNotBlank(cfg.getUserRegion3())?cfg.getUserRegion3():"0"));
}else if(cfg.getUserRegion5().equals("85")) {
actionParam.setMethod("hijack");
actionParam.setHijack_profile(Integer.valueOf(cfg.getUserRegion4()));

View File

@@ -7,6 +7,7 @@ import java.util.List;
import java.util.Map;
import java.util.Properties;
import org.apache.commons.lang3.StringEscapeUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
@@ -22,6 +23,7 @@ import com.nis.domain.configuration.HttpUrlCfg;
import com.nis.domain.configuration.IpPortCfg;
import com.nis.domain.configuration.NtcSubscribeIdCfg;
import com.nis.domain.maat.MaatCfg;
import com.nis.domain.maat.ManipulatActionParam;
import com.nis.domain.maat.MaatCfg.DigestCfg;
import com.nis.domain.maat.MaatCfg.GroupCfg;
import com.nis.domain.maat.MaatCfg.IpCfg;
@@ -500,7 +502,7 @@ public class HttpRedirectCfgService extends CrudService<WebsiteCfgDao,CfgIndexIn
//HTTP block response code is not null ;response content null(userRegion is not null)
if(entity.getAction().equals(16)){
String userRegion1=StringUtil.isEmpty(entity.getUserRegion1()) ? "":entity.getUserRegion1();
/*String userRegion1=StringUtil.isEmpty(entity.getUserRegion1()) ? "":entity.getUserRegion1();
userRegion=Constants.REDIRECT_RESPONSE_CODE_KEY+"="+userRegion1;
String userRegion3=StringUtil.isEmpty(entity.getUserRegion3()) ? "":entity.getUserRegion3();//应答文件
if(StringUtils.isNotBlank(userRegion3)) {
@@ -508,7 +510,14 @@ public class HttpRedirectCfgService extends CrudService<WebsiteCfgDao,CfgIndexIn
}else {//应答内容
String userRegion2=StringUtil.isEmpty(entity.getUserRegion2()) ? "":entity.getUserRegion2();
userRegion=userRegion+";"+Constants.REDIRECT_CONTENT_KEY+"="+userRegion2;
}
}*/
ManipulatActionParam actionParam = new ManipulatActionParam();
actionParam.setMethod("block");
actionParam.setCode(Integer.valueOf(entity.getUserRegion1()));
actionParam.setMessage(StringUtils.isNotBlank(entity.getUserRegion2())?entity.getUserRegion2():"");
actionParam.setHtml_profile(Integer.valueOf(StringUtils.isNotBlank(entity.getUserRegion3())?entity.getUserRegion3():"0"));
userRegion = StringEscapeUtils.unescapeJson(gsonToJson(actionParam));
}
//HTTP redirect response code is not null ;response content is not null(userRegion is not null)
if(entity.getAction().equals(48)){

View File

@@ -523,12 +523,12 @@ public class ManipulatPolicyService extends CrudService<WebsiteCfgDao,CfgIndexIn
* user_region5 action
**/
// Block
if(Integer.valueOf(entity.getUserRegion5()).equals(16)){
/*if(Integer.valueOf(entity.getUserRegion5()).equals(16)){
actionParam.setMethod("block");
actionParam.setCode(Integer.valueOf(entity.getUserRegion1()));
actionParam.setMessage(StringUtils.isNotBlank(entity.getUserRegion2())?entity.getUserRegion2():"");
actionParam.setHtml_profile(Integer.valueOf(StringUtils.isNotBlank(entity.getUserRegion3())?entity.getUserRegion3():"0"));
}
}*/
// Redirect
if(Integer.valueOf(entity.getUserRegion5()).equals(48)){
actionParam.setMethod("redirect");
@@ -630,18 +630,18 @@ public class ManipulatPolicyService extends CrudService<WebsiteCfgDao,CfgIndexIn
public void setFileRegion(Model model) {
ProxyFileStrategyCfg searchEntity = new ProxyFileStrategyCfg();
searchEntity.setIsAudit(1);
//ProxyFileStrategyCfg searchEntity = new ProxyFileStrategyCfg();
//searchEntity.setIsAudit(1);
ProxyFileHijackCfg hijackSearch = new ProxyFileHijackCfg();
searchEntity.setIsAudit(1);
hijackSearch.setIsAudit(1);
ProxyFileInsertScriptCfg insertSearch = new ProxyFileInsertScriptCfg();
searchEntity.setIsAudit(1);
insertSearch.setIsAudit(1);
List<ProxyFileStrategyCfg> resFileList = proxyFileDao.fingResPages(searchEntity);
//List<ProxyFileStrategyCfg> resFileList = proxyFileDao.fingResPages(searchEntity);
List<ProxyFileHijackCfg> hajackFilelist = proxyFileHijackDao.findHijackFiles(hijackSearch);
List<ProxyFileInsertScriptCfg> InsertFilelist = proxyFileInsertDao.findInsertFiles(insertSearch);
model.addAttribute("allResponseFiles", resFileList);
//model.addAttribute("allResponseFiles", resFileList);
model.addAttribute("allHijackFiles", hajackFilelist);
model.addAttribute("allInsertFiles", InsertFilelist);
}

View File

@@ -98,11 +98,11 @@
<spring:message code="method" />
</label>
<div class="col-md-6">
<c:forEach items="${fns:getDictList('SERVICE_ACTION') }" var="dict">
<c:if test="${dict.itemCode == 16 || dict.itemCode == 48 || dict.itemCode == 80 }">
<c:forEach items="${fns:getDictList('SERVICE_ACTION') }" var="dict" varStatus="status">
<c:if test="${dict.itemCode == 48 || dict.itemCode == 80 }">
<label class="radio-inline">
<input type="radio" name="manipulatType" class="userRegion5" value="${dict.itemCode }" class="required"
<c:if test="${dict.itemCode == 16}">checked</c:if>>
<c:if test="${dict.itemCode == 48}">checked</c:if>>
<spring:message code="${dict.itemValue }"/>
</label>
</c:if>

View File

@@ -21,11 +21,11 @@
<spring:message code="method" />
</label>
<div class="col-md-8">
<c:forEach items="${fns:getDictList('SERVICE_ACTION') }" var="dict">
<c:if test="${dict.itemCode == 16 || dict.itemCode == 48 || dict.itemCode == 80 }">
<c:forEach items="${fns:getDictList('SERVICE_ACTION') }" var="dict" varStatus="status">
<c:if test="${dict.itemCode == 48 || dict.itemCode == 80 }">
<label class="radio-inline">
<input type="radio" name="userRegion5" class="userRegion5" value="${dict.itemCode }" class="required"
<c:if test="${_cfg.userRegion5 == dict.itemCode || (_cfg.userRegion5==null && dict.itemCode==16)}">checked</c:if>>
<c:if test="${_cfg.userRegion5 == dict.itemCode || (_cfg.userRegion5==null && dict.itemCode==48)}">checked</c:if>>
<spring:message code="${dict.itemValue }"/>
</label>
</c:if>

View File

@@ -211,7 +211,7 @@
</c:forEach> --%>
<c:forEach items="${fns:getDictList('SERVICE_ACTION') }" var="dict">
<c:if test="${dict.itemCode == 16 || dict.itemCode == 48 || dict.itemCode == 80 }">
<c:if test="${dict.itemCode == 48 || dict.itemCode == 80 }">
<form:option value="${dict.itemCode }"><spring:message code="${dict.itemValue }"/></form:option>
</c:if>
</c:forEach>
@@ -398,7 +398,7 @@
<th><spring:message code="method"/></th>
<th><spring:message code="response_code"/></th>
<th><spring:message code="response_content"/></th>
<%-- <th><spring:message code="response_content"/></th> --%>
<th><spring:message code="redirect_url"/></th>
<th><spring:message code="replace_zone"/></th>
<th><spring:message code="replaced_content"/></th>
@@ -447,7 +447,7 @@
<spring:message code="action_insert"/>
</c:if>
</td>
<c:if test="${indexCfg.userRegion5 == 16}">
<%-- <c:if test="${indexCfg.userRegion5 == 16}">
<td>
<c:forEach items="${fns:getDictList('RESPONSE_CODE') }" var="dict1">
<c:if test="${dict1.itemCode eq indexCfg.userRegion1 }">
@@ -471,7 +471,7 @@
<td></td>
<td></td>
<td></td>
</c:if>
</c:if> --%>
<c:if test="${indexCfg.userRegion5 == 48}">
<td>
<c:forEach items="${fns:getDictList('REDIRECT_RESPONSE_CODE') }" var="dict2">
@@ -481,7 +481,6 @@
</c:if>
</c:forEach>
</td>
<td></td>
<td <c:if test="${not empty indexCfg.userRegion2 }"> title="${indexCfg.userRegion2 }"</c:if>><!-- 重定向 响应内容 userRegion3 不为空 响应文件-->
<c:if test="${not empty indexCfg.userRegion2 }">${fns:abbr(indexCfg.userRegion2,20)}</c:if>
<%-- <c:if test="${not empty indexCfg.userRegion3 }">
@@ -499,7 +498,6 @@
</c:if>
<c:if test="${indexCfg.userRegion5 == 80}">
<td></td>
<td></td>
<td></td>
<td>
@@ -520,7 +518,6 @@
<td></td>
<td></td>
<td></td>
<td></td>
<td>
<c:if test="${not empty indexCfg.userRegion4 }">
<c:forEach items="${allHijackFiles}" var="file">

View File

@@ -247,7 +247,7 @@ function profileChange(val){
$("input[name='regionDictIds']:first").prop("checked",true);
}
if(val == 48 || val == 80 || val == 16){ // 重定向和替换动作无Profile属性
if(val == 48 || val == 80){ // 重定向和替换动作无Profile属性
$(".profileInfo").addClass("hidden");
}else{
$(".profileInfo").removeClass("hidden");