Caideyipi commented on code in PR #14805:
URL: https://github.com/apache/iotdb/pull/14805#discussion_r1947540267
##########
integration-test/src/test/java/org/apache/iotdb/db/it/auth/IoTDBRelationalAuthIT.java:
##########
@@ -287,6 +293,168 @@ public void checkAuthorStatementPrivilegeCheck() throws
SQLException {
@Test
public void checkGrantRevokeAllPrivileges() throws SQLException {
+ // In this IT:
+ // grant
+ // 1. grant all on table tb1 with grant option
+ // 2. grant all on database db1
Review Comment:
db1 -> testdb
##########
iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/auth/authorizer/BasicAuthorizer.java:
##########
@@ -201,6 +217,17 @@ public void revokePrivilegeFromRole(String roleName,
PrivilegeUnion union) throw
roleManager.revokePrivilegeFromEntity(roleName, union);
}
+ @Override
+ public void revokeAllPrivilegeFromRole(String roleName) throws AuthException
{
+ Role role = roleManager.getEntity(roleName);
+ if (role == null) {
+ throw new AuthException(
+ TSStatusCode.USER_NOT_EXIST, String.format("Role %s does not exist",
roleName));
Review Comment:
ROLE_NOT_EXIST?
##########
iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/auth/authorizer/BasicAuthorizer.java:
##########
@@ -201,6 +217,17 @@ public void revokePrivilegeFromRole(String roleName,
PrivilegeUnion union) throw
roleManager.revokePrivilegeFromEntity(roleName, union);
}
+ @Override
+ public void revokeAllPrivilegeFromRole(String roleName) throws AuthException
{
+ Role role = roleManager.getEntity(roleName);
+ if (role == null) {
+ throw new AuthException(
+ TSStatusCode.USER_NOT_EXIST, String.format("Role %s does not exist",
roleName));
+ }
+ role.setObjectPrivilegeMap(new HashMap<>());
+ role.getSysPrivilege().removeIf(PrivilegeType::forRelationalSys);
Review Comment:
Why the 2 functions are different?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]