提交 0cbf67a1 authored 作者: Thomas Mueller's avatar Thomas Mueller

Formatting.

上级 415f3fe3
...@@ -187,13 +187,13 @@ public class GrantRevoke extends DefineCommand { ...@@ -187,13 +187,13 @@ public class GrantRevoke extends DefineCommand {
* @return true if this command is using Roles * @return true if this command is using Roles
*/ */
public boolean isRoleMode() { public boolean isRoleMode() {
return roleNames != null; return roleNames != null;
} }
/** /**
* @return true if this command is using Rights * @return true if this command is using Rights
*/ */
public boolean isRightMode() { public boolean isRightMode() {
return rightMask != 0; return rightMask != 0;
} }
} }
...@@ -212,9 +212,9 @@ public class User extends RightOwner { ...@@ -212,9 +212,9 @@ public class User extends RightOwner {
* @throws DbException if this user is not a schema admin * @throws DbException if this user is not a schema admin
*/ */
public void checkSchemaAdmin() { public void checkSchemaAdmin() {
if (!admin && !hasRight(null, Right.ALTER_ANY_SCHEMA)) { if (!admin && !hasRight(null, Right.ALTER_ANY_SCHEMA)) {
throw DbException.get(ErrorCode.ADMIN_RIGHTS_REQUIRED); throw DbException.get(ErrorCode.ADMIN_RIGHTS_REQUIRED);
} }
} }
@Override @Override
......
...@@ -122,14 +122,12 @@ class WebSession { ...@@ -122,14 +122,12 @@ class WebSession {
DbContextRule tableRule = new DbContextRule(contents, DbContextRule.TABLE); DbContextRule tableRule = new DbContextRule(contents, DbContextRule.TABLE);
DbContextRule schemaRule = new DbContextRule(contents, DbContextRule.SCHEMA); DbContextRule schemaRule = new DbContextRule(contents, DbContextRule.SCHEMA);
DbContextRule columnAliasRule = new DbContextRule(contents, DbContextRule.COLUMN_ALIAS); DbContextRule columnAliasRule = new DbContextRule(contents, DbContextRule.COLUMN_ALIAS);
DbContextRule procedureRule = new DbContextRule(contents, DbContextRule.PROCEDURE);
newBnf.updateTopic("column_name", columnRule); newBnf.updateTopic("column_name", columnRule);
newBnf.updateTopic("new_table_alias", newAliasRule); newBnf.updateTopic("new_table_alias", newAliasRule);
newBnf.updateTopic("table_alias", aliasRule); newBnf.updateTopic("table_alias", aliasRule);
newBnf.updateTopic("column_alias", columnAliasRule); newBnf.updateTopic("column_alias", columnAliasRule);
newBnf.updateTopic("table_name", tableRule); newBnf.updateTopic("table_name", tableRule);
newBnf.updateTopic("schema_name", schemaRule); newBnf.updateTopic("schema_name", schemaRule);
// newBnf.updateTopic("expression", procedureRule);
newBnf.linkStatements(); newBnf.linkStatements();
bnf = newBnf; bnf = newBnf;
} catch (Exception e) { } catch (Exception e) {
......
...@@ -201,8 +201,8 @@ public class TestRights extends TestBase { ...@@ -201,8 +201,8 @@ public class TestRights extends TestBase {
} }
private void testSchemaAdminRole() throws SQLException { private void testSchemaAdminRole() throws SQLException {
if (config.memory) { if (config.memory) {
return; return;
} }
deleteDb("rights"); deleteDb("rights");
...@@ -223,12 +223,12 @@ public class TestRights extends TestBase { ...@@ -223,12 +223,12 @@ public class TestRights extends TestBase {
/* try and fail */ /* try and fail */
conn = getConnection("rights;LOG=2", "SCHEMA_CREATOR", getPassword("xyz")); conn = getConnection("rights;LOG=2", "SCHEMA_CREATOR", getPassword("xyz"));
stat = conn.createStatement(); stat = conn.createStatement();
assertThrows(ErrorCode.ADMIN_RIGHTS_REQUIRED, stat). assertThrows(ErrorCode.ADMIN_RIGHTS_REQUIRED, stat).execute(
execute("CREATE SCHEMA SCHEMA_RIGHT_TEST_WILL_FAIL"); "CREATE SCHEMA SCHEMA_RIGHT_TEST_WILL_FAIL");
assertThrows(ErrorCode.ADMIN_RIGHTS_REQUIRED, stat). assertThrows(ErrorCode.ADMIN_RIGHTS_REQUIRED, stat).execute(
execute("ALTER SCHEMA SCHEMA_RIGHT_TEST_EXISTS RENAME TO SCHEMA_RIGHT_TEST_WILL_FAIL"); "ALTER SCHEMA SCHEMA_RIGHT_TEST_EXISTS RENAME TO SCHEMA_RIGHT_TEST_WILL_FAIL");
assertThrows(ErrorCode.ADMIN_RIGHTS_REQUIRED, stat). assertThrows(ErrorCode.ADMIN_RIGHTS_REQUIRED, stat).execute(
execute("DROP SCHEMA SCHEMA_RIGHT_TEST_EXISTS"); "DROP SCHEMA SCHEMA_RIGHT_TEST_EXISTS");
conn.close(); conn.close();
/* give them */ /* give them */
...@@ -257,9 +257,9 @@ public class TestRights extends TestBase { ...@@ -257,9 +257,9 @@ public class TestRights extends TestBase {
conn = getConnection("rights;LOG=2", "SCHEMA_CREATOR", getPassword("xyz")); conn = getConnection("rights;LOG=2", "SCHEMA_CREATOR", getPassword("xyz"));
stat = conn.createStatement(); stat = conn.createStatement();
assertThrows(ErrorCode.ADMIN_RIGHTS_REQUIRED, stat). assertThrows(ErrorCode.ADMIN_RIGHTS_REQUIRED, stat).
execute("CREATE SCHEMA SCHEMA_RIGHT_TEST"); execute("CREATE SCHEMA SCHEMA_RIGHT_TEST");
assertThrows(ErrorCode.ADMIN_RIGHTS_REQUIRED, stat). assertThrows(ErrorCode.ADMIN_RIGHTS_REQUIRED, stat).
execute("ALTER SCHEMA SCHEMA_RIGHT_TEST_EXISTS RENAME TO SCHEMA_RIGHT_TEST_RENAMED"); execute("ALTER SCHEMA SCHEMA_RIGHT_TEST_EXISTS RENAME TO SCHEMA_RIGHT_TEST_RENAMED");
assertThrows(ErrorCode.ADMIN_RIGHTS_REQUIRED, stat). assertThrows(ErrorCode.ADMIN_RIGHTS_REQUIRED, stat).
execute("DROP SCHEMA SCHEMA_RIGHT_TEST_EXISTS"); execute("DROP SCHEMA SCHEMA_RIGHT_TEST_EXISTS");
conn.close(); conn.close();
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论