Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: checker #828

Merged
merged 2 commits into from
Mar 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading