提交 dbdf3f18 authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Process schema rights on schema rename

上级 515bee4a
...@@ -127,6 +127,18 @@ public class Schema extends DbObjectBase { ...@@ -127,6 +127,18 @@ public class Schema extends DbObjectBase {
&& triggers.isEmpty() && constraints.isEmpty() && constants.isEmpty() && functions.isEmpty(); && triggers.isEmpty() && constraints.isEmpty() && constants.isEmpty() && functions.isEmpty();
} }
@Override
public ArrayList<DbObject> getChildren() {
ArrayList<DbObject> children = New.arrayList();
ArrayList<Right> rights = database.getAllRights();
for (Right right : rights) {
if (right.getGrantedObject() == this) {
children.add(right);
}
}
return children;
}
@Override @Override
public void removeChildrenAndResources(Session session) { public void removeChildrenAndResources(Session session) {
while (triggers != null && triggers.size() > 0) { while (triggers != null && triggers.size() > 0) {
......
...@@ -48,6 +48,8 @@ public class TestRights extends TestBase { ...@@ -48,6 +48,8 @@ public class TestRights extends TestBase {
testSchemaRenameUser(); testSchemaRenameUser();
testAccessRights(); testAccessRights();
testSchemaAdminRole(); testSchemaAdminRole();
testTableRename();
testSchemaRename();
testSchemaDrop(); testSchemaDrop();
deleteDb("rights"); deleteDb("rights");
} }
...@@ -492,6 +494,43 @@ public class TestRights extends TestBase { ...@@ -492,6 +494,43 @@ public class TestRights extends TestBase {
conn.close(); conn.close();
} }
private void testTableRename() throws SQLException {
if (config.memory) {
return;
}
deleteDb("rights");
Connection conn = getConnection("rights");
stat = conn.createStatement();
stat.execute("create user test password '' admin");
stat.execute("create schema b");
stat.execute("create table b.t1(id int)");
stat.execute("grant select on b.t1 to test");
stat.execute("alter table b.t1 rename to b.t2");
conn.close();
conn = getConnection("rights");
stat = conn.createStatement();
stat.execute("drop user test");
conn.close();
}
private void testSchemaRename() throws SQLException {
if (config.memory) {
return;
}
deleteDb("rights");
Connection conn = getConnection("rights");
stat = conn.createStatement();
stat.execute("create user test password '' admin");
stat.execute("create schema b");
stat.execute("grant select on schema b to test");
stat.execute("alter schema b rename to c");
conn.close();
conn = getConnection("rights");
stat = conn.createStatement();
stat.execute("drop user test");
conn.close();
}
private void testSchemaDrop() throws SQLException { private void testSchemaDrop() throws SQLException {
if (config.memory) { if (config.memory) {
return; return;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论