Skip to content

Commit 94c786f

Browse files
ebaraultloay
authored andcommitted
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.
1 parent ca3ec13 commit 94c786f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/application.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ function dataSourcesFromConfig(name, config, connectorRegistry, registry) {
423423
config.connector = require(connectorPath);
424424
}
425425
}
426-
if (!config.connector.name)
426+
if (config.connector && typeof config.connector === 'object' && !config.connector.name)
427427
config.connector.name = name;
428428
}
429429

0 commit comments

Comments
 (0)