@opuscapita/bouncer
Advanced tools
Comparing version 1.2.3 to 1.2.4
24
index.js
@@ -82,3 +82,3 @@ const extend = require('extend'); | ||
* publishing the permissions loaded by the current Bouncer instance. | ||
* @param {object} config - Additional configuration options. | ||
* @param {Object} config - Additional configuration options. | ||
* @param {number} config.retryTimeout - Timeout in milliseconds for each retry. | ||
@@ -88,2 +88,3 @@ * @param {number} config.retryCount - Number of maximum retries. | ||
*/ | ||
// @ts-ignore: TS(2739) "{} is missing the following properties from type '{retryCount: number, retryTimeout: number}': retryCount, retryTimeout" | ||
async registerPermissions({ retryTimeout = 1000, retryCount = 30 } = { }) | ||
@@ -131,3 +132,3 @@ { | ||
* @param {object} serviceClient - Optional [ServiceClient]{@link https://github.com/OpusCapita/service-client} instance to be used to fetch permissions from the ACL service. | ||
* @param {string} serviceName - Optional service name to use. If not set, the name of the service this module is running in is used. | ||
* @param {?string} serviceName - Optional service name to use. If not set, the name of the service this module is running in is used. | ||
* @returns {Promise} A JavaScript Promise object containing a list of matching resources or null. | ||
@@ -139,7 +140,6 @@ */ | ||
if(!serviceName) | ||
serviceName = this.config.serviceName; | ||
const _serviceName = serviceName || this.config.serviceName; | ||
const userId = userData && userData.id; | ||
const cacheKey = `${serviceName}${url}:${method}:${userId}`; | ||
const cacheKey = `${_serviceName}${url}:${method}:${userId}`; | ||
@@ -152,3 +152,3 @@ let foundResources = await this.cache.get(cacheKey); | ||
const prefixLength = serviceName.length + 1; | ||
const prefixLength = _serviceName.length + 1; | ||
const action = actionsMap[method.toUpperCase()]; | ||
@@ -160,4 +160,4 @@ | ||
const [ permissions, resourceGroups ] = await Promise.all([ | ||
this.getPermissions(roles, serviceClient, serviceName), | ||
this.getResourceGroups(serviceClient, serviceName) | ||
this.getPermissions(roles, serviceClient, _serviceName), | ||
this.getResourceGroups(serviceClient, _serviceName) | ||
]); | ||
@@ -238,3 +238,3 @@ | ||
* @param {string} method - HTTP method used to access the URL. | ||
* @param {string} serviceName - Optional service name to use. If not set, the name of the service this module is running in is used. | ||
* @param {?string} serviceName - Optional service name to use. If not set, the name of the service this module is running in is used. | ||
* @returns {Promise} A JavaScript Promise object. It can contain either an empty array, an array with a single wildcard entry or a list of business partners identifiers. | ||
@@ -491,3 +491,3 @@ */ | ||
* @param {string} method - HTTP method used to access the URL. | ||
* @param {string} serviceName - Optional service name to use. If not set, the name of the service this module is running in is used. | ||
* @param {?string} serviceName - Optional service name to use. If not set, the name of the service this module is running in is used. | ||
* @returns {Promise} A JavaScript Promise object. It can contain either an empty array, an array with a single wildcard entry or a list of tenants. | ||
@@ -776,3 +776,5 @@ * @deprecated since v1.1.11 (2019-09-04) - use getUserBusinessPartnerIdsByUrl instead | ||
* @property {object} roles.alwaysDeny - Defines an array of blacklisted roles. Takes strings and Regexp objects. | ||
* @property {array} publicPaths - List of paths (RegExp strings) to be recognized as public. Therefor no security checking is done on these endpoints. | ||
* @property {array} publicPaths - List of paths (RegExp strings) to be recognized as public. | ||
* Therefore no security checking is done on these endpoints. | ||
* We must support regexp as router path (ex. '/api/x/:id') is not known yet and URL often include values (ex. '/api/x/123'). | ||
*/ | ||
@@ -779,0 +781,0 @@ Bouncer.DefaultConfig = { |
{ | ||
"name": "@opuscapita/bouncer", | ||
"version": "1.2.3", | ||
"version": "1.2.4", | ||
"description": "API and express middleware for OpusCapita ACl service based access security.", | ||
@@ -30,3 +30,3 @@ "main": "index.js", | ||
"@opuscapita/event-client": "^2.1.1", | ||
"@opuscapita/logger": "^1.9.0", | ||
"@opuscapita/logger": "^1.9.4", | ||
"@opuscapita/service-client": "^1.4.0", | ||
@@ -38,2 +38,3 @@ "extend": "^3.0.2" | ||
"@opuscapita/web-init": "^3.0.101", | ||
"@types/node": "^17.0.23", | ||
"eslint": "^8.12.0", | ||
@@ -40,0 +41,0 @@ "mocha": "^5.2.0", |
47841
674
7
Updated@opuscapita/logger@^1.9.4