Skip to content

Commit

Permalink
Sharing reports not possible any more #354
Browse files Browse the repository at this point in the history
  • Loading branch information
Rello committed May 26, 2023
1 parent d126bd4 commit 6889576
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 4.9.2 - 2023-05-26
### Fixed
- Sharing reports not possible any more #354

## 4.9.1 - 2023-05-17
### Fixed
- Whats-new popup
Expand Down
3 changes: 1 addition & 2 deletions appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Visualize and share anything, from financial analysis to IoT logs.
- Sharing: user, groups, link
]]></description>
<version>4.9.1</version>
<version>4.9.2</version>
<licence>agpl</licence>
<author>Marcel Scherello</author>
<namespace>Analytics</namespace>
Expand All @@ -44,7 +44,6 @@ Visualize and share anything, from financial analysis to IoT logs.
https://raw.githubusercontent.com/Rello/analytics/master/screenshots/architecture25.png
</screenshot>
<dependencies>
<php min-version="7.0" max-version="8.3"/>
<nextcloud min-version="20" max-version="99"/>
</dependencies>
<activity>
Expand Down
5 changes: 5 additions & 0 deletions lib/Service/ShareService.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,11 @@ public function getSharedReports()
$reports = array();

foreach ($sharedReports as $sharedReport) {
$this->logger->debug('Shareservice: evaluating share: ' . $sharedReport["id"] . ' type ' . $sharedReport['shareType'] . ' for '. $sharedReport['shareUid_owner']);
// shared with a group?
if ($sharedReport['shareType'] === self::SHARE_TYPE_GROUP) {
// is the current user part of this group?
$this->logger->debug('Shareservice: Type group');
if (array_key_exists($sharedReport['shareUid_owner'], $groupsOfUser)) {
// was the report not yet added to the result?
if (!in_array($sharedReport["id"], array_column($reports, "id"))) {
Expand All @@ -163,9 +165,12 @@ public function getSharedReports()
// shared with a user directly?
} elseif ($sharedReport['shareType'] === self::SHARE_TYPE_USER) {
// current user matching?
$this->logger->debug('Shareservice: Type user; check against current user ' . $this->userSession->getUser()->getUID());
if ($this->userSession->getUser()->getUID() === $sharedReport['shareUid_owner']) {
// was the report not yet added to the result?
$this->logger->debug('Shareservice: Share belongs to current user');
if (!in_array($sharedReport["id"], array_column($reports, "id"))) {
$this->logger->debug('Shareservice: Share added to output');
unset($sharedReport['shareType']);
unset($sharedReport['shareUid_owner']);
$sharedReport['isShare'] = self::SHARE_TYPE_USER;
Expand Down

0 comments on commit 6889576

Please sign in to comment.