diff --git a/bundles/framework/layerlist/model/LayerGroup.js b/bundles/framework/layerlist/model/LayerGroup.js index f8520805f3..614456ddc2 100644 --- a/bundles/framework/layerlist/model/LayerGroup.js +++ b/bundles/framework/layerlist/model/LayerGroup.js @@ -9,6 +9,7 @@ export class LayerGroup { this.groups = groups || []; this.searchIndex = {}; this.tools = []; + this._isAdmin = Oskari.user().isAdmin(); } getParentId () { @@ -104,10 +105,15 @@ export class LayerGroup { newLayers.forEach(layer => this.addLayer(layer)); } _getSearchIndex (layer) { - var val = layer.getName() + ' ' + + let val = layer.getName() + ' ' + layer.getInspireName() + ' ' + layer.getOrganizationName(); // TODO: maybe filter out undefined texts + if (this._isAdmin) { + val = val + ' ' + + layer.getId() + ' ' + + layer.getLayerName(); + } return val.toLowerCase(); } matchesKeyword (layerId, keyword) { diff --git a/src/user.js b/src/user.js index e038198ec1..7902fa2028 100644 --- a/src/user.js +++ b/src/user.js @@ -41,6 +41,7 @@ function (userData) { this._loggedIn = false; + this._admin = false; this._roles = []; if (userData) { this._firstName = userData.firstName; @@ -53,6 +54,9 @@ if (userData.userUUID) { this._loggedIn = true; } + if (userData.admin === true) { + this._admin = true; + } this._apiKey = userData.apikey; } }, { @@ -145,6 +149,9 @@ isLoggedIn: function () { return this._loggedIn; }, + isAdmin: function () { + return this._admin; + }, /** * @method getRoles * Roles for the user