Skip to content

Commit 0b470e2

Browse files
committed
Merge branch 'master' of https://github.com/Countly/countly-server into master-bugfix
2 parents 59c658b + 5eacb06 commit 0b470e2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+4545
-997
lines changed

.github/workflows/main.yml

+10-10
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
steps:
2323
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
2424
- uses: actions/checkout@v2
25-
25+
2626
- name: Github Actions Azure connection fix
2727
run: |
2828
# Workaround for https://github.com/actions/runner-images/issues/675#issuecomment-1381389712
@@ -31,27 +31,27 @@ jobs:
3131
- name: Installing Countly
3232
shell: bash
3333
run: sudo bash ./bin/countly.install.sh
34-
34+
3535
- name: NodeJS version
3636
shell: bash
3737
run: node --version
38-
38+
3939
- name: NPM version
4040
shell: bash
4141
run: npm --version
42-
42+
4343
- name: Mongo version
4444
shell: bash
4545
run: mongo --version
46-
46+
4747
- name: ShellCheck
4848
shell: bash
4949
run: countly shellcheck
50-
50+
5151
- name: ESLint
5252
shell: bash
5353
run: npx eslint .
54-
54+
5555
- name: DistFiles
5656
shell: bash
5757
run: sudo countly task dist-all
@@ -63,19 +63,19 @@ jobs:
6363
- name: Output API Logs
6464
if: ${{ always() }}
6565
run: cat log/countly-api.log
66-
66+
6767
- name: Output Dashboard Logs
6868
if: ${{ always() }}
6969
run: cat log/countly-dashboard.log
70-
70+
7171
- name: Output MongoDB Logs
7272
if: ${{ always() }}
7373
run: sudo cat /var/log/mongodb/mongod.log
7474

7575
- name: Output Nginx Logs
7676
if: ${{ always() }}
7777
run: sudo cat /var/log/nginx/error.log
78-
78+
7979
- name: Send slack notification
8080
id: slack
8181
if: always()

.shellcheckrc

-8
This file was deleted.

CHANGELOG.md

+59
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,62 @@
1+
## Version 22.09.16
2+
Fixes:
3+
- [dashboard] fixed incorrectly changing widgets with number visualisation
4+
- [core] Fix decoding of special characters in ui
5+
- [core] Fix for vulnerable password generation
6+
- [core] Sanitize file names for localisation and themes
7+
- [hooks] Fix calling of localhost
8+
- [data-manager] fixed bug in category change for events
9+
- [install] run wget without sudo during installation
10+
- [populator] Fix for empty users created for ab-testing
11+
- [settings] Fix for API settings missing from app level configuration
12+
13+
Enterprise fixes:
14+
- [data-manager] Fix bug in changing visibility for event
15+
- [cohorts] Fixed element sizes of cohort steps, inside cohort creation form
16+
- [ab-testing] Change python3 to python3.8 for CentOS 8
17+
- [ab-testing] Set default timezone for models installation scripts
18+
- [drill] Send segmentation request as POST
19+
20+
## Version 22.09.15
21+
Fixes:
22+
- [compliance-hub] use 'change' instead of 'after' for filter
23+
- [core] app user export to database (not using filesystem anymore) !!!changes export format!!!
24+
- [core] do not fetch masking config if masking is not enabled
25+
- [core] fixed parsing of special characters in event keys
26+
- [core] only use custom period when set explicitly in model file
27+
- [core] set activePeriod as current day in periodObject if single day selected
28+
- [dashboards] fixed bug with not fully loaded graphs for events and crashes for some periods
29+
- [data-manager] fixed localization for data masking toggle
30+
- [dbviewer] correct read access check fixed
31+
- [dbviewer] fixed server error on invalid queries
32+
- [events] fixed display bug in the all events view for events with ampersand in its name enterprise
33+
- [install] do not overwrite supervisord.conf in upgrades
34+
- [install] online and offline setups for CentOS/RHEL 7
35+
- [networking] support for ipv6
36+
- [period] end date was set as 00:00Am in custom period selections
37+
- [populator] added UI check for maximum time input that prevents non-number inputs
38+
- [populator] populating with template create SDK requests with template document properties
39+
- [push] fixed wrong error deserialization
40+
- [security] deepExtend manual object copy replaced with lodash merge
41+
- [security] jquery validation xss vulnerability fix
42+
- [UI] graph notes back link is fixed
43+
44+
Enterprise fixes:
45+
- [ab-testing] Fixes for setup.
46+
- [active-directory] Remove tlsKey for active directory client
47+
- [cohorts] Fixes for displaying special characters
48+
- [data-manager] Ability to mask device id
49+
- [data-manager] [users] Fixes for & in events name
50+
- [drill] Added index on eventTimeline collection for field app to have faster deletion on app delete/clear.
51+
- [drill] Fixed bug in timeline on single event deletion.
52+
- [drill] Make sure only preset values are used in meta regeneration and no new values are added.
53+
- [drill] Meta cleanup endpoint and function in drill. Clears out wrongly saved infromation in meta about user properties.
54+
- [retention] Fixes for showing cohort names in retention view.
55+
- [retention] Retention label set according to selected result type.
56+
- [revenue] Null check for revenue widgets
57+
- [users] Fixes for displaying special characters
58+
- [users] sidebar properties value change after page has loaded
59+
160
## Version 22.09.14
261
Fixes:
362
- [core] Always use random initialization vector if not provided for encryption

