Skip to content

Commit

Permalink
fix: checker (#828)
Browse files Browse the repository at this point in the history
  • Loading branch information
masaimu authored Mar 28, 2024
1 parent deee523 commit 7a2f055
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,10 @@ public MonitorPageResult<AlarmGroupDTO> getListByPage(

AlarmGroup alarmGroup = alarmGroupConverter.dtoToDO(pageRequest.getTarget());

this.requestContextAdapter.queryWrapperTenantAdapt(wrapper, alarmGroup.getTenant(),
alarmGroup.getWorkspace());
wrapper.eq("tenant", alarmGroup.getTenant());
if (StringUtils.isNotEmpty(alarmGroup.getWorkspace())) {
wrapper.eq("workspace", alarmGroup.getWorkspace());
}

if (null != alarmGroup.getId()) {
wrapper.eq("id", alarmGroup.getId());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,11 +270,15 @@ private LevelAuthorizationCheckResult checkAlarmRuleDTO(String methodName,
}

if (StringUtils.isNotEmpty(alarmRuleDTO.getNoticeType())) {
return failCheckResult("noticeType %s should be empty", alarmRuleDTO.getMergeType());
return failCheckResult("noticeType %s should be empty", alarmRuleDTO.getNoticeType());
}

if (!CollectionUtils.isEmpty(alarmRuleDTO.getAlarmContent())) {
return failCheckResult("alarmContent %s should be empty", alarmRuleDTO.getMergeType());
for (String content : alarmRuleDTO.getAlarmContent()) {
if (!sqlCnNameCheck(content)) {
return failCheckResult("invalid content %s in alarmContent", content);
}
}
}

if (StringUtils.isNotEmpty(alarmRuleDTO.getTenant())
Expand Down Expand Up @@ -471,7 +475,7 @@ private LevelAuthorizationCheckResult checkCompareConfigs(List<CompareConfig> co
config.getTriggerLevel());
}
if (StringUtils.isNotEmpty(config.getTriggerContent())
&& !checkSqlName(config.getTriggerContent())) {
&& !sqlCnNameCheck(config.getTriggerContent())) {
return failCheckResult("fail to check triggerContent in compareConfigs %s",
config.getTriggerContent());
}
Expand Down Expand Up @@ -509,9 +513,9 @@ private LevelAuthorizationCheckResult checkExtra(AlertRuleExtra extra, String te
if (StringUtils.isNotEmpty(extra.sourceLink)) {
return failCheckResult("sourceLink %s should be empty", extra.sourceLink);
}
if (StringUtils.isNotEmpty(extra.md5)) {
return failCheckResult("md5 %s should be empty", extra.md5);
}
// if (StringUtils.isNotEmpty(extra.md5)) {
// return failCheckResult("md5 %s should be empty", extra.md5);
// }
if (!CollectionUtils.isEmpty(extra.alertTags) && !checkSqlField(extra.alertTags)) {
return failCheckResult("fail to check sql field in alertTags %s", J.toJson(extra.alertTags));
}
Expand Down

0 comments on commit 7a2f055

Please sign in to comment.