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.
This commit is contained in:
ebarault 2016-11-23 23:37:56 +01:00 committed by Loay
parent ca3ec134d6
commit 94c786f2f7
1 changed files with 1 additions and 1 deletions

View File

@ -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;
}