Skip to content

Commit 9d61a0b

Browse files
authored
Merge pull request #358 from nextcloud/backport/356/stable32
[stable32] Check access permission when requesting rules related with a file
2 parents f6885ae + 1556fc4 commit 9d61a0b

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lib/Service/ApprovalService.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@ public function getBasicUserRules(string $userId, string $role): array {
7878
* @return array
7979
*/
8080
public function getUserRules(string $userId, string $role = 'requesters', ?int $fileId = null): array {
81+
if ($fileId !== null && !$this->utilsService->userHasAccessTo($fileId, $userId)) {
82+
throw new \InvalidArgumentException('File not found');
83+
}
84+
8185
$userRules = [];
8286
$rules = $this->ruleService->getRules();
8387

0 commit comments

Comments
 (0)