From f167481a36d3e2c1d6c726ab2a116824e923469e Mon Sep 17 00:00:00 2001 From: johnlim Date: Thu, 27 Sep 2018 15:44:03 +0800 Subject: [PATCH] fixes #5188 "Failed to fetch the event types list due the error: API key not set" error when event gateway plugin is used. --- lib/classes/Utils.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/lib/classes/Utils.js b/lib/classes/Utils.js index 7bdc8e62c..275883f67 100644 --- a/lib/classes/Utils.js +++ b/lib/classes/Utils.js @@ -334,12 +334,9 @@ class Utils { const userConfig = configUtils.getConfig(); const currentId = userConfig.userId; const globalConfig = configUtils.getGlobalConfig(); - if (globalConfig.users && globalConfig.users[currentId] && - globalConfig.users[currentId].dashboard && - globalConfig.users[currentId].dashboard.accessKey) { - return globalConfig.users[currentId].dashboard.accessKey; - } - return false; + const username = _.get(globalConfig, `users[${currentId}].dashboard.username`); + return _.get(globalConfig, `users[${currentId}].dashboard.accessKey`, false) || + _.get(globalConfig, `users[${currentId}].dashboard.accessKeys[${username}]`, false); } }