mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
sql wall allow rename table
This commit is contained in:
@@ -39,6 +39,7 @@ public class WallConfig implements WallConfigMBean {
|
||||
private boolean createTableAllow = true;
|
||||
private boolean dropTableAllow = true;
|
||||
private boolean alterTableAllow = true;
|
||||
private boolean renameTableAllow = true;
|
||||
|
||||
private boolean conditionAndAlwayTrueAllow = false;
|
||||
private boolean conditionAndAlwayFalseAllow = false;
|
||||
@@ -411,6 +412,14 @@ public class WallConfig implements WallConfigMBean {
|
||||
this.alterTableAllow = alterTableAllow;
|
||||
}
|
||||
|
||||
public boolean isRenameTableAllow() {
|
||||
return renameTableAllow;
|
||||
}
|
||||
|
||||
public void setRenameTableAllow(boolean renameTableAllow) {
|
||||
this.renameTableAllow = renameTableAllow;
|
||||
}
|
||||
|
||||
public boolean isSelectUnionCheck() {
|
||||
return selectUnionCheck;
|
||||
}
|
||||
|
||||
@@ -97,6 +97,7 @@ import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlCommitStatement;
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlDeleteStatement;
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlDescribeStatement;
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlInsertStatement;
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlRenameTableStatement;
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlReplaceStatement;
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlSelectQueryBlock.Limit;
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlSetCharSetStatement;
|
||||
@@ -2370,6 +2371,10 @@ public class WallVisitorUtils {
|
||||
allow = config.isUseAllow();
|
||||
denyMessage = "show not allow";
|
||||
errorCode = ErrorCode.USE_NOT_ALLOW;
|
||||
} else if (x instanceof MySqlRenameTableStatement) {
|
||||
allow = config.isRenameTableAllow();
|
||||
denyMessage = "rename table not allow";
|
||||
errorCode = ErrorCode.RENAME_TABLE_NOT_ALLOW;
|
||||
} else {
|
||||
allow = config.isNoneBaseStatementAllow();
|
||||
errorCode = ErrorCode.NONE_BASE_STATEMENT_NOT_ALLOW;
|
||||
|
||||
@@ -44,6 +44,7 @@ public interface ErrorCode {
|
||||
public final static int ALTER_TABLE_NOT_ALLOW = 1102;
|
||||
public final static int DROP_TABLE_NOT_ALLOW = 1103;
|
||||
public final static int COMMENT_STATEMENT_NOT_ALLOW = 1104;
|
||||
public final static int RENAME_TABLE_NOT_ALLOW = 1105;
|
||||
|
||||
public final static int LIMIT_ZERO = 2200;
|
||||
public final static int MULTI_STATEMENT = 2201;
|
||||
|
||||
Reference in New Issue
Block a user