提交 a3367698 authored 作者: noelgrandin's avatar noelgrandin

Issue 471: CREATE VIEW does not check user rights, patch from Andrew Franklin

上级 f6798389
...@@ -37,6 +37,7 @@ Change Log ...@@ -37,6 +37,7 @@ Change Log
</li><li>Issue 478: Support for "SHOW TRANSACTION ISOLATION LEVEL", patch from Andrew Franklin </li><li>Issue 478: Support for "SHOW TRANSACTION ISOLATION LEVEL", patch from Andrew Franklin
</li><li>Issue 475: PgServer: add support for CancelRequest, patch from Andrew Franklin </li><li>Issue 475: PgServer: add support for CancelRequest, patch from Andrew Franklin
</li><li>Issue 473: PgServer missing -key option, patch from Andrew Franklin </li><li>Issue 473: PgServer missing -key option, patch from Andrew Franklin
</li><li>Issue 471: CREATE VIEW does not check user rights, patch from Andrew Franklin
</li></ul> </li></ul>
<h2>Version 1.3.172 (2013-05-25)</h2> <h2>Version 1.3.172 (2013-05-25)</h2>
......
...@@ -73,6 +73,7 @@ public class CreateView extends SchemaCommand { ...@@ -73,6 +73,7 @@ public class CreateView extends SchemaCommand {
@Override @Override
public int update() { public int update() {
session.commit(true); session.commit(true);
session.getUser().checkAdmin();
Database db = session.getDatabase(); Database db = session.getDatabase();
TableView view = null; TableView view = null;
Table old = getSchema().findTableOrView(session, viewName); Table old = getSchema().findTableOrView(session, viewName);
......
...@@ -234,6 +234,8 @@ public class TestRights extends TestBase { ...@@ -234,6 +234,8 @@ public class TestRights extends TestBase {
executeError("SELECT * FROM (SELECT * FROM PASS)"); executeError("SELECT * FROM (SELECT * FROM PASS)");
assertThrows(ErrorCode.TABLE_OR_VIEW_NOT_FOUND_1, stat). assertThrows(ErrorCode.TABLE_OR_VIEW_NOT_FOUND_1, stat).
execute("CREATE VIEW X AS SELECT * FROM PASS_READER"); execute("CREATE VIEW X AS SELECT * FROM PASS_READER");
assertThrows(ErrorCode.ADMIN_RIGHTS_REQUIRED, stat).
execute("CREATE VIEW X AS SELECT * FROM PASS_NAME");
conn.close(); conn.close();
conn = getConnection("rights"); conn = getConnection("rights");
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论