@Test public void testReadPackageAuthorities() throws SQLException { testee.readPackageAuthorities(testUser); }
Collection<DB2Authority> readPackageAuthorities(String user) throws SQLException { String accountIDUC = user.toUpperCase(); String sql = "SELECT * FROM SYSIBM.SYSPLANAUTH WHERE GRANTEE = '" + accountIDUC + "' AND GRANTEETYPE = 'U'"; Collection<DB2Authority> grants = new ArrayList<DB2Authority>(); ResultSet rs = executeQuery(sql); while (rs.next()) { String creator = rs.getString("CREATOR").trim(); String packageName = creator + "." + rs.getString("NAME"); if (rs.getString("CONTROLAUTH").equals("Y")) { grants.add(new DB2Authority(AUTH_TYPE_PACKAGE, "CONTROL", packageName, accountIDUC)); } if (rs.getString("BINDAUTH").equals("Y")) { grants.add(new DB2Authority(AUTH_TYPE_PACKAGE, "BIND", packageName, accountIDUC)); } if (rs.getString("EXECUTEAUTH").equals("Y")) { grants.add(new DB2Authority(AUTH_TYPE_PACKAGE, "EXECUTE", packageName, accountIDUC)); } } return grants; }
DB2AuthorityReader { Collection<DB2Authority> readPackageAuthorities(String user) throws SQLException { String accountIDUC = user.toUpperCase(); String sql = "SELECT * FROM SYSIBM.SYSPLANAUTH WHERE GRANTEE = '" + accountIDUC + "' AND GRANTEETYPE = 'U'"; Collection<DB2Authority> grants = new ArrayList<DB2Authority>(); ResultSet rs = executeQuery(sql); while (rs.next()) { String creator = rs.getString("CREATOR").trim(); String packageName = creator + "." + rs.getString("NAME"); if (rs.getString("CONTROLAUTH").equals("Y")) { grants.add(new DB2Authority(AUTH_TYPE_PACKAGE, "CONTROL", packageName, accountIDUC)); } if (rs.getString("BINDAUTH").equals("Y")) { grants.add(new DB2Authority(AUTH_TYPE_PACKAGE, "BIND", packageName, accountIDUC)); } if (rs.getString("EXECUTEAUTH").equals("Y")) { grants.add(new DB2Authority(AUTH_TYPE_PACKAGE, "EXECUTE", packageName, accountIDUC)); } } return grants; } }
DB2AuthorityReader { Collection<DB2Authority> readPackageAuthorities(String user) throws SQLException { String accountIDUC = user.toUpperCase(); String sql = "SELECT * FROM SYSIBM.SYSPLANAUTH WHERE GRANTEE = '" + accountIDUC + "' AND GRANTEETYPE = 'U'"; Collection<DB2Authority> grants = new ArrayList<DB2Authority>(); ResultSet rs = executeQuery(sql); while (rs.next()) { String creator = rs.getString("CREATOR").trim(); String packageName = creator + "." + rs.getString("NAME"); if (rs.getString("CONTROLAUTH").equals("Y")) { grants.add(new DB2Authority(AUTH_TYPE_PACKAGE, "CONTROL", packageName, accountIDUC)); } if (rs.getString("BINDAUTH").equals("Y")) { grants.add(new DB2Authority(AUTH_TYPE_PACKAGE, "BIND", packageName, accountIDUC)); } if (rs.getString("EXECUTEAUTH").equals("Y")) { grants.add(new DB2Authority(AUTH_TYPE_PACKAGE, "EXECUTE", packageName, accountIDUC)); } } return grants; } DB2AuthorityReader(Connection adminConn); }
DB2AuthorityReader { Collection<DB2Authority> readPackageAuthorities(String user) throws SQLException { String accountIDUC = user.toUpperCase(); String sql = "SELECT * FROM SYSIBM.SYSPLANAUTH WHERE GRANTEE = '" + accountIDUC + "' AND GRANTEETYPE = 'U'"; Collection<DB2Authority> grants = new ArrayList<DB2Authority>(); ResultSet rs = executeQuery(sql); while (rs.next()) { String creator = rs.getString("CREATOR").trim(); String packageName = creator + "." + rs.getString("NAME"); if (rs.getString("CONTROLAUTH").equals("Y")) { grants.add(new DB2Authority(AUTH_TYPE_PACKAGE, "CONTROL", packageName, accountIDUC)); } if (rs.getString("BINDAUTH").equals("Y")) { grants.add(new DB2Authority(AUTH_TYPE_PACKAGE, "BIND", packageName, accountIDUC)); } if (rs.getString("EXECUTEAUTH").equals("Y")) { grants.add(new DB2Authority(AUTH_TYPE_PACKAGE, "EXECUTE", packageName, accountIDUC)); } } return grants; } DB2AuthorityReader(Connection adminConn);  }
DB2AuthorityReader { Collection<DB2Authority> readPackageAuthorities(String user) throws SQLException { String accountIDUC = user.toUpperCase(); String sql = "SELECT * FROM SYSIBM.SYSPLANAUTH WHERE GRANTEE = '" + accountIDUC + "' AND GRANTEETYPE = 'U'"; Collection<DB2Authority> grants = new ArrayList<DB2Authority>(); ResultSet rs = executeQuery(sql); while (rs.next()) { String creator = rs.getString("CREATOR").trim(); String packageName = creator + "." + rs.getString("NAME"); if (rs.getString("CONTROLAUTH").equals("Y")) { grants.add(new DB2Authority(AUTH_TYPE_PACKAGE, "CONTROL", packageName, accountIDUC)); } if (rs.getString("BINDAUTH").equals("Y")) { grants.add(new DB2Authority(AUTH_TYPE_PACKAGE, "BIND", packageName, accountIDUC)); } if (rs.getString("EXECUTEAUTH").equals("Y")) { grants.add(new DB2Authority(AUTH_TYPE_PACKAGE, "EXECUTE", packageName, accountIDUC)); } } return grants; } DB2AuthorityReader(Connection adminConn);   }