improve WallFilter

This commit is contained in:
wenshao
2012-12-21 00:19:49 +08:00
parent 611278a219
commit 62d98fb72b
4 changed files with 10 additions and 10 deletions
@@ -61,7 +61,7 @@ public class WallConfig implements WallConfigMBean {
private boolean mustParameterized = false;
private boolean allowDoPrivileged = false;
private boolean doPrivilegedAllow = false;
protected final Set<String> permitFunctions = new HashSet<String>();
protected final Set<String> permitTables = new HashSet<String>();
@@ -117,12 +117,12 @@ public class WallConfig implements WallConfigMBean {
this.wrapAllow = wrapAllow;
}
public boolean isAllowDoPrivileged() {
return allowDoPrivileged;
public boolean isDoPrivilegedAllow() {
return doPrivilegedAllow;
}
public void setAllowDoPrivileged(boolean allowDoPrivileged) {
this.allowDoPrivileged = allowDoPrivileged;
public void setDoPrivilegedAllow(boolean doPrivilegedAllow) {
this.doPrivilegedAllow = doPrivilegedAllow;
}
public boolean isSelectAllColumnAllow() {
@@ -320,7 +320,7 @@ public class WallFilter extends FilterAdapter implements WallFilterMBean {
@Override
public boolean isWrapperFor(FilterChain chain, Wrapper wrapper, Class<?> iface) throws SQLException {
if (config.isAllowDoPrivileged() && WallProvider.ispPivileged()) {
if (config.isDoPrivilegedAllow() && WallProvider.ispPivileged()) {
return chain.isWrapperFor(wrapper, iface);
}
@@ -332,7 +332,7 @@ public class WallFilter extends FilterAdapter implements WallFilterMBean {
@Override
public <T> T unwrap(FilterChain chain, Wrapper wrapper, Class<T> iface) throws SQLException {
if (config.isAllowDoPrivileged() && WallProvider.ispPivileged()) {
if (config.isDoPrivilegedAllow() && WallProvider.ispPivileged()) {
return chain.unwrap(wrapper, iface);
}
@@ -346,7 +346,7 @@ public class WallFilter extends FilterAdapter implements WallFilterMBean {
@Override
public DatabaseMetaData connection_getMetaData(FilterChain chain, ConnectionProxy connection) throws SQLException {
if (config.isAllowDoPrivileged() && WallProvider.ispPivileged()) {
if (config.isDoPrivilegedAllow() && WallProvider.ispPivileged()) {
return chain.connection_getMetaData(connection);
}
@@ -119,7 +119,7 @@ public abstract class WallProvider {
public WallCheckResult check(String sql) {
WallCheckResult result = new WallCheckResult();
if (config.isAllowDoPrivileged() && privileged.get() == Boolean.TRUE) {
if (config.isDoPrivilegedAllow() && ispPivileged()) {
return result;
}
@@ -33,7 +33,7 @@ public class DoPrivilegedTest extends TestCase {
public void test_1() throws Exception {
final WallConfig config = new WallConfig();
config.setAllowDoPrivileged(true);
config.setDoPrivilegedAllow(true);
WallProvider.doPrivileged(new PrivilegedAction<Object>() {
@Override