From 94c786f2f76de7a3b4003e1aa8bff194a37bc1ff Mon Sep 17 00:00:00 2001 From: ebarault Date: Wed, 23 Nov 2016 23:37:56 +0100 Subject: [PATCH] Fix connector naming in strict mode In strict mode, creating properties on strings is not allowed. As a result, creating a new datasource fails with the following error: TypeError: Cannot create data source "db": Cannot create property 'name' on string 'mongodb' In this commit, we fix the code to assign the connector name only if the connector is an object (not a string). Add "returnOnlyRoleNames" option to Role.getRoles Currently the return type of Role.getRoles() method is inconsistent: role names are returned for smart roles and role ids are returned for static roles (configured through user-role mapping). This commit adds a new option to Role.getRoles() allowing the caller to request role names to be returned for all types of roles. --- lib/application.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/application.js b/lib/application.js index 58b76cefe..92bf72007 100644 --- a/lib/application.js +++ b/lib/application.js @@ -423,7 +423,7 @@ function dataSourcesFromConfig(name, config, connectorRegistry, registry) { config.connector = require(connectorPath); } } - if (!config.connector.name) + if (config.connector && typeof config.connector === 'object' && !config.connector.name) config.connector.name = name; }