This is an automated email from the ASF dual-hosted git repository.

jackietien pushed a commit to branch TIMECHODB-395
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/TIMECHODB-395 by this push:
     new 2f856070dc3 add it
2f856070dc3 is described below

commit 2f856070dc3786ab0db2a0376d9e6da6220b50dc
Author: JackieTien97 <[email protected]>
AuthorDate: Wed Nov 22 15:52:46 2023 +0800

    add it
---
 .../org/apache/iotdb/db/it/auth/IoTDBAuthIT.java   | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git 
a/integration-test/src/test/java/org/apache/iotdb/db/it/auth/IoTDBAuthIT.java 
b/integration-test/src/test/java/org/apache/iotdb/db/it/auth/IoTDBAuthIT.java
index dc96a20a5ac..7dca5a275a1 100644
--- 
a/integration-test/src/test/java/org/apache/iotdb/db/it/auth/IoTDBAuthIT.java
+++ 
b/integration-test/src/test/java/org/apache/iotdb/db/it/auth/IoTDBAuthIT.java
@@ -1168,4 +1168,26 @@ public class IoTDBAuthIT {
       Assert.assertTrue(standards.isEmpty());
     }
   }
+
+  @Test
+  public void insertWithTemplateTest() throws SQLException {
+    try (Connection adminCon = EnvFactory.getEnv().getConnection();
+        Statement adminStmt = adminCon.createStatement()) {
+      adminStmt.execute("CREATE USER tempuser 'temppw'");
+
+      try (Connection userCon = EnvFactory.getEnv().getConnection("tempuser", 
"temppw");
+          Statement userStmt = userCon.createStatement()) {
+
+        adminStmt.execute("CREATE DATABASE root.a");
+        adminStmt.execute("create schema template t1 aligned (s_name TEXT)");
+        adminStmt.execute("GRANT WRITE_DATA ON root.a.** TO USER tempuser");
+        adminStmt.execute("set schema template t1 to root.a");
+
+        // grant privilege to insert
+        Assert.assertThrows(
+            SQLException.class,
+            () -> userStmt.execute("INSERT INTO root.a.d1(timestamp, s_name) 
VALUES (1,'IoTDB')"));
+      }
+    }
+  }
 }

Reply via email to