@Test public void testReadSchemaAuthorities() throws SQLException { testee.readSchemaAuthorities(testUser); }
Collection<DB2Authority> readSchemaAuthorities(String user) throws SQLException { String accountIDUC = user.toUpperCase(); String sql = "SELECT * FROM SYSIBM.SYSSCHEMAAUTH WHERE GRANTEE = '" + accountIDUC + "' AND GRANTEETYPE = 'U'"; Collection<DB2Authority> grants = new ArrayList<DB2Authority>(); ResultSet rs = executeQuery(sql); while (rs.next()) { if (rs.getString("CREATEINAUTH").equals("Y") || rs.getString("CREATEINAUTH").equals("G")) { grants.add(new DB2Authority(AUTH_TYPE_SCHEMA, "CREATEIN", rs .getString("SCHEMANAME"), accountIDUC)); } if (rs.getString("ALTERINAUTH").equals("Y") || rs.getString("ALTERINAUTH").equals("G")) { grants.add(new DB2Authority(AUTH_TYPE_SCHEMA, "ALTERIN", rs.getString("SCHEMANAME"), accountIDUC)); } if (rs.getString("DROPINAUTH").equals("Y") || rs.getString("DROPINAUTH").equals("G")) { grants.add(new DB2Authority(AUTH_TYPE_SCHEMA, "DROPIN", rs.getString("SCHEMANAME"), accountIDUC)); } } return grants; }
DB2AuthorityReader { Collection<DB2Authority> readSchemaAuthorities(String user) throws SQLException { String accountIDUC = user.toUpperCase(); String sql = "SELECT * FROM SYSIBM.SYSSCHEMAAUTH WHERE GRANTEE = '" + accountIDUC + "' AND GRANTEETYPE = 'U'"; Collection<DB2Authority> grants = new ArrayList<DB2Authority>(); ResultSet rs = executeQuery(sql); while (rs.next()) { if (rs.getString("CREATEINAUTH").equals("Y") || rs.getString("CREATEINAUTH").equals("G")) { grants.add(new DB2Authority(AUTH_TYPE_SCHEMA, "CREATEIN", rs .getString("SCHEMANAME"), accountIDUC)); } if (rs.getString("ALTERINAUTH").equals("Y") || rs.getString("ALTERINAUTH").equals("G")) { grants.add(new DB2Authority(AUTH_TYPE_SCHEMA, "ALTERIN", rs.getString("SCHEMANAME"), accountIDUC)); } if (rs.getString("DROPINAUTH").equals("Y") || rs.getString("DROPINAUTH").equals("G")) { grants.add(new DB2Authority(AUTH_TYPE_SCHEMA, "DROPIN", rs.getString("SCHEMANAME"), accountIDUC)); } } return grants; } }
DB2AuthorityReader { Collection<DB2Authority> readSchemaAuthorities(String user) throws SQLException { String accountIDUC = user.toUpperCase(); String sql = "SELECT * FROM SYSIBM.SYSSCHEMAAUTH WHERE GRANTEE = '" + accountIDUC + "' AND GRANTEETYPE = 'U'"; Collection<DB2Authority> grants = new ArrayList<DB2Authority>(); ResultSet rs = executeQuery(sql); while (rs.next()) { if (rs.getString("CREATEINAUTH").equals("Y") || rs.getString("CREATEINAUTH").equals("G")) { grants.add(new DB2Authority(AUTH_TYPE_SCHEMA, "CREATEIN", rs .getString("SCHEMANAME"), accountIDUC)); } if (rs.getString("ALTERINAUTH").equals("Y") || rs.getString("ALTERINAUTH").equals("G")) { grants.add(new DB2Authority(AUTH_TYPE_SCHEMA, "ALTERIN", rs.getString("SCHEMANAME"), accountIDUC)); } if (rs.getString("DROPINAUTH").equals("Y") || rs.getString("DROPINAUTH").equals("G")) { grants.add(new DB2Authority(AUTH_TYPE_SCHEMA, "DROPIN", rs.getString("SCHEMANAME"), accountIDUC)); } } return grants; } DB2AuthorityReader(Connection adminConn); }
DB2AuthorityReader { Collection<DB2Authority> readSchemaAuthorities(String user) throws SQLException { String accountIDUC = user.toUpperCase(); String sql = "SELECT * FROM SYSIBM.SYSSCHEMAAUTH WHERE GRANTEE = '" + accountIDUC + "' AND GRANTEETYPE = 'U'"; Collection<DB2Authority> grants = new ArrayList<DB2Authority>(); ResultSet rs = executeQuery(sql); while (rs.next()) { if (rs.getString("CREATEINAUTH").equals("Y") || rs.getString("CREATEINAUTH").equals("G")) { grants.add(new DB2Authority(AUTH_TYPE_SCHEMA, "CREATEIN", rs .getString("SCHEMANAME"), accountIDUC)); } if (rs.getString("ALTERINAUTH").equals("Y") || rs.getString("ALTERINAUTH").equals("G")) { grants.add(new DB2Authority(AUTH_TYPE_SCHEMA, "ALTERIN", rs.getString("SCHEMANAME"), accountIDUC)); } if (rs.getString("DROPINAUTH").equals("Y") || rs.getString("DROPINAUTH").equals("G")) { grants.add(new DB2Authority(AUTH_TYPE_SCHEMA, "DROPIN", rs.getString("SCHEMANAME"), accountIDUC)); } } return grants; } DB2AuthorityReader(Connection adminConn);  }
DB2AuthorityReader { Collection<DB2Authority> readSchemaAuthorities(String user) throws SQLException { String accountIDUC = user.toUpperCase(); String sql = "SELECT * FROM SYSIBM.SYSSCHEMAAUTH WHERE GRANTEE = '" + accountIDUC + "' AND GRANTEETYPE = 'U'"; Collection<DB2Authority> grants = new ArrayList<DB2Authority>(); ResultSet rs = executeQuery(sql); while (rs.next()) { if (rs.getString("CREATEINAUTH").equals("Y") || rs.getString("CREATEINAUTH").equals("G")) { grants.add(new DB2Authority(AUTH_TYPE_SCHEMA, "CREATEIN", rs .getString("SCHEMANAME"), accountIDUC)); } if (rs.getString("ALTERINAUTH").equals("Y") || rs.getString("ALTERINAUTH").equals("G")) { grants.add(new DB2Authority(AUTH_TYPE_SCHEMA, "ALTERIN", rs.getString("SCHEMANAME"), accountIDUC)); } if (rs.getString("DROPINAUTH").equals("Y") || rs.getString("DROPINAUTH").equals("G")) { grants.add(new DB2Authority(AUTH_TYPE_SCHEMA, "DROPIN", rs.getString("SCHEMANAME"), accountIDUC)); } } return grants; } DB2AuthorityReader(Connection adminConn);   }