|
@@ -857,27 +857,13 @@ class ElasticsearchDelegator implements SearchDelegator<Data> {
|
|
|
|
|
|
|
|
const Page = mongoose.model('Page') as unknown as PageModel;
|
|
const Page = mongoose.model('Page') as unknown as PageModel;
|
|
|
const {
|
|
const {
|
|
|
- GRANT_PUBLIC, GRANT_RESTRICTED, GRANT_SPECIFIED, GRANT_OWNER, GRANT_USER_GROUP,
|
|
|
|
|
|
|
+ GRANT_PUBLIC, GRANT_SPECIFIED, GRANT_OWNER, GRANT_USER_GROUP,
|
|
|
} = Page;
|
|
} = Page;
|
|
|
|
|
|
|
|
const grantConditions: any[] = [
|
|
const grantConditions: any[] = [
|
|
|
{ term: { grant: GRANT_PUBLIC } },
|
|
{ term: { grant: GRANT_PUBLIC } },
|
|
|
];
|
|
];
|
|
|
|
|
|
|
|
- // ensure to hit to GRANT_RESTRICTED pages that the user specified at own
|
|
|
|
|
- if (user != null) {
|
|
|
|
|
- grantConditions.push(
|
|
|
|
|
- {
|
|
|
|
|
- bool: {
|
|
|
|
|
- must: [
|
|
|
|
|
- { term: { grant: GRANT_RESTRICTED } },
|
|
|
|
|
- { term: { granted_users: user._id.toString() } },
|
|
|
|
|
- ],
|
|
|
|
|
- },
|
|
|
|
|
- },
|
|
|
|
|
- );
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
if (showPagesRestrictedByOwner) {
|
|
if (showPagesRestrictedByOwner) {
|
|
|
grantConditions.push(
|
|
grantConditions.push(
|
|
|
{ term: { grant: GRANT_SPECIFIED } },
|
|
{ term: { grant: GRANT_SPECIFIED } },
|