|
|
|
@ -1,6 +1,7 @@
|
|
|
|
|
package com.fr.design.mainframe.authority; |
|
|
|
|
|
|
|
|
|
import com.fr.base.Formula; |
|
|
|
|
import org.jetbrains.annotations.Nullable; |
|
|
|
|
|
|
|
|
|
import java.util.Arrays; |
|
|
|
|
import java.util.HashSet; |
|
|
|
@ -9,11 +10,13 @@ import java.util.regex.Matcher;
|
|
|
|
|
import java.util.regex.Pattern; |
|
|
|
|
|
|
|
|
|
public class FormulaAuthorityChecker extends ElementAuthorityChecker<Formula> { |
|
|
|
|
private static final Pattern FORMULA_PATTERN = Pattern.compile("^=SQL\\(\"(.+?)\","); |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
@Nullable |
|
|
|
|
public Set<String> getNoAuthConnectionNames(Formula formula, Set<String> authConnectionNames) { |
|
|
|
|
String content = formula.getContent(); |
|
|
|
|
Pattern pattern = Pattern.compile("^=SQL\\(\"(.+?)\","); |
|
|
|
|
Matcher matcher = pattern.matcher(content); |
|
|
|
|
Matcher matcher = FORMULA_PATTERN.matcher(content); |
|
|
|
|
if (matcher.find()) { |
|
|
|
|
if (!authConnectionNames.contains(matcher.group(1))) { |
|
|
|
|
return new HashSet<>(Arrays.asList(matcher.group(1))); |
|
|
|
|