Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -182,11 +182,11 @@ public static UserIdentity fromString(String userIdentStr) {
}

public boolean isRootUser() {
return user.equals(Auth.ROOT_USER);
return this.equals(ROOT);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so root@192.168.0.1 cannot do anything if it has no privilege?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. if only has one default user root@%, user login from 192.168.0.1,will have root priv
  2. if create a user root@192.168.0.1,then login from 192.168.0.1,will have no priv

}

public boolean isAdminUser() {
return user.equals(Auth.ADMIN_USER);
return this.equals(ADMIN);
}

public boolean isSystemUser() {
Expand Down
38 changes: 38 additions & 0 deletions regression-test/suites/account_p0/test_system_user.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,42 @@ suite("test_system_user","p0,auth") {
revoke select_priv on *.*.* from `admin`;
"""

sql """
create user `root`@'8.8.8.8';
"""
sql """
grant select_priv on *.*.* to `root`@'8.8.8.8';
"""
sql """
revoke select_priv on *.*.* from `root`@'8.8.8.8';
"""
test {
sql """
grant 'operator' to `root`@'8.8.8.8';
"""
exception "Can not grant role: operator"
}
sql """
drop user `root`@'8.8.8.8';
"""

sql """
create user `admin`@'8.8.8.8';
"""
sql """
grant select_priv on *.*.* to `admin`@'8.8.8.8';
"""
sql """
revoke select_priv on *.*.* from `admin`@'8.8.8.8';
"""

sql """
grant 'admin' to `admin`@'8.8.8.8';
"""
sql """
revoke 'admin' from `admin`@'8.8.8.8';
"""
sql """
drop user `admin`@'8.8.8.8';
"""
}