Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions src/server/auth/authHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,22 @@ export class AuthHelper {
async initialize() {
try {
this._accessibleResourceList = await getAccessibleResourcesFromArboristasync(this._jwt);
log.debug('[AuthHelper] accessible resources:', this._accessibleResourceList);

const promiseList = [];
config.esConfig.indices.forEach(({ index, type }) => {
const subListPromise = this.getOutOfScopeResourceList(index, type);
promiseList.push(subListPromise);
});
this._unaccessibleResourceList = [];
const listResult = await Promise.all(promiseList);

this._unaccessibleResourceList = [];
listResult.forEach((list) => {
this._unaccessibleResourceList = _.union(this._unaccessibleResourceList, list);
});
log.debug('[AuthHelper] accessible resources: ', this._accessibleResourceList);
log.debug('[AuthHelper] unaccessible resources: ', this._unaccessibleResourceList);
log.debug('[AuthHelper] unaccessible resources:', this._unaccessibleResourceList);
} catch (err) {
log.error('[AuthHelper] error when initializing', err);
log.error('[AuthHelper] error when initializing:', err);
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/server/es/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class ES {
[`*${config.analyzedTextFieldSuffix}`]: {},
},
};
log.info('[ES.query] query body: ', JSON.stringify(validatedQueryBody));
log.info('[ES.query] index, type, query body: ', esIndex, esType, JSON.stringify(validatedQueryBody));
return this.client.search({
index: esIndex,
type: esType,
Expand Down Expand Up @@ -422,7 +422,7 @@ class ES {
esIndex, esType, fields, filter, sort, offset, size,
}) {
if (typeof size !== 'undefined' && offset + size > SCROLL_PAGE_SIZE) {
throw new UserInputError(`Large graphql query forbidden for offset + size > ${SCROLL_PAGE_SIZE},
throw new UserInputError(`Large graphql query forbidden for offset + size > ${SCROLL_PAGE_SIZE},
offset = ${offset} and size = ${size},
please use download endpoint for large data queries instead.`);
}
Expand Down