From 6a3015ea65feca68b71191ea664e22898692c1c8 Mon Sep 17 00:00:00 2001 From: lukasolson Date: Tue, 2 Dec 2014 13:00:55 -0700 Subject: [PATCH] Move whitelisted routes into an array --- src/kibana/utils/routes/_setup.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/kibana/utils/routes/_setup.js b/src/kibana/utils/routes/_setup.js index 4312484906436..73b626f23bbc2 100644 --- a/src/kibana/utils/routes/_setup.js +++ b/src/kibana/utils/routes/_setup.js @@ -1,5 +1,6 @@ define(function (require) { return function routeSetup(Promise, kbnSetup, config, $route, kbnUrl, courier, Notifier, Private, $rootScope) { + var _ = require('lodash'); var errors = require('errors'); var NoDefaultIndexPattern = errors.NoDefaultIndexPattern; var NoDefinedIndexPatterns = errors.NoDefinedIndexPatterns; @@ -17,7 +18,13 @@ define(function (require) { ]) .then(function () { var path = $route.current.$$route.originalPath; - if (!path.match(/settings\/indices/) && !path.match(/settings\/about/)) { + var allowedRoutes = [ + 'settings/indices', + 'settings/about' + ]; + if (!_.find(allowedRoutes, function (route) { + return path.indexOf(route) >= 0; + })) { return courier.indexPatterns.getIds() .then(function (patterns) { if (!config.get('defaultIndex')) {