Skip to content

Commit

Permalink
Issue 83: Test missing write permission.
Browse files Browse the repository at this point in the history
  • Loading branch information
donquixote committed Jan 15, 2025
1 parent 4b3c55f commit dabead7
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions tests/src/Kernel/Controller/WopiControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,34 @@ public function testUserNotFound(): void {
}
}

/**
* Tests routes with 'wri' in the token but the user has no write permission.
*
* @covers ::wopiCheckFileInfo
* @covers ::wopiGetFile
* @covers ::wopiPutFile
*/
public function testNoWritePermission(): void {
$this->user = $this->createUser(['access content']);
$this->setCurrentUser($this->user);
$requests = [
'info' => $this->createRequest(write: TRUE),
'save' => $this->createRequest(
'/contents',
'POST',
write: TRUE,
content: 'xyz',
),
];
foreach ($requests as $name => $request) {
$this->assertAccessDeniedResponse(
'The user does not have collabora edit access for this media.',
$request,
$name,
);
}
}

/**
* {@inheritdoc}
*/
Expand Down

0 comments on commit dabead7

Please sign in to comment.