diff --git a/doc/queries.md b/doc/queries.md index aea28ba4..1fa90cd7 100644 --- a/doc/queries.md +++ b/doc/queries.md @@ -1015,7 +1015,7 @@ Example: ``` -## Some other queries and arguments +## Some other queries and arguments ### Mapping query Mapping query simply returns all fields under a doc type. Example: @@ -1086,7 +1086,7 @@ Result: { "errors": [ { - "message": "You don't have access to following resources: [/programs/external/projects/test]", + "message": "You don't have access to all the data you are querying. Try using 'accessibility: accessible' in your query", "locations": [ { "line": 2, @@ -1100,7 +1100,7 @@ Result: "code": 401, "exception": { "stacktrace": [ - "Error: You don't have access to following resources: [/programs/external/projects/test]", + "Error: You don't have access to all the data you are querying. Try using 'accessibility: accessible' in your query", ... } ``` diff --git a/src/components/Utils/queries.js b/src/components/Utils/queries.js index 52a1e556..ae9e1928 100644 --- a/src/components/Utils/queries.js +++ b/src/components/Utils/queries.js @@ -70,7 +70,7 @@ const nestedHistogramQueryStrForEachField = (mainField, numericAggAsText) => (` key count } - } + } } }`); @@ -167,11 +167,11 @@ const queryGuppyForRawDataAndTotalCounts = ( } const processedFields = fields.map((field) => rawDataQueryStrForEachField(field)); const query = `${queryLine} - ${dataTypeLine} + ${dataTypeLine} ${processedFields.join('\n')} } _aggregation { - ${typeAggsLine} + ${typeAggsLine} _totalCount } } @@ -333,7 +333,6 @@ export const downloadDataFromGuppy = ( }); }; - export const askGuppyForTotalCounts = ( path, type, diff --git a/src/server/download.js b/src/server/download.js index 7597ce2c..981c1ca3 100644 --- a/src/server/download.js +++ b/src/server/download.js @@ -40,7 +40,9 @@ const downloadRouter = async (req, res, next) => { ); // if requesting resources > allowed resources, return 401, if (outOfScopeResourceList.length > 0) { - throw new CodedError(401, `You don't have access to following resources: [${outOfScopeResourceList.join(', ')}]`); + log.info('[download] requesting out-of-scope resources, return 401'); + log.info(`[download] the following resources are out-of-scope: [${outOfScopeResourceList.join(', ')}]`); + throw new CodedError(401, 'You don\'t have access to all the data you are querying. Try using \'accessibility: accessible\' in your query'); } else { // else, go ahead download appliedFilter = filter; } diff --git a/src/server/middlewares/tierAccessMiddleware/index.js b/src/server/middlewares/tierAccessMiddleware/index.js index 873f5029..f13fa066 100644 --- a/src/server/middlewares/tierAccessMiddleware/index.js +++ b/src/server/middlewares/tierAccessMiddleware/index.js @@ -69,9 +69,9 @@ const tierAccessResolver = ( resolve, root, args, context, info, authHelper, filter, ); } - log.debug('[tierAccessResolver] requesting out-of-scope resources, return 401'); - throw new ApolloError(`You don't have access to following resources: \ - [${outOfScopeResourceList.join(', ')}]`, 401); + log.info('[tierAccessResolver] requesting out-of-scope resources, return 401'); + log.info(`[tierAccessResolver] the following resources are out-of-scope: [${outOfScopeResourceList.join(', ')}]`); + throw new ApolloError('You don\'t have access to all the data you are querying. Try using \'accessibility: accessible\' in your query', 401); } /**