clean up
This commit is contained in:
parent
9e8164d73a
commit
712a6a798f
|
@ -2,7 +2,7 @@
|
||||||
type: add
|
type: add
|
||||||
issue: 3018
|
issue: 3018
|
||||||
jira: SMILE-782
|
jira: SMILE-782
|
||||||
title: "Previously, when a search query explicitly included a search parameter that was for the same resource type but a
|
title: "Previously, when a search query explicitly includes a search parameter that is for the same resource type but a
|
||||||
different resource instance from the one specified in the token, the search narrowing interceptor would include both search
|
different resource instance from the one(s) specified on the authorized list, the search narrowing interceptor would include
|
||||||
parameters in the final query, resulting in an empty bundle being returned to the caller. Now, such a call will result in
|
both search parameters in the final query, resulting in an empty bundle being returned to the caller. Now, such a call
|
||||||
a 403 Forbidden error, making it more clear why no resources were returned."
|
will result in a 403 Forbidden error, making it more clear why no resources were returned."
|
||||||
|
|
|
@ -285,21 +285,20 @@ public class SearchNarrowingInterceptor {
|
||||||
searchParamName = primarySearchParamName;
|
searchParamName = primarySearchParamName;
|
||||||
} else {
|
} else {
|
||||||
// If the primary search parameter itself isn't in use, check to see whether any of its synonyms are.
|
// If the primary search parameter itself isn't in use, check to see whether any of its synonyms are.
|
||||||
List<RuntimeSearchParam> synonyms = findSynonyms(searchParams, primarySearchParam.get());
|
Optional<RuntimeSearchParam> synonymInUse = findSynonyms(searchParams, primarySearchParam.get())
|
||||||
Optional<RuntimeSearchParam> synonymInUse = synonyms
|
|
||||||
.stream()
|
.stream()
|
||||||
.filter(t -> queryParameters.contains(t.getName()))
|
.filter(t -> queryParameters.contains(t.getName()))
|
||||||
.findFirst();
|
.findFirst();
|
||||||
if (synonymInUse.isPresent()) {
|
if (synonymInUse.isPresent()) {
|
||||||
// if so, use one of those
|
// if a synonym is in use, use it
|
||||||
searchParamName = synonymInUse.get().getName();
|
searchParamName = synonymInUse.get().getName();
|
||||||
} else {
|
} else {
|
||||||
// if not, i.e., the original query is not filtering on this field at all, use the primary
|
// if not, i.e., the original query is not filtering on this field at all, use the primary search param
|
||||||
searchParamName = primarySearchParamName;
|
searchParamName = primarySearchParamName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Otherwise, fall back to whatever is available
|
// Otherwise, fall back to whatever search parameter is available
|
||||||
searchParamName = searchParams.get(0).getName();
|
searchParamName = searchParams.get(0).getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue