Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Giehl <stefan@matomo.org>2020-10-28 23:46:35 +0300
committerGitHub <noreply@github.com>2020-10-28 23:46:35 +0300
commit0e910f0badf1aaa6e1b34b83f4f1f9a11bd5b373 (patch)
tree64c6e341629ba8cd9f77c913fa777ee9f3537dfc /plugins/PrivacyManager
parenteb1543097d188c322b8470fea240fb62e39d01dd (diff)
Improve possibility to disable visits log / visitor profile (#16598)
Diffstat (limited to 'plugins/PrivacyManager')
-rw-r--r--plugins/PrivacyManager/API.php43
-rw-r--r--plugins/PrivacyManager/angularjs/manage-gdpr/managegdpr.controller.js9
-rw-r--r--plugins/PrivacyManager/angularjs/manage-gdpr/managegdpr.directive.html4
3 files changed, 48 insertions, 8 deletions
diff --git a/plugins/PrivacyManager/API.php b/plugins/PrivacyManager/API.php
index fe8940ed2e..e18d6f09a6 100644
--- a/plugins/PrivacyManager/API.php
+++ b/plugins/PrivacyManager/API.php
@@ -86,6 +86,49 @@ class API extends \Piwik\Plugin\API
return $this->gdpr->exportDataSubjects($visits);
}
+ public function findDataSubjects($idSite, $segment)
+ {
+ Piwik::checkUserHasSomeAdminAccess();
+
+ $result = Request::processRequest('Live.getLastVisitsDetails', [
+ 'segment' => $segment,
+ 'idSite' => $idSite,
+ 'period' => 'range',
+ 'date' => '1998-01-01,today',
+ 'filter_limit' => 401,
+ 'doNotFetchActions' => 1
+ ]);
+
+ $columnsToKeep = [
+ 'lastActionDateTime',
+ 'idVisit',
+ 'idSite',
+ 'siteName',
+ 'visitorId',
+ 'visitIp',
+ 'userId',
+ 'deviceType',
+ 'deviceModel',
+ 'deviceTypeIcon',
+ 'operatingSystem',
+ 'operatingSystemIcon',
+ 'browser',
+ 'browserFamilyDescription',
+ 'browserIcon',
+ 'country',
+ 'region',
+ 'countryFlag',
+ ];
+
+ foreach ($result->getColumns() as $column) {
+ if (!in_array($column, $columnsToKeep)) {
+ $result->deleteColumn($column);
+ }
+ }
+
+ return $result;
+ }
+
public function anonymizeSomeRawData(
$idSites,
$date,
diff --git a/plugins/PrivacyManager/angularjs/manage-gdpr/managegdpr.controller.js b/plugins/PrivacyManager/angularjs/manage-gdpr/managegdpr.controller.js
index 696c6b191f..1b4b95acef 100644
--- a/plugins/PrivacyManager/angularjs/manage-gdpr/managegdpr.controller.js
+++ b/plugins/PrivacyManager/angularjs/manage-gdpr/managegdpr.controller.js
@@ -18,7 +18,8 @@
this.segment_filter = 'userId==';
this.dataSubjects = [];
this.toggleAll = true;
- this.hasSearched = false
+ this.hasSearched = false;
+ this.profileEnabled = piwik.visitorProfileEnabled;
var sitesPromise = piwikApi.fetch({method: 'SitesManager.getSitesIdWithAdminAccess', filter_limit: '-1'});
@@ -136,13 +137,9 @@
piwikApi.fetch({
idSite: siteIds,
- period: 'range',
- date: '1998-01-01,today',
module: 'API',
- method: 'Live.getLastVisitsDetails',
+ method: 'PrivacyManager.findDataSubjects',
segment: self.segment_filter,
- filter_limit: 401,
- doNotFetchActions: 1
}).then(function (visits) {
self.hasSearched = true;
angular.forEach(visits, function (visit) {
diff --git a/plugins/PrivacyManager/angularjs/manage-gdpr/managegdpr.directive.html b/plugins/PrivacyManager/angularjs/manage-gdpr/managegdpr.directive.html
index 9d901734cd..bb922e6162 100644
--- a/plugins/PrivacyManager/angularjs/manage-gdpr/managegdpr.directive.html
+++ b/plugins/PrivacyManager/angularjs/manage-gdpr/managegdpr.directive.html
@@ -80,7 +80,7 @@
<th>{{ 'General_VisitorIP'|translate }}</th>
<th>{{ 'General_UserId'|translate }}</th>
<th>{{ 'General_Details'|translate }}</th>
- <th>{{ 'General_Action'|translate }}</th>
+ <th ng-show="managerGdpr.profileEnabled">{{ 'General_Action'|translate }}</th>
</tr>
</thead>
<tbody>
@@ -105,7 +105,7 @@
<span title="{{ dataSubject.browser }} {{ dataSubject.browserFamilyDescription }}"><img height="16" ng-src="{{ dataSubject.browserIcon }}"></span>
<span title="{{ dataSubject.country }} {{ dataSubject.region }}"><img height="16" ng-src="{{ dataSubject.countryFlag }}"></span>
</td>
- <td><a class="visitorLogTooltip" title="View visitor profile" ng-click="manageGdpr.showProfile(dataSubject.visitorId, dataSubject.idSite)">
+ <td ng-show="managerGdpr.profileEnabled"><a class="visitorLogTooltip" title="View visitor profile" ng-click="manageGdpr.showProfile(dataSubject.visitorId, dataSubject.idSite)">
<img src="plugins/Live/images/visitorProfileLaunch.png"> <span>{{ 'Live_ViewVisitorProfile'|translate }}</span>
</a></td>
</tr>