Revision 7669
Added by Jing Tao over 11 years ago
src/edu/ucsb/nceas/metacat/index/MetacatSolrIndex.java | ||
---|---|---|
74 | 74 |
import org.dataone.configuration.Settings; |
75 | 75 |
import org.dataone.service.types.v1_1.QueryEngineDescription; |
76 | 76 |
import org.dataone.service.types.v1_1.QueryField; |
77 |
import org.dataone.service.util.Constants; |
|
77 | 78 |
import org.xml.sax.InputSource; |
78 | 79 |
import org.xml.sax.SAXException; |
79 | 80 |
|
... | ... | |
111 | 112 |
private static final String SOLRSCHEMAFILEPATH = SOLRCONFDIR+"/schema.xml"; |
112 | 113 |
private static final String FILTERQUERY = "fq"; |
113 | 114 |
private static final String READPERMISSION = "readPermission"; |
115 |
private static final String RIGHTSHOLDER = "rightsHolder"; |
|
114 | 116 |
private static final String OPENPARENTHESE = "("; |
115 | 117 |
private static final String CLOSEPARENTHESE = ")"; |
116 | 118 |
private static final String COLON = ":"; |
... | ... | |
290 | 292 |
StringBuffer query = new StringBuffer(); |
291 | 293 |
if (user != null && groups != null) { |
292 | 294 |
query.append(OPENPARENTHESE+READPERMISSION+COLON+"\""+user+"\""+CLOSEPARENTHESE); |
295 |
if(!user.equals(Constants.SUBJECT_PUBLIC)) { |
|
296 |
query.append(OR+OPENPARENTHESE+RIGHTSHOLDER+COLON+"\""+user+"\""+CLOSEPARENTHESE); |
|
297 |
} |
|
293 | 298 |
for(int i=0; i<groups.length; i++) { |
294 |
query.append(OR + OPENPARENTHESE+READPERMISSION+COLON+"\""+groups[i]+"\""+CLOSEPARENTHESE); |
|
299 |
if(groups[i] != null) { |
|
300 |
query.append(OR + OPENPARENTHESE+READPERMISSION+COLON+"\""+groups[i]+"\""+CLOSEPARENTHESE); |
|
301 |
if(!groups[i].equals(Constants.SUBJECT_PUBLIC)) { |
|
302 |
query.append(OR + OPENPARENTHESE+RIGHTSHOLDER+COLON+"\""+groups[i]+"\""+CLOSEPARENTHESE); |
|
303 |
} |
|
304 |
} |
|
295 | 305 |
} |
296 | 306 |
} else if (user != null && groups == null) { |
297 |
query.append(OPENPARENTHESE+READPERMISSION+COLON+"\""+user+"\""+CLOSEPARENTHESE); |
|
307 |
query.append(OPENPARENTHESE+READPERMISSION+COLON+"\""+user+"\""+CLOSEPARENTHESE); |
|
308 |
if(!user.equals(Constants.SUBJECT_PUBLIC)) { |
|
309 |
query.append(OR+OPENPARENTHESE+RIGHTSHOLDER+COLON+"\""+user+"\""+CLOSEPARENTHESE); |
|
310 |
} |
|
298 | 311 |
} else if ( user == null && groups != null) { |
299 | 312 |
for (int i=0; i<groups.length; i++) { |
300 |
if(i==0) { |
|
301 |
query.append(OPENPARENTHESE+READPERMISSION+COLON+"\""+groups[i]+"\""+CLOSEPARENTHESE); |
|
302 |
} else { |
|
303 |
query.append(OR + OPENPARENTHESE+READPERMISSION+COLON+"\""+groups[i]+"\""+CLOSEPARENTHESE); |
|
313 |
if(groups[i]!= null) { |
|
314 |
if(i==0) { |
|
315 |
query.append(OPENPARENTHESE+READPERMISSION+COLON+"\""+groups[i]+"\""+CLOSEPARENTHESE); |
|
316 |
if(!groups[i].equals(Constants.SUBJECT_PUBLIC)) { |
|
317 |
query.append(OR + OPENPARENTHESE+RIGHTSHOLDER+COLON+"\""+groups[i]+"\""+CLOSEPARENTHESE); |
|
318 |
} |
|
319 |
} else { |
|
320 |
query.append(OR + OPENPARENTHESE+READPERMISSION+COLON+"\""+groups[i]+"\""+CLOSEPARENTHESE); |
|
321 |
if(!groups[i].equals(Constants.SUBJECT_PUBLIC)) { |
|
322 |
query.append(OR + OPENPARENTHESE+RIGHTSHOLDER+COLON+"\""+groups[i]+"\""+CLOSEPARENTHESE); |
|
323 |
} |
|
324 |
} |
|
304 | 325 |
} |
326 |
|
|
305 | 327 |
} |
306 | 328 |
} |
307 | 329 |
return query; |
Also available in: Unified diff
Add the rightsHolder in the access filter.