@Test public void testReadAllSystemPrivileges() throws SQLException { String user = "user1"; if (userReader.userExist(user)) { SQLUtil.executeUpdateStatement(conn, "drop user \"" + user + "\" cascade"); } SQLUtil.executeUpdateStatement(conn, "create user \"" + user + "\" identified by password"); SQLUtil.executeUpdateStatement(conn, "grant create session to \"" + user + "\""); SQLUtil.executeUpdateStatement(conn, "grant alter session to \"" + user + "\""); SQLUtil.executeUpdateStatement(conn, "grant debug connect session to \"" + user + "\""); final List<String> privileges = privReader.readSystemPrivileges(user); assertThat(privileges).contains("CREATE SESSION", "ALTER SESSION", "DEBUG CONNECT SESSION"); SQLUtil.executeUpdateStatement(conn, "drop user \"" + user + "\""); }
List<String> readSystemPrivileges(String userName) { List<String> privileges = new ArrayList<String>(); try { final SQLParam userNameParam = new SQLParam("Grantee", userName); List<Object[]> selectRows = SQLUtil.selectRows(conn, "select PRIVILEGE from DBA_SYS_PRIVS where Grantee = ?", userNameParam); for (Object[] row : selectRows) { privileges.add((String) row[0]); } return privileges; } catch (SQLException e) { throw ConnectorException.wrap(e); } }
OracleRolePrivReader { List<String> readSystemPrivileges(String userName) { List<String> privileges = new ArrayList<String>(); try { final SQLParam userNameParam = new SQLParam("Grantee", userName); List<Object[]> selectRows = SQLUtil.selectRows(conn, "select PRIVILEGE from DBA_SYS_PRIVS where Grantee = ?", userNameParam); for (Object[] row : selectRows) { privileges.add((String) row[0]); } return privileges; } catch (SQLException e) { throw ConnectorException.wrap(e); } } }
OracleRolePrivReader { List<String> readSystemPrivileges(String userName) { List<String> privileges = new ArrayList<String>(); try { final SQLParam userNameParam = new SQLParam("Grantee", userName); List<Object[]> selectRows = SQLUtil.selectRows(conn, "select PRIVILEGE from DBA_SYS_PRIVS where Grantee = ?", userNameParam); for (Object[] row : selectRows) { privileges.add((String) row[0]); } return privileges; } catch (SQLException e) { throw ConnectorException.wrap(e); } } OracleRolePrivReader(Connection conn); }
OracleRolePrivReader { List<String> readSystemPrivileges(String userName) { List<String> privileges = new ArrayList<String>(); try { final SQLParam userNameParam = new SQLParam("Grantee", userName); List<Object[]> selectRows = SQLUtil.selectRows(conn, "select PRIVILEGE from DBA_SYS_PRIVS where Grantee = ?", userNameParam); for (Object[] row : selectRows) { privileges.add((String) row[0]); } return privileges; } catch (SQLException e) { throw ConnectorException.wrap(e); } } OracleRolePrivReader(Connection conn);  }
OracleRolePrivReader { List<String> readSystemPrivileges(String userName) { List<String> privileges = new ArrayList<String>(); try { final SQLParam userNameParam = new SQLParam("Grantee", userName); List<Object[]> selectRows = SQLUtil.selectRows(conn, "select PRIVILEGE from DBA_SYS_PRIVS where Grantee = ?", userNameParam); for (Object[] row : selectRows) { privileges.add((String) row[0]); } return privileges; } catch (SQLException e) { throw ConnectorException.wrap(e); } } OracleRolePrivReader(Connection conn);   }