Skip to content
Open
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 @@ -833,12 +833,8 @@ public void testPermission() {
"803: No permissions for this operation, please add privilege SYSTEM",
"test",
"test123123456");
assertTestFail(
senderEnv,
"show pipes",
"803: No permissions for this operation, please add privilege SYSTEM",
"test",
"test123123456");
// Will not throw exception
executeQueryWithRetry(senderEnv, "show pipes", "test", "test123123456");
assertNonQueryTestFail(
senderEnv,
"start pipe testPipe",
Expand Down Expand Up @@ -866,7 +862,7 @@ public void testPermission() {
"test123123456");
assertTestFail(
senderEnv,
"show pipe plugins",
"show pipePlugins",
"803: No permissions for this operation, please add privilege SYSTEM",
"test",
"test123123456");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import org.apache.iotdb.common.rpc.thrift.TSStatus;
import org.apache.iotdb.commons.client.sync.SyncConfigNodeIServiceClient;
import org.apache.iotdb.confignode.rpc.thrift.TCreatePipeReq;
import org.apache.iotdb.confignode.rpc.thrift.TShowPipeReq;
import org.apache.iotdb.consensus.ConsensusFactory;
import org.apache.iotdb.db.it.utils.TestUtils;
import org.apache.iotdb.it.env.MultiEnvFactory;
Expand All @@ -39,6 +38,7 @@
import org.junit.runner.RunWith;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Arrays;
Expand Down Expand Up @@ -360,8 +360,9 @@ public void testSourcePermission() {
TestUtils.executeNonQuery(senderEnv, "create database root.test1");

// Shall be transferred
// The root.test may or may not be transferred due to delayed start of the config source
TestUtils.assertDataEventuallyOnEnv(
receiverEnv, "count databases root.tes*", "count,", Collections.singleton("1,"));
receiverEnv, "count databases root.test1", "count,", Collections.singleton("1,"));

// Alter pipe, throw exception if no privileges
try (final Connection connection = senderEnv.getConnection();
Expand Down Expand Up @@ -417,10 +418,12 @@ public void testSourcePermission() {
TestUtils.executeNonQuery(senderEnv, "revoke SYSTEM on root.** from user thulab");

// A user shall only see its own pipe
try (final SyncConfigNodeIServiceClient client =
(SyncConfigNodeIServiceClient) senderEnv.getLeaderConfigNodeConnection()) {
Assert.assertEquals(
1, client.showPipe(new TShowPipeReq().setUserName("thulab")).pipeInfoList.size());
try (final Connection connection = senderEnv.getConnection("thulab", "passwD@123456");
final Statement statement = connection.createStatement()) {
// Will not throw any exception
final ResultSet resultSet = statement.executeQuery("show pipes");
Assert.assertTrue(resultSet.next());
Assert.assertFalse(resultSet.next());
} catch (Exception e) {
fail(e.getMessage());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -321,9 +321,7 @@ static String[] removePasswordArgs(String[] args) {
}
}
if (index >= 0) {
if (index + 1 >= args.length
|| args[index + 1].startsWith("-")
|| (keywordSet.contains(args[index + 1]))) {
if (index + 1 >= args.length || keywordSet.contains(args[index + 1])) {
return ArrayUtils.remove(args, index);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1353,23 +1353,6 @@ public TAuthizedPatternTreeResp fetchAuthizedPatternTree(String username, int pe
}
}

public TPermissionInfoResp checkUserPrivilegeGrantOpt(String username, PrivilegeUnion union) {
TSStatus status = confirmLeader();
TPermissionInfoResp resp = new TPermissionInfoResp();
if (status.getCode() == TSStatusCode.SUCCESS_STATUS.getStatusCode()) {
try {
resp = permissionManager.checkUserPrivilegeGrantOpt(username, union);
} catch (AuthException e) {
status.setCode(e.getCode().getStatusCode()).setMessage(e.getMessage());
resp.setStatus(status);
return resp;
}
} else {
resp.setStatus(status);
}
return resp;
}

public TPermissionInfoResp checkRoleOfUser(String username, String rolename) {
TSStatus status = confirmLeader();
TPermissionInfoResp resp = new TPermissionInfoResp();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,6 @@ public PathPatternTree fetchRawAuthorizedPTree(final String userName, final Priv
return authorInfo.generateRawAuthorizedPTree(userName, type);
}

public TPermissionInfoResp checkUserPrivilegeGrantOpt(String username, PrivilegeUnion union)
throws AuthException {
union.setGrantOption(true);
return authorInfo.checkUserPrivileges(username, union);
}

public TPermissionInfoResp checkRoleOfUser(String username, String rolename)
throws AuthException {
return authorInfo.checkRoleOfUser(username, rolename);
Expand Down
Loading
Loading