From 2e478b186908544a83d9f1faacad0622db20348d Mon Sep 17 00:00:00 2001 From: wenshao Date: Sun, 25 Sep 2016 02:11:43 +0800 Subject: [PATCH] improved WallFilter config. issue #1426 --- .../druid/pool/DruidDataSourceFactory.java | 6 ++++ .../com/alibaba/druid/wall/WallConfig.java | 36 +++++++++++-------- 2 files changed, 27 insertions(+), 15 deletions(-) diff --git a/src/main/java/com/alibaba/druid/pool/DruidDataSourceFactory.java b/src/main/java/com/alibaba/druid/pool/DruidDataSourceFactory.java index 7d85286b0e..c8a92827cd 100644 --- a/src/main/java/com/alibaba/druid/pool/DruidDataSourceFactory.java +++ b/src/main/java/com/alibaba/druid/pool/DruidDataSourceFactory.java @@ -94,6 +94,12 @@ public class DruidDataSourceFactory implements ObjectFactory { "druid.maxWaitThreadCount", // "druid.failFast", // "druid.phyTimeoutMillis", // + "druid.wall.tenantColumn", // + "druid.wall.updateAllow", // + "druid.wall.deleteAllow", // + "druid.wall.insertAllow", // + "druid.wall.selelctAllow", // + "druid.wall.multiStatementAllow", // }; @Override diff --git a/src/main/java/com/alibaba/druid/wall/WallConfig.java b/src/main/java/com/alibaba/druid/wall/WallConfig.java index 2078222e8a..f8c6de0755 100644 --- a/src/main/java/com/alibaba/druid/wall/WallConfig.java +++ b/src/main/java/com/alibaba/druid/wall/WallConfig.java @@ -791,33 +791,39 @@ public class WallConfig implements WallConfigMBean { public void configFromProperties(Properties properties) { { - String tenantColumn = properties.getProperty("druid.wall.tenantColumn"); - if (tenantColumn != null) { - this.setTenantColumn(tenantColumn); + String propertyValue = properties.getProperty("druid.wall.tenantColumn"); + if (propertyValue != null) { + this.setTenantColumn(propertyValue); } } { - Boolean selelctAllow = getBoolean(properties, "druid.wall.selelctAllow"); - if (selelctAllow != null) { - this.setSelelctAllow(selelctAllow); + Boolean propertyValue = getBoolean(properties, "druid.wall.selelctAllow"); + if (propertyValue != null) { + this.setSelelctAllow(propertyValue); } } { - Boolean updateAllow = getBoolean(properties, "druid.wall.updateAllow"); - if (updateAllow != null) { - this.setUpdateAllow(updateAllow); + Boolean propertyValue = getBoolean(properties, "druid.wall.updateAllow"); + if (propertyValue != null) { + this.setUpdateAllow(propertyValue); } } { - Boolean deleteAllow = getBoolean(properties, "druid.wall.deleteAllow"); - if (deleteAllow != null) { - this.setDeleteAllow(deleteAllow); + Boolean propertyValue = getBoolean(properties, "druid.wall.deleteAllow"); + if (propertyValue != null) { + this.setDeleteAllow(propertyValue); } } { - Boolean insertAllow = getBoolean(properties, "druid.wall.insertAllow"); - if (insertAllow != null) { - this.setInsertAllow(insertAllow); + Boolean propertyValue = getBoolean(properties, "druid.wall.insertAllow"); + if (propertyValue != null) { + this.setInsertAllow(propertyValue); + } + } + { + Boolean propertyValue = getBoolean(properties, "druid.wall.multiStatementAllow"); + if (propertyValue != null) { + this.setMultiStatementAllow(propertyValue); } } }