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