Project

General

Profile

« Previous | Next » 

Revision 6744

refactor Metacat access handling to be on a per-revision basis so that it more closely aligns with the DataONE approach
http://bugzilla.ecoinformatics.org/show_bug.cgi?id=5560

View differences:

MetacatCatalog.java
90 90
   * that are publicly accessible
91 91
   */
92 92
  private final String QUERY =
93
  "SELECT docid, doctype, date_updated " +
94
  "FROM xml_documents " +
95
  "WHERE doctype like 'eml://ecoinformatics.org/eml-2%' AND " + 
96
  "  (docid IN " +
97
  "     (SELECT docid " +
98
  "      FROM xml_access " +
99
  "      WHERE( (lower(principal_name) = 'public') AND " +
100
  "             perm_type = 'allow' AND " +
101
  "             permission > 3" +
102
  "           )" +
103
  "     )" +
104
  "   AND " +
105
  "   docid NOT IN " +
106
  "     (SELECT docid " +
107
  "      FROM xml_access " +
108
  "      WHERE( (lower(principal_name) = 'public') AND " +
109
  "             perm_type = 'deny' AND " +
110
  "             perm_order ='allowFirst' AND " +
111
  "             permission > 3" +
112
  "           )" +
113
  "     )" +
114
  "  )";
93
  "SELECT xd.docid, xd.doctype, xd.date_updated " +
94
  "FROM xml_documents xd, identifier id " +
95
  "WHERE xd.doctype like 'eml://ecoinformatics.org/eml-2%' " +
96
  " AND xd.docid = id.docid " +
97
  " AND xd.rev = id.rev " +
98
  // ALLOW rule
99
  " AND id.guid IN " +
100
  "     (SELECT guid " +
101
  "     FROM xml_access " +
102
  "		AND lower(principal_name) = 'public' " +
103
  " 	AND perm_type = 'allow' " +
104
  " 	AND permission > 3" +
105
  "		) " +
106
  // DENY rules?
107
  " AND id.guid NOT IN " +
108
  "     (SELECT guid " +
109
  "     FROM xml_access " +
110
  "     WHERE lower(principal_name) = 'public' " +
111
  "		AND perm_type = 'deny' " +
112
  "		AND perm_order ='allowFirst' " +
113
  "		AND permission > 3 " +
114
  "     ) ";
115 115
  
116 116
  
117
  /*
118
   * QUERY string to determine the most recent 'date_updated' value stored
119
   * in Metacat's 'xml_documents' table.
120
   */
121
  private final String LAST_UPDATED_QUERY =
122
  "SELECT MAX(date_updated) " +
123
  "FROM xml_documents " +
124
  "WHERE doctype like 'eml://ecoinformatics.org/eml-2%' AND " + 
125
  "  (docid IN " +
126
  "     (SELECT docid " +
127
  "      FROM xml_access " +
128
  "      WHERE( (lower(principal_name) = 'public') AND " +
129
  "             perm_type = 'allow' AND " +
130
  "             permission > 3" +
131
  "           )" +
132
  "     )" +
133
  "   AND " +
134
  "   docid NOT IN " +
135
  "     (SELECT docid " +
136
  "      FROM xml_access " +
137
  "      WHERE( (lower(principal_name) = 'public') AND " +
138
  "             perm_type = 'deny' AND " +
139
  "             perm_order ='allowFirst' AND " +
140
  "             permission > 3" +
141
  "           )" +
142
  "     )" +
143
  "  )";
144
  
145
  
146 117
/* Constructors */
147 118
  
148 119
  public MetacatCatalog(Properties properties) {

Also available in: Unified diff