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 @@ -178,11 +178,11 @@ public static UserIdentity fromString(String userIdentStr) {
}

public boolean isRootUser() {
return user.equals(Auth.ROOT_USER);
return this.equals(ROOT);
}

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';
"""
}