(request, authorizationResults, apiMethod, returnTagCount, log, callback)
| 224 | |
| 225 | /* eslint-disable no-param-reassign */ |
| 226 | function handleAuthorizationResults(request, authorizationResults, apiMethod, returnTagCount, log, callback) { |
| 227 | if (authorizationResults) { |
| 228 | const checkedResults = checkAuthResults(authorizationResults, apiMethod, log); |
| 229 | if (checkedResults instanceof Error) { |
| 230 | return callback(checkedResults); |
| 231 | } |
| 232 | returnTagCount = checkedResults.returnTagCount; |
| 233 | request.actionImplicitDenies = checkedResults.isImplicitDeny; |
| 234 | } else { |
| 235 | // create an object of keys apiMethods with all values to false: |
| 236 | // for backward compatibility, all apiMethods are allowed by default |
| 237 | // thus it is explicitly allowed, so implicit deny is false |
| 238 | request.actionImplicitDenies = request.apiMethods.reduce((acc, curr) => { |
| 239 | acc[curr] = false; |
| 240 | return acc; |
| 241 | }, {}); |
| 242 | } |
| 243 | return callback(null, { returnTagCount }); |
| 244 | } |
| 245 | |
| 246 | function callApiHandler(apiMethod, apiHandler, request, response, log, callback) { |
| 247 | let returnTagCount = true; |
no test coverage detected