2638,2639c2638,2639 < sql = "SELECT n.nspname,c.relname,r.rolname,a.attacl,a.attname " + < " FROM pg_catalog.pg_namespace n, pg_catalog.pg_class c, pg_catalog.pg_roles r, pg_catalog.pg_attribute a " + --- > sql = "SELECT n.nspname,c.relname,u.usename,c.relacl,a.attname " + > " FROM pg_catalog.pg_namespace n, pg_catalog.pg_class c, pg_catalog.pg_user u, pg_catalog.pg_attribute a " + 2641c2641 < " AND c.relowner = r.oid " + --- > " AND u.usesysid = c.relowner " + 2673,2674c2673,2674 < String owner = rs.getString("rolname"); < String acl = rs.getString("attacl"); --- > String owner = rs.getString("usename"); > String acl = rs.getString("relacl"); 2687,2693c2687 < Hashtable grantees = (Hashtable)permissions.get(permNames[i]); < String granteeUsers[] = new String[grantees.size()]; < Enumeration g = grantees.keys(); < int k = 0; < while (g.hasMoreElements()){ < granteeUsers[k++] = (String)g.nextElement(); < } --- > Vector grantees = (Vector)permissions.get(permNames[i]); 2696,2700c2690,2691 < Vector grantor = (Vector)grantees.get(granteeUsers[j]); < String grantee = (String)granteeUsers[j]; < for (int l = 0; l < grantor.size(); l++) { < String[] grants = (String[])grantor.elementAt(l); < String grantable = owner.equals(grantee) ? "YES" : grants[1]; --- > String grantee = (String)grantees.elementAt(j); > String grantable = owner.equals(grantee) ? "YES" : "NO"; 2706c2697 < tuple[4] = connection.encodeString(grants[0]); --- > tuple[4] = connection.encodeString(owner); 2714d2704 < } 2766,2767c2756,2757 < sql = "SELECT n.nspname,c.relname,r.rolname,c.relacl " + < " FROM pg_catalog.pg_namespace n, pg_catalog.pg_class c, pg_catalog.pg_roles r " + --- > sql = "SELECT n.nspname,c.relname,u.usename,c.relacl " + > " FROM pg_catalog.pg_namespace n, pg_catalog.pg_class c, pg_catalog.pg_user u " + 2769c2759 < " AND c.relowner = r.oid " + --- > " AND u.usesysid = c.relowner " + 2795c2785 < String owner = rs.getString("rolname"); --- > String owner = rs.getString("usename"); 2809,2822c2799,2803 < Hashtable grantees = (Hashtable)permissions.get(permNames[i]); < String granteeUsers[] = new String[grantees.size()]; < Enumeration g = grantees.keys(); < int k = 0; < while (g.hasMoreElements()){ < granteeUsers[k++] = (String)g.nextElement(); < } < for (int j = 0; j < granteeUsers.length; j++) < { < Vector grantor = (Vector)grantees.get(granteeUsers[j]); < String grantee = (String)granteeUsers[j]; < for (int l = 0; l < grantor.size(); l++) { < String[] grants = (String[])grantor.elementAt(l); < String grantable = owner.equals(grantee) ? "YES" : grants[1]; --- > Vector grantees = (Vector)permissions.get(permNames[i]); > for (int j = 0; j < grantees.size(); j++) > { > String grantee = (String)grantees.elementAt(j); > String grantable = owner.equals(grantee) ? "YES" : "NO"; 2827c2808 < tuple[3] = connection.encodeString(grants[0]); --- > tuple[3] = connection.encodeString(owner); 2832,2833d2812 < < } 2907d2885 < int slashIndex = acl.lastIndexOf("/"); 2911,2913c2889,2890 < String user = acl.substring(0, equalIndex); < String grantor = null; < if (user.length() == 0) --- > String name = acl.substring(0, equalIndex); > if (name.length() == 0) 2915,2921c2892 < user = "PUBLIC"; < } < if (slashIndex != -1) { < grantor = acl.substring(slashIndex + 1, acl.length()); < } < if (grantor == null) { < grantor = "Default"; --- > name = "PUBLIC"; 2923,2924c2894 < < String privs = acl.substring(equalIndex + 1, slashIndex); --- > String privs = acl.substring(equalIndex + 1); 2928d2897 < if (c != '*') { 2930,2935d2898 < String grantable; < if ( i < privs.length()-1 && privs.charAt(i + 1) == '*') { < grantable = "YES"; < } else { < grantable = "NO"; < } 2979,2987c2942,2945 < < Hashtable usersWithPermission = (Hashtable)privileges.get(sqlpriv); < String[] grant = {grantor, grantable}; < < if (usersWithPermission == null) { < usersWithPermission = new Hashtable(); < Vector permissionByGrantor = new Vector(); < permissionByGrantor.addElement(grant); < usersWithPermission.put(user, permissionByGrantor); --- > Vector usersWithPermission = (Vector)privileges.get(sqlpriv); > if (usersWithPermission == null) > { > usersWithPermission = new Vector(); 2989,2996d2946 < } else { < Vector permissionByGrantor = (Vector)usersWithPermission.get(user); < if (permissionByGrantor == null) { < permissionByGrantor = new Vector(); < permissionByGrantor.addElement(grant); < usersWithPermission.put(user,permissionByGrantor); < } else { < permissionByGrantor.addElement(grant); 2998,3002c2948 < < } < < } < --- > usersWithPermission.addElement(name); 3023c2969 < aclArray = "{" + owner + "=" + perms + "/" + owner + "}"; --- > aclArray = "{" + owner + "=" + perms + "}";