Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion lib/Service/ApprovalService.php
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,16 @@ public function reject(int $fileId, ?string $userId, string $message = '', strin
* @throws \OCP\Files\NotPermittedException
* @throws \OC\User\NoUserException
*/
public function request(int $fileId, int $ruleId, ?string $userId, bool $createShares): array {
public function request(int $fileId, int $ruleId, ?string $userId, bool $createShares) {

$state = $this->getApprovalState($fileId, $userId);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This check is done before ensuring that the user has access to the file which could leak information.


if ($state['state'] === \OCA\Approval\AppInfo\Application::STATE_APPROVED) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if ($state['state'] === \OCA\Approval\AppInfo\Application::STATE_APPROVED) {
if ($state['state'] === Application::STATE_APPROVED) {

return [
'error' => 'File already approved. Cannot request approval again.'
];
}

if (!$this->utilsService->userHasAccessTo($fileId, $userId)) {
return ['error' => $this->l10n->t('You do not have access to this file')];
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/Info.vue
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ export default {
return this.userId !== getCurrentUser().uid
},
canRequestApproval() {
return this.userRules.length > 0
return this.userRules.length > 0 && this.state !== states.APPROVED
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't necessary as it only matters that you can't re-request approval for the same workflow. Some users may have two approval flows they want on the same file.

},
ruleText() {
if (
Expand Down
Loading