IP白名单配置新增直接生效(需要分配权限,此功能才可开启).

ip白名单配置生效状态下可修改(修改delRow的判断才可开启此功能).
This commit is contained in:
段冬梅
2019-04-13 09:01:24 +08:00
parent bca7de6990
commit a478bee5f3
8 changed files with 94 additions and 25 deletions

View File

@@ -194,7 +194,7 @@ public class IpController extends BaseController{
/*if(StringUtils.isNoneBlank(entity.getUserRegion4())) {
ipCfgService.auditAsnCfg(entity, isAudit);
}else {*/
ipCfgService.auditIpCfg(entity,isAudit);
ipCfgService.auditIpCfg(entity,isAudit,Constants.INSERT_ACTION);
/*}*/
addMessage(redirectAttributes,"success", "audit_success");
} catch (Exception e) {

View File

@@ -97,9 +97,24 @@ public class WhiteListController extends CommonController {
}
@RequestMapping(value = { "ip/save" })
public String saveIpCfg(RedirectAttributes model, HttpServletRequest request, HttpServletResponse response,
public String saveIpCfg(RedirectAttributes model, HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes,
String ids, CfgIndexInfo entity) {
ipCfgService.saveIpCfg(entity);
try {
ipCfgService.saveIpCfg(entity);
//配置仅保存
if(StringUtil.isEmpty(entity.getIsValid()) || entity.getIsValid()!=1) {
addMessage(redirectAttributes, "success", "save_success");
}else {
//配置直接生效
addMessage(redirectAttributes, "success", "audit_success");
}
} catch (MaatConvertException e) {
logger.error("ip白名单配置下发失败",e);
addMessage(redirectAttributes, "error", "request_service_failed");
} catch (Exception e) {
logger.error("ip白名单配置保存失败",e);
addMessage(redirectAttributes, "error", "save_failed");
}
return "redirect:" + adminPath + "/ntc/whitelist/ip/list?functionId=" + entity.getFunctionId();
}
@@ -115,11 +130,9 @@ public class WhiteListController extends CommonController {
entity = ipCfgService.getIpPortCfg(Long.parseLong(id), null);
entity.setIsAudit(isAudit);
entity.setIsValid(isValid);
entity.setAuditorId(UserUtils.getUser().getId());
entity.setAuditTime(new Date());
entity.setFunctionId(functionId);
try {
ipCfgService.auditIpCfg(entity, isAudit);
ipCfgService.auditIpCfg(entity, isAudit,Constants.INSERT_ACTION);
addMessage(redirectAttributes, "success", "audit_success");
} catch (MaatConvertException e) {
logger.info("ip配置下发失败" + e.getMessage());

View File

@@ -115,6 +115,10 @@ public class IpCfgService extends CrudService<IpCfgDao,BaseIpCfg> {
//设置区域运营商信息
setAreaEffectiveIds(entity);
int isValid=0;
if(!StringUtil.isEmpty(entity.getIsValid()) && entity.getIsValid()==1) {
isValid=1;
}
entity.setIsValid(0);
entity.setIsAudit(0);
@@ -189,6 +193,11 @@ public class IpCfgService extends CrudService<IpCfgDao,BaseIpCfg> {
}
}
if(isValid==1) {
entity.setIsAudit(1);
entity.setIsValid(1);
auditIpCfg(entity, isValid,Constants.INSERT_ACTION);
}
}else{
entity.setEditTime(new Date());
entity.setEditorId(entity.getCurrentUser().getId());
@@ -262,6 +271,12 @@ public class IpCfgService extends CrudService<IpCfgDao,BaseIpCfg> {
}
}
if(isValid==1) {
entity.setIsAudit(1);
entity.setIsValid(1);
auditIpCfg(entity, isValid,Constants.INSERT_ACTION);
}
}
}
public void updateIpCfgValid(Integer isValid,String ids,Integer functionId){
@@ -526,12 +541,15 @@ public class IpCfgService extends CrudService<IpCfgDao,BaseIpCfg> {
}
}
}
public void auditIpCfg(CfgIndexInfo entity,Integer isAudit) throws MaatConvertException{
public void auditIpCfg(CfgIndexInfo entity,Integer isAudit,Integer opAction) throws MaatConvertException{
Properties props=this.getMsgProp();
//修改数据库审核状态信息
entity.setTableName(CfgIndexInfo.getTablename());
entity.setIsAudit(isAudit);
entity.setAuditorId(UserUtils.getUser().getId());
entity.setAuditTime(new Date());
ipCfgDao.auditCfg(entity);
ToMaatBean maatBean = new ToMaatBean();
MaatCfg maatCfg = new MaatCfg();
List<MaatCfg> configCompileList = new ArrayList();
@@ -665,7 +683,7 @@ public class IpCfgService extends CrudService<IpCfgDao,BaseIpCfg> {
maatBean.setAuditTime(entity.getAuditTime());
maatBean.setCreatorName(entity.getCurrentUser().getName());
maatBean.setVersion(Constants.MAAT_VERSION);
maatBean.setOpAction(Constants.INSERT_ACTION);
maatBean.setOpAction(opAction);
//限速需要发Droprate=0.001 暂不支持Bandwidth=200kbps
if(entity.getAction().equals(Constants.RATELIMIT_ACTION)){
if(entity.getUserRegion1().equals("0")){//丢包率

View File

@@ -0,0 +1,5 @@
#审核并下发功能,只有将此菜单分配给保存并下发用户的角色,此角色下的用户新增的配置可直接下发(此版本注意角色分配)
#新增审核并下发菜单
INSERT INTO `sys_menu`(`parent_id`, `parent_ids`, `code`, `name`, `sort`, `href`, `target`, `icon`, `is_show`, `permission`, `create_by`, `create_date`, `update_by`, `update_date`, `remarks`, `del_flag`, `menu_bg`, `quick_action`, `is_top`, `function_id`) VALUES (86, '0,1,86,', 'save_and_audit', '保存并下发按钮', 5060, '', '', '', 0, 'save:audit:permission', '1', '2019-04-08 11:30:31', '1', '2019-04-08 11:47:16', '保存并下发功能权限', 1, NULL, 0, 0, NULL);
#新增审核并下发角色
INSERT INTO `sys_role`(`NAME`, `DATA_SCOPE`, `REMARK`, `STATUS`, `CREATE_TIME`, `ROLE_TYPE`) VALUES ('saveAndAudit', 10, '', 1, '2019-04-09 11:33:40', 'user');

View File

@@ -67,16 +67,13 @@ DELETE FROM ip_reuse_policy_cfg;
DELETE FROM user_manage;
#clear vpn
DELETE FROM service_dict_info where item_type='5';
#<23><><EFBFBD><EFBFBD>DNS<4E><53><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҳ<EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>100<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Բ<EFBFBD><EFBFBD>Է<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>101<EFBFBD><EFBFBD>ʼ
#<23><><EFBFBD><EFBFBD>DNS<4E><53><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҳ<EFBFBD><D2B2>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD>100<30><30><EFBFBD><EFBFBD><EFBFBD>Բ<EFBFBD><D4B2>Է<EFBFBD><D4B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>101<30><31>ʼ
ALTER TABLE policy_group_info auto_increment = 101;
#<23><><EFBFBD><EFBFBD>asn<EFBFBD>ŷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
#<23><><EFBFBD>asn<73>ŷ<EFBFBD><C5B7><EFBFBD><EFBFBD>
DELETE FROM asn_group_info;
<>϶<EFBFBD>̬IP<49><50>ַ<EFBFBD><D6B7>
<>϶<EFBFBD>̬IP<49><50>ַ<EFBFBD><D6B7>
INSERT INTO `ip_reuse_addr_pool` (`cfg_id`, `addr_pool_name`, `ip_total`, `action`, `is_valid`, `is_audit`, `cfg_region_code`, `cfg_type`, `function_id`, `service_id`, `compile_id`, `is_area_effective`, `area_effective_ids`, `request_id`, `classify`, `attribute`, `lable`, `creator_id`, `create_time`, `editor_id`, `edit_time`, `auditor_id`, `audit_time`, `description`, `cancel_request_id`, `user_region1`, `user_region2`, `user_region3`, `user_region4`, `user_region5`) VALUES ('0', 'dynamic_pool', '1', '96', '1', '1', '1', 'IR_STATIC_NOMINEE_IP', '633', '834', '0', '0', '', '0', '0', '0', '0', '0', '0000-00-00 00:00:00', NULL, '0000-00-00 00:00:00', NULL, '0000-00-00 00:00:00', '', NULL, '', '', '', '', '');
UPDATE ip_reuse_addr_pool set cfg_id=0 where addr_pool_name= 'dynamic_pool';
DELETE FROM schedule_cfg;
DELETE FROM schedule_exce_log;
DELETE FROM schedule_exce_new;
DELETE FROM sys_log;
DELETE FROM sys_cfg_operation_log;
DELETE FROM sys_cfg_operation_log;
@@ -85,11 +82,13 @@ DELETE FROM cfg_num_statistics;
DELETE FROM request_num_statistics;
DELETE FROM common_keyword_cfg;
DELETE FROM pxy_obj_spoofing_ip_pool;
DELETE FROM schedule_cfg;
DELETE FROM schedule_exce_log;
DELETE FROM schedule_exce_new;
#<23><>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD>ı<EFBFBD><C4B1>ؽ<EFBFBD>sql<71><6C><EFBFBD><EFBFBD><EFBFBD>ڸ<EFBFBD><DAB8><EFBFBD>֮<EFBFBD><D6AE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD>ؽ<EFBFBD><D8BD><EFBFBD>
#<23><>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>ı<EFBFBD><C4B1>ؽ<EFBFBD>sql<71><6C><EFBFBD><EFBFBD><EFBFBD>ڸ<EFBFBD><DAB8><EFBFBD>֮<EFBFBD><D6AE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD>ؽ<EFBFBD><D8BD><EFBFBD>
# In your Quartz properties file, you'll need to set
# org.quartz.jobStore.driverDelegateClass = org.quartz.impl.jdbcjobstore.StdJDBCDelegate
#

View File

@@ -225,12 +225,29 @@
<div class="row">
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="examine"/></label>
<div class="col-md-6">
<label class="radio-inline">
<input type="radio" name="isSend" value="0" checked><spring:message code="no"/>
</label>
<label class="radio-inline">
<input type="radio" name="isSend" value="1"><spring:message code="yes"/>
</label>
<!-- 拥有配置新增直接生效的功能权限导入时默认导入+下发 -->
<shiro:hasPermission name="save:audit:permission">
<c:set var="auditPermission" value="true"></c:set>
</shiro:hasPermission>
<c:choose>
<c:when test="${!(fns:getUser().isAdmin()) && auditPermission}">
<label class="radio-inline">
<input type="radio" name="isSend" value="0"><spring:message code="no"/>
</label>
<label class="radio-inline">
<input type="radio" name="isSend" value="1" checked><spring:message code="yes"/>
</label>
</button>
</c:when>
<c:otherwise>
<label class="radio-inline">
<input type="radio" name="isSend" value="0" checked><spring:message code="no"/>
</label>
<label class="radio-inline">
<input type="radio" name="isSend" value="1"><spring:message code="yes"/>
</label>
</c:otherwise>
</c:choose>
</div>
</div>
</br>

View File

@@ -116,6 +116,7 @@ function update(url){
return;
} */
if($(checkboxes).filter(":checked").length==1){
//TODO 生效配置可更改功能,在最后功能实现完成后打开【打开时确认来函和专项是否影响】
if(cked.val()==1){
top.$.jBox.tip("<spring:message code='has_approved'/>", "<spring:message code='info'/>");
return;

View File

@@ -169,6 +169,8 @@
<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="isValid" value="${_cfg.isValid}">
<input type="hidden" name="isAudit" value="${_cfg.isAudit}">
<!-- <input type="hidden" name="protocol" value="0">
<input type="hidden" name="direction" value="0"> -->
<input type="hidden" name="isAreaEffective" value="0" >
@@ -342,9 +344,23 @@
<div class="col-md-6">
<div class="row">
<div class="col-md-offset-3 col-md-8">
<button id="save" type="submit" class="btn green">
<spring:message code="submit" />
</button>
<c:set var="auditPermission" value="false"></c:set>
<!-- 拥有配置新增直接生效的功能权限 -->
<shiro:hasPermission name="save:audit:permission">
<c:set var="auditPermission" value="true"></c:set>
</shiro:hasPermission>
<c:choose>
<c:when test="${!(fns:getUser().isAdmin()) && auditPermission}">
<button id="audit" type="submit" class="btn green">
<spring:message code="submit" />
</button>
</c:when>
<c:otherwise>
<button id="save" type="submit" class="btn green">
<spring:message code="submit" />
</button>
</c:otherwise>
</c:choose>
<button id="cancel" type="button" class="btn default">
<spring:message code="cancel" />
</button>