|
|
@ -29,9 +29,7 @@ import static javax.swing.JOptionPane.WARNING_MESSAGE; |
|
|
|
|
|
|
|
|
|
|
|
public class JTemplateAuthorityChecker { |
|
|
|
public class JTemplateAuthorityChecker { |
|
|
|
JTemplate<?, ?> jTemplate; |
|
|
|
JTemplate<?, ?> jTemplate; |
|
|
|
Set<String> allConnectionNames; |
|
|
|
|
|
|
|
Set<String> authConnectionNames; |
|
|
|
Set<String> authConnectionNames; |
|
|
|
Set<String> allDatasetNames; |
|
|
|
|
|
|
|
Set<String> authDatasetNames; |
|
|
|
Set<String> authDatasetNames; |
|
|
|
Map<String, ElementAuthorityChecker> checkerMap = new HashMap<>(); |
|
|
|
Map<String, ElementAuthorityChecker> checkerMap = new HashMap<>(); |
|
|
|
Set<String> authFailConnectionNames = new HashSet<>(); |
|
|
|
Set<String> authFailConnectionNames = new HashSet<>(); |
|
|
@ -47,13 +45,7 @@ public class JTemplateAuthorityChecker { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void initAuthNames() { |
|
|
|
private void initAuthNames() { |
|
|
|
allDatasetNames = new HashSet<>(); |
|
|
|
// 无需获取所有数据集和数据连接了,当前只能获取自己有权限的
|
|
|
|
for (String authServerDataSetName : TableDataConfigProviderFactory.getInstance().getTableDatas().keySet()) { |
|
|
|
|
|
|
|
allDatasetNames.add(authServerDataSetName); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
allConnectionNames = ConnectionConfigProviderFactory.getConfigProvider().getConnections().keySet(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Map<String, Set<String>> authNamesMap = RemoteAuthorityRepository.getInstance().getAuthServerDataSetAndConnectionNames(WorkContext.getCurrent().getConnection().getUserName()); |
|
|
|
Map<String, Set<String>> authNamesMap = RemoteAuthorityRepository.getInstance().getAuthServerDataSetAndConnectionNames(WorkContext.getCurrent().getConnection().getUserName()); |
|
|
|
if (authNamesMap != null) { |
|
|
|
if (authNamesMap != null) { |
|
|
|
//有权限的数据连接名称
|
|
|
|
//有权限的数据连接名称
|
|
|
@ -95,8 +87,6 @@ public class JTemplateAuthorityChecker { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
authFailConnectionNames.retainAll(allConnectionNames); |
|
|
|
|
|
|
|
authFailDatasetNames.retainAll(allDatasetNames); |
|
|
|
|
|
|
|
FineLoggerFactory.getLogger().info("JTemplateAuthorityChecker check time consume:" + (System.currentTimeMillis() - s)); |
|
|
|
FineLoggerFactory.getLogger().info("JTemplateAuthorityChecker check time consume:" + (System.currentTimeMillis() - s)); |
|
|
|
return authFailConnectionNames.size() == 0 && authFailDatasetNames.size() == 0; |
|
|
|
return authFailConnectionNames.size() == 0 && authFailDatasetNames.size() == 0; |
|
|
|
} |
|
|
|
} |
|
|
|