From 015e7acc32b012732d60b3420039e1697c458b74 Mon Sep 17 00:00:00 2001 From: Lukas Schaefer Date: Mon, 16 Mar 2026 12:39:41 -0400 Subject: [PATCH] Prepare 2.7.2 Signed-off-by: Lukas Schaefer --- CHANGELOG.md | 6 ++++++ appinfo/info.xml | 2 +- lib/Service/UtilsService.php | 18 +++++++++++++++++- 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c5e4fbdb..a5b8b510 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## 2.7.2 – 2026-03-16 + +### Fixed + +- Improve testing [#392](https://github.com/nextcloud/approval/pull/392) @lukasdotcom + ## 2.7.1 - 2026-01-23 ### Fixed diff --git a/appinfo/info.xml b/appinfo/info.xml index 1d4843aa..a38b5260 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -13,7 +13,7 @@ Approve/reject files based on workflows defined by admins. **Warning**: The DocuSign integration is no longer part of this app and can be installed with [this app](https://apps.nextcloud.com/apps/integration_docusign). ]]> - 2.7.1 + 2.7.2 agpl Julien Veyssier Approval diff --git a/lib/Service/UtilsService.php b/lib/Service/UtilsService.php index 439866af..80b49441 100644 --- a/lib/Service/UtilsService.php +++ b/lib/Service/UtilsService.php @@ -14,7 +14,6 @@ use OCP\Constants; use OCP\Files\IRootFolder; use OCP\Files\Node; - use OCP\IUser; use OCP\IUserManager; use OCP\Share\IManager as IShareManager; @@ -156,6 +155,23 @@ public function groupHasAccessTo(string $userId, Node $fileNode, ?string $groupI return false; } + /** + * Check if user can share a given file + * + * @param int $fileId + * @param string|null $userId + * @return bool + */ + public function userCanShareFile(int $fileId, ?string $userId): bool { + $user = $this->userManager->get($userId); + if ($user instanceof IUser) { + $userFolder = $this->root->getUserFolder($userId); + $node = $userFolder->getFirstNodeById($fileId); + return $node !== null && $node->isShareable(); + } + return false; + } + /** * @param string $name of the new tag * @return array