提交 ed627d41 编写于 作者: S Serge Rider

#8298 MySQL: user create fix (empty name by default)

上级 44dc61af
......@@ -18,6 +18,7 @@
package org.jkiss.dbeaver.ext.mysql.ui.config;
import org.jkiss.code.Nullable;
import org.jkiss.dbeaver.DBException;
import org.jkiss.dbeaver.ext.mysql.model.MySQLDataSource;
import org.jkiss.dbeaver.ext.mysql.model.MySQLUser;
import org.jkiss.dbeaver.ext.mysql.ui.internal.MySQLUIMessages;
......@@ -33,6 +34,7 @@ import org.jkiss.dbeaver.model.impl.edit.SQLScriptCommand;
import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor;
import org.jkiss.dbeaver.model.struct.DBSObject;
import org.jkiss.dbeaver.model.struct.cache.DBSObjectCache;
import org.jkiss.utils.CommonUtils;
import java.util.Map;
......@@ -108,6 +110,17 @@ public class MySQLUserManager extends AbstractObjectManager<MySQLUser> implement
{
super(user, MySQLUIMessages.edit_user_manager_command_create_user);
}
@Override
public void validateCommand(DBRProgressMonitor monitor, Map<String, Object> options) throws DBException {
if (CommonUtils.isEmpty(getObject().getUserName())) {
throw new DBException("Can't create user with empty name");
}
if (CommonUtils.isEmpty(getObject().getHost())) {
throw new DBException("Can't create user with empty host name");
}
super.validateCommand(monitor, options);
}
}
......
......@@ -86,7 +86,7 @@ public class MySQLUser implements DBAUser, DBARole, DBPRefreshableObject, DBPSav
this.maxUserConnections = JDBCUtils.safeGetInt(resultSet, "max_user_connections");
} else {
this.persisted = false;
this.userName = "user";
this.userName = "";
this.host = "%";
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册