public int getRoleCount() throws IOException{ Connection con=null; PreparedStatement ps = null; ResultSet rs = null; int count; try { con = getConnection(); ps = getDMLStatement("roles.count",con); rs = ps.executeQuery(); rs.next(); count=rs.getInt(1); } catch (SQLException ex) { throw new IOException(ex); } finally { closeFinally(con, ps, rs); } return count; }
/** * @see org.geoserver.security.GeoServerRoleService#getParentMappings() */ public Map<String,String> getParentMappings() throws IOException { Connection con=null; PreparedStatement ps = null; ResultSet rs = null; Map<String,String> map = new HashMap<String,String>(); try { con = getConnection(); ps = getDMLStatement("roles.all",con); rs = ps.executeQuery(); while (rs.next()) { String rolename = rs.getString(1); String parentname = rs.getString(2); map.put(rolename, parentname); } } catch (SQLException ex) { throw new IOException(ex); } finally { closeFinally(con, ps, rs); } return Collections.unmodifiableMap(map); }
/** * @see org.geoserver.security.GeoServerRoleService#getGroupNamesForRole(org.geoserver.security.impl.GeoServerRole) */ public SortedSet<String> getGroupNamesForRole(GeoServerRole role) throws IOException { Connection con=null; PreparedStatement ps = null; ResultSet rs = null; SortedSet<String> result = new TreeSet<String>(); try { con = getConnection(); ps = getDMLStatement("grouproles.groupsForRole",con); ps.setString(1, role.getAuthority()); rs = ps.executeQuery(); while (rs.next()) { String groupname = rs.getString(1); result.add(groupname); } } catch (SQLException ex) { throw new IOException(ex); } finally { closeFinally(con, ps, rs); } return Collections.unmodifiableSortedSet(result); }
/** * @see org.geoserver.security.GeoServerRoleService#getUserNamesForRole(org.geoserver.security.impl.GeoServerRole) */ public SortedSet<String> getUserNamesForRole(GeoServerRole role) throws IOException{ Connection con=null; PreparedStatement ps = null; ResultSet rs = null; SortedSet<String> result = new TreeSet<String>(); try { con = getConnection(); ps = getDMLStatement("userroles.usersForRole",con); ps.setString(1, role.getAuthority()); rs = ps.executeQuery(); while (rs.next()) { String username = rs.getString(1); result.add(username); } } catch (SQLException ex) { throw new IOException(ex); } finally { closeFinally(con, ps, rs); } return Collections.unmodifiableSortedSet(result); }
try { con = getConnection(); ps = getDMLStatement("roles.all",con); rs = ps.executeQuery(); while (rs.next()) { rs.close(); ps = getDMLStatement("roleprops.all",con); rs = ps.executeQuery(); while (rs.next()) {
try { con = getConnection(); ps = getDMLStatement("grouproles.rolesForGroup",con); ps.close(); ps = getDMLStatement("roleprops.selectForGroup",con); ps.setString(1, groupname); rs = ps.executeQuery();
try { con = getConnection(); ps = getDMLStatement("roles.keyed",con); ps.setString(1, role); rs = ps.executeQuery(); if (rs.next()) { roleObject = createRoleObject(role); ps2 = getDMLStatement("roleprops.selectForRole",con); ps2.setString(1, role); rs2 = ps2.executeQuery();
try { con = getConnection(); ps = getDMLStatement("userroles.rolesForUser",con); ps.close(); ps = getDMLStatement("roleprops.selectForUser",con); ps.setString(1, username); rs = ps.executeQuery();
try { con = getConnection(); ps = getDMLStatement("roles.keyed",con); ps.setString(1, role.getAuthority()); rs = ps.executeQuery(); if (parent!=null) { // do we have a parent ? roleObject = createRoleObject(parent); ps2 = getDMLStatement("roleprops.selectForRole",con); ps2.setString(1, parent); rs2 = ps2.executeQuery();