Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

*: support "show create user" #9240

Merged
merged 19 commits into from Feb 21, 2019
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

add ut

  • Loading branch information...
lnhote committed Feb 1, 2019
commit 5722fe51fdcbfeca443f8c3311fbbf9d6e0e4bf8
@@ -823,7 +823,7 @@ func (e *ShowExec) fetchShowCreateUser() error {
if checker == nil {
return errors.New("miss privilege checker")
}
//password is encoded, like "*6C387FC3893DBA1E3BA155E74754DA6682D04747"
//password is encoded, like "*81F5E21E35407D884A6CD4A731AEBFB6AF209E1B"(root)
password := checker.GetEncodedPassword(e.User.Username, e.User.Hostname)
option := "REQUIRE NONE PASSWORD EXPIRE DEFAULT ACCOUNT UNLOCK"
showStr := fmt.Sprintf("CREATE USER '%s'@'%s' IDENTIFIED WITH 'mysql_native_password' AS '%s' %s",
@@ -201,6 +201,14 @@ func (s *testSuite2) TestShow2(c *C) {
tk.MustQuery("show grants for current_user").Check(testkit.Rows(`GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'`))
}

func (s *testSuite2) TestShow3(c *C) {
tk := testkit.NewTestKit(c, s.store)
// Create a new user.
createUserSQL := `CREATE USER 'test_show_create_user'@'%' IDENTIFIED BY 'root';`
tk.MustExec(createUserSQL)
tk.MustQuery("show create user 'test_show_create_user'@'%'").Check(testkit.Rows(`CREATE USER 'test_show_create_user'@'%' IDENTIFIED WITH 'mysql_native_password' AS '*81F5E21E35407D884A6CD4A731AEBFB6AF209E1B' REQUIRE NONE PASSWORD EXPIRE DEFAULT ACCOUNT UNLOCK`))
}

func (s *testSuite2) TestUnprivilegedShow(c *C) {

tk := testkit.NewTestKit(c, s.store)
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.