Skip to content

Commit 5c2acfb

Browse files
committed
[server-1561] lint & ui fixes.
- hasOwnProperty() usage removed. - hided restricted app collections from dbviewer app filter dropdown too.
1 parent 2ac2fdd commit 5c2acfb

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

plugins/dbviewer/api/api.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ var common = require('../../../api/utils/common.js'),
252252
//if app_id was provided, we need to check if user has access for this app_id
253253
// is user_of array contain current app_id?
254254
var isUserOf = params.member.user_of && params.member.user_of.indexOf(params.qstring.app_id) !== -1;
255-
var isRestricted = params.member.app_restrict && params.member.app_restrict.hasOwnProperty(params.qstring.app_id) !== -1 && params.member.app_restrict[params.qstring.app_id].indexOf("#/manage/db");
255+
var isRestricted = params.member.app_restrict && params.member.app_restrict[params.qstring.app_id] && params.member.app_restrict[params.qstring.app_id].indexOf("#/manage/db");
256256
if (params.member.global_admin || isUserOf && !isRestricted) {
257257
apps = [params.qstring.app_id];
258258
}

plugins/dbviewer/frontend/public/javascripts/countly.views.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,9 @@ window.DBViewerView = countlyView.extend({
8383
$('#app-list').prepend('<div data-value="all" class="app-option item" data-localize=""><span class="app-title-in-dropdown">' + $.i18n.map["common.all"] + '</span></div>');
8484
// append list items
8585
for (var key in countlyGlobal.apps) {
86-
$('#app-list').append('<div data-value="' + countlyGlobal.apps[key]._id + '" class="app-option item" data-localize=""><span class="app-title-in-dropdown">' + countlyGlobal.apps[key].name + '</span></div>');
86+
if (!countlyGlobal.member.app_restrict || (countlyGlobal.member.app_restrict && !countlyGlobal.member.app_restrict.hasOwnProperty(key))) {
87+
$('#app-list').append('<div data-value="' + countlyGlobal.apps[key]._id + '" class="app-option item" data-localize=""><span class="app-title-in-dropdown">' + countlyGlobal.apps[key].name + '</span></div>');
88+
}
8789
}
8890
// set height
8991
if ($('#dbviewer').height() < (window.innerHeight - 150)) {

0 commit comments

Comments
 (0)