Project

General

Profile

« Previous | Next » 

Revision 3248

Added by Jing Tao over 17 years ago

Remove the access query for return field since we remove the partial tree access control in eml.

View differences:

src/edu/ucsb/nceas/metacat/QuerySpecification.java
887 887
     * This sql command will selecet startnodeid and endnodeid that user can
888 888
     * NOT access
889 889
     */
890
    public String printAccessControlSQLForReturnField(String doclist)
890
    /*public String printAccessControlSQLForReturnField(String doclist)
891 891
    {
892 892
        StringBuffer sql = new StringBuffer();
893 893
        String allowString = constructAllowString();
......
922 922
        logMetacat.info("accessControlSQLForReturnField: "
923 923
                + sql.toString());
924 924
        return sql.toString();
925
    }
925
    }*/
926 926

  
927 927
    /**
928 928
     * This method prints sql based upon the <returnfield> tag in the
......
937 937
     * @param useXMLIndex a boolean flag indicating whether to search using
938 938
     *            xml_index
939 939
     */
940
    public String printExtendedSQL(String doclist,
941
            Hashtable unaccessableNodePair, boolean useXMLIndex)
940
    public String printExtendedSQL(String doclist, boolean useXMLIndex)
942 941
    {
943 942
        if (useXMLIndex && !containsPredicates)
944 943
        {
945
            return printExtendedSQL(doclist, unaccessableNodePair);
944
            return printExtendedSQL(doclist);
946 945
        }
947 946
        else
948 947
        {
......
974 973
                self.append(") AND xml_nodes.nodetype = 'TEXT'");
975 974
                self.append(" AND xml_nodes.rootnodeid = xml_documents.rootnodeid");
976 975

  
977
                addAccessRestrictionSQL(unaccessableNodePair, self);
976
                //addAccessRestrictionSQL(unaccessableNodePair, self);
978 977
            }
979 978

  
980 979
            return self.toString();
......
991 990
     * @param unaccessableNodePair the node pairs (start id and end id)
992 991
     *            which this user should not access
993 992
     */
994
    public String printExtendedSQL(String doclist,
995
            Hashtable unaccessableNodePair)
993
    public String printExtendedSQL(String doclist)
996 994
    {
997 995
        logMetacat.info("querySpecification.printExtendedSQL called\n");
998 996
        StringBuffer self = new StringBuffer();
......
1061 1059

  
1062 1060
        }
1063 1061

  
1064
        addAccessRestrictionSQL(unaccessableNodePair, self);
1062
        //addAccessRestrictionSQL(unaccessableNodePair, self);
1065 1063

  
1066 1064
        return self.toString();
1067 1065
    }
......
1125 1123
     * @param unaccessableNodePair hash of start/end nodeid pairs to restrict
1126 1124
     * @param self a stringbuffer to which the genrated SQL is appended
1127 1125
     */
1128
    private void addAccessRestrictionSQL(Hashtable unaccessableNodePair,
1126
    /*private void addAccessRestrictionSQL(Hashtable unaccessableNodePair,
1129 1127
            StringBuffer self)
1130 1128
    {
1131 1129
        // add control part for extended query
......
1146 1144
            self.append(endNodeId);
1147 1145
            self.append(")");
1148 1146
        }
1149
    }
1147
    }*/
1150 1148

  
1151 1149
    /**
1152 1150
     * This method prints sql that finds the values of attributes in the xml
src/edu/ucsb/nceas/metacat/DBQuery.java
1074 1074
          Hashtable controlPairs = new Hashtable();
1075 1075
          double extendedQueryStart = System.currentTimeMillis() / 1000;
1076 1076
          doclist.deleteCharAt(doclist.length() - 1); //remove the last comma
1077
          boolean tableHasRows = false;
1077 1078
          // check if user has permission to see the return field data
1078
          String accessControlSQL =
1079
          /*String accessControlSQL =
1079 1080
                 qspec.printAccessControlSQLForReturnField(doclist.toString());
1080 1081
          pstmt = dbconn.prepareStatement(accessControlSQL);
1081 1082
          //increase dbconnection usage count
1082 1083
          dbconn.increaseUsageCount(1);
1083 1084
          pstmt.execute();
1084 1085
          rs = pstmt.getResultSet();
1085
          boolean tableHasRows = rs.next();
1086
          tableHasRows = rs.next();
1086 1087
          while (tableHasRows)
1087 1088
          {
1088 1089
            long startNodeId = rs.getLong(1);
1089 1090
            long endNodeId = rs.getLong(2);
1090 1091
            controlPairs.put(new Long(startNodeId), new Long(endNodeId));
1091 1092
            tableHasRows = rs.next();
1092
          }
1093
          }*/
1093 1094

  
1094 1095
           double extendedAccessQueryEnd = System.currentTimeMillis() / 1000;
1095 1096
           logMetacat.info( "Time for execute access extended query: "
1096 1097
                          + (extendedAccessQueryEnd - extendedQueryStart));
1097 1098

  
1098 1099
           String extendedQuery =
1099
               qspec.printExtendedSQL(doclist.toString(), controlPairs, useXMLIndex);
1100
               qspec.printExtendedSQL(doclist.toString(), useXMLIndex);
1100 1101
           logMetacat.info("Extended query: " + extendedQuery);
1101 1102

  
1102 1103
           if(extendedQuery != null){

Also available in: Unified diff