Dockerfile-core

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM phusion/baseimage:bionic-1.0.0
1+
FROM phusion/baseimage:focal-1.2.0
22

33
ARG COUNTLY_PLUGINS=mobile,web,desktop,plugins,density,locale,browser,sources,views,enterpriseinfo,logger,systemlogs,populator,reports,crashes,push,star-rating,slipping-away-users,compare,server-stats,dbviewer,assistant,times-of-day,compliance-hub,alerts,onboarding,consolidate,remote-config,hooks,dashboards
44
# Enterprise Edition:

README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33

44
<p align="right">
55

6-
[![Build Status](https://api.travis-ci.org/Countly/countly-server.png?branch=master)](https://travis-ci.org/Countly/countly-server) [![Install Countly on DigitalOcean](https://count.ly/github/install-on-digital-ocean.svg)](http://do.count.ly)
6+
![CI](https://github.com/countly/countly-server/actions/workflows/main.yml/badge.svg)
7+
![CodeQL Analysis](https://github.com/countly/countly-server/actions/workflows/codeql-analysis.yml/badge.svg)
8+
79

810
</p>
911

api/lib/countly.common.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -699,6 +699,7 @@ countlyCommon.extractChartData = function(db, clearFunction, chartData, dataProp
699699
* @param {object} data - countly metric model data
700700
* @param {object} props - object where key is output property name and value could be string as key from data object or function to create new value based on existing ones
701701
* @param {function} clearObject - function to prefill all expected properties as u, t, n, etc with 0, so you would not have null in the result which won't work when drawing graphs
702+
* @param {object} periodObject - period object override
702703
* @returns {object} object with sparkleline data for each property
703704
* @example
704705
* var sparkLines = countlyCommon.getSparklineData(countlySession.getDb(), {
@@ -723,8 +724,8 @@ countlyCommon.extractChartData = function(db, clearFunction, chartData, dataProp
723724
* "avg-events":"1.6222222222222222,1.5555555555555556,1.6,1.6363636363636365,1.6486486486486487,1,1,1,1,1,1.8333333333333333,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1.4137931034482758,1,1,1,1"
724725
* }
725726
*/
726-
countlyCommon.getSparklineData = function(data, props, clearObject) {
727-
var _periodObj = countlyCommon.periodObj;
727+
countlyCommon.getSparklineData = function(data, props, clearObject, periodObject) {
728+
var _periodObj = periodObject || countlyCommon.periodObj;
728729
var sparkLines = {};
729730
for (let p in props) {
730731
sparkLines[p] = [];
@@ -1530,6 +1531,7 @@ countlyCommon.timeString = function(timespent) {
15301531
* @param {array} unique - array of all properties that are unique from properties array. We need to apply estimation to them
15311532
* @param {object} totalUserOverrideObj - using unique property as key and total_users estimation property as value for all unique metrics that we want to have total user estimation overridden
15321533
* @param {object} prevTotalUserOverrideObj - using unique property as key and total_users estimation property as value for all unique metrics that we want to have total user estimation overridden for previous period
1534+
* @param {object} periodObject period object override for calculation
15331535
* @returns {object} dashboard data object
15341536
* @example
15351537
* countlyCommon.getDashboardData(countlySession.getDb(), ["t", "n", "u", "d", "e", "p", "m"], ["u", "p", "m"], {u:"users"});
@@ -1544,7 +1546,7 @@ countlyCommon.timeString = function(timespent) {
15441546
* "m":{"total":86,"prev-total":0,"change":"NA","trend":"u","isEstimate":true}
15451547
* }
15461548
*/
1547-
countlyCommon.getDashboardData = function(data, properties, unique, totalUserOverrideObj, prevTotalUserOverrideObj) {
1549+
countlyCommon.getDashboardData = function(data, properties, unique, totalUserOverrideObj, prevTotalUserOverrideObj, periodObject) {
15481550
/**
15491551
* Clear object, bu nulling out predefined properties, that does not exist
15501552
* @param {object} obj - object to clear
@@ -1568,7 +1570,7 @@ countlyCommon.getDashboardData = function(data, properties, unique, totalUserOve
15681570
return obj;
15691571
}
15701572

1571-
var _periodObj = countlyCommon.periodObj,
1573+
var _periodObj = periodObject || countlyCommon.periodObj,
15721574
dataArr = {},
15731575
tmp_x,
15741576
tmp_y,

api/lib/countly.model.js

+11-4
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ countlyModel.create = function(fetchValue) {
7171
};
7272
//Private Properties
7373
var _Db = {},
74-
_period = "30days",
74+
_period = null,
7575
_metas = {},
7676
_uniques = ["u"],
7777
_metrics = ["t", "u", "n"],
@@ -507,6 +507,10 @@ countlyModel.create = function(fetchValue) {
507507
* @returns {array} object to use when displaying number {value: 123, change: 12, sparkline: [1,2,3,4,5,6,7]}
508508
*/
509509
countlyMetric.getNumber = function(metric, isSparklineNotRequired) {
510+
var periodObject = null;
511+
if (this.getPeriod()) { // only set custom period if it was explicitly set on the model object
512+
periodObject = countlyCommon.getPeriodObj({qstring: {}}, this.getPeriod());
513+
}
510514
metric = metric || _metrics[0];
511515
var metrics = [metric];
512516
//include other default metrics for data correction
@@ -517,7 +521,7 @@ countlyModel.create = function(fetchValue) {
517521
if (metric === "n") {
518522
metrics.push("u");
519523
}
520-
var data = countlyCommon.getDashboardData(this.getDb(), metrics, _uniques, { u: this.getTotalUsersObj().users }, { u: this.getTotalUsersObj(true).users });
524+
var data = countlyCommon.getDashboardData(this.getDb(), metrics, _uniques, { u: this.getTotalUsersObj().users }, { u: this.getTotalUsersObj(true).users }, periodObject);
521525
if (isSparklineNotRequired) {
522526
return data[metric];
523527
}
@@ -535,7 +539,7 @@ countlyModel.create = function(fetchValue) {
535539
}
536540

537541
return obj;
538-
});
542+
}, periodObject);
539543
for (let i in data) {
540544
if (sparkLines[i]) {
541545
data[i].sparkline = sparkLines[i].split(",").map(function(item) {
@@ -553,10 +557,13 @@ countlyModel.create = function(fetchValue) {
553557
*/
554558
countlyMetric.getTimelineData = function() {
555559
var dataProps = [];
560+
var periodObject = null;
556561
for (let i = 0; i < _metrics.length; i++) {
557562
dataProps.push({ name: _metrics[i] });
558563
}
559-
var periodObject = countlyCommon.getPeriodObj({qstring: {}}, this.getPeriod());
564+
if (this.getPeriod()) { // only set custom period if it was explicitly set on the model object
565+
periodObject = countlyCommon.getPeriodObj({qstring: {}}, this.getPeriod());
566+
}
560567
var data = countlyCommon.extractData(this.getDb(), this.clearObject, dataProps, periodObject);
561568
var ret = {};
562569
for (let i = 0; i < data.length; i++) {

api/parts/data/usage.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -392,11 +392,11 @@ usage.returnAllProcessedMetrics = function(params) {
392392
}
393393

394394
// We check if country data logging is on and user's country is the configured country of the app
395-
if (tmpMetric.name === "country" && (plugins.getConfig("api").country_data === false || params.app_cc !== params.user.country)) {
395+
if (tmpMetric.name === "country" && (plugins.getConfig("api", params.app && params.app.plugins, true).country_data === false || params.app_cc !== params.user.country)) {
396396
continue;
397397
}
398398
// We check if city data logging is on and user's country is the configured country of the app
399-
if (tmpMetric.name === "city" && (plugins.getConfig("api").city_data === false || params.app_cc !== params.user.country)) {
399+
if (tmpMetric.name === "city" && (plugins.getConfig("api", params.app && params.app.plugins, true).city_data === false || params.app_cc !== params.user.country)) {
400400
continue;
401401
}
402402

api/parts/mgmt/users.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ var usersApi = {},
99
mail = require('./mail.js'),
1010
countlyConfig = require('./../../../frontend/express/config.js'),
1111
plugins = require('../../../plugins/pluginManager.js'),
12-
{ hasAdminAccess, getUserApps, getAdminApps } = require('./../../utils/rights.js');
12+
{ hasAdminAccess, getUserApps, getAdminApps, hasReadRight } = require('./../../utils/rights.js');
1313

1414
const countlyCommon = require('../../lib/countly.common.js');
1515
const log = require('../../utils/log.js')('core:mgmt.users');
@@ -925,7 +925,7 @@ usersApi.fetchNotes = async function(params) {
925925
appIds = await usersApi.fetchUserAppIds(params);
926926
}
927927
filteredAppIds = appIds.filter((appId) => {
928-
if (hasAdminAccess(params.member, appId)) {
928+
if (hasAdminAccess(params.member, appId) || hasReadRight('core', appId, params.member)) {
929929
return true;
930930
}
931931
return false;

0 commit comments

Comments
 (0)