Revision 7648
Added by Jing Tao about 11 years ago
MNodeService.java | ||
---|---|---|
1458 | 1458 |
public InputStream query(String engine, String query) throws InvalidToken, |
1459 | 1459 |
ServiceFailure, NotAuthorized, InvalidRequest, NotImplemented, |
1460 | 1460 |
NotFound { |
1461 |
String user = Constants.SUBJECT_PUBLIC; |
|
1462 |
String[] groups= null; |
|
1463 |
if (session != null) { |
|
1464 |
user = session.getSubject().getValue(); |
|
1465 |
Set<Subject> subjects = AuthUtils.authorizedClientSubjects(session); |
|
1466 |
if (subjects != null) { |
|
1467 |
List<String> groupList = new ArrayList<String>(); |
|
1468 |
for (Subject subject: subjects) { |
|
1469 |
groupList.add(subject.getValue()); |
|
1470 |
} |
|
1471 |
groups = groupList.toArray(new String[0]); |
|
1472 |
} |
|
1473 |
} |
|
1461 | 1474 |
if (engine != null && engine.equals(PATHQUERY)) { |
1462 | 1475 |
try { |
1463 | 1476 |
DBQuery queryobj = new DBQuery(); |
1464 |
String user = Constants.SUBJECT_PUBLIC; |
|
1465 |
String[] groups= null; |
|
1466 |
if (session != null) { |
|
1467 |
user = session.getSubject().getValue(); |
|
1468 |
Set<Subject> subjects = AuthUtils.authorizedClientSubjects(session); |
|
1469 |
if (subjects != null) { |
|
1470 |
List<String> groupList = new ArrayList<String>(); |
|
1471 |
for (Subject subject: subjects) { |
|
1472 |
groupList.add(subject.getValue()); |
|
1473 |
} |
|
1474 |
groups = groupList.toArray(new String[0]); |
|
1475 |
} |
|
1476 |
} |
|
1477 |
|
|
1477 | 1478 |
String results = queryobj.performPathquery(query, user, groups); |
1478 | 1479 |
return new ByteArrayInputStream(results.getBytes(MetaCatServlet.DEFAULT_ENCODING)); |
1479 | 1480 |
|
... | ... | |
1485 | 1486 |
logMetacat.info("The query is ==================================== \n"+query); |
1486 | 1487 |
try { |
1487 | 1488 |
|
1488 |
return MetacatSolrIndex.getInstance().query(query); |
|
1489 |
return MetacatSolrIndex.getInstance().query(query, user, groups);
|
|
1489 | 1490 |
} catch (Exception e) { |
1490 | 1491 |
// TODO Auto-generated catch block |
1491 | 1492 |
throw new ServiceFailure("Solr server error", e.getMessage()); |
Also available in: Unified diff
Add the access query filter.