Skip to content

Commit f666df2

Browse files
samin-zbackportbot[bot]
authored andcommitted
check permission on notify-due
check permission on notify-due Signed-off-by: samin-z <samin.zavarkesh@gmail.com> [skip ci]
1 parent 3150223 commit f666df2

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

lib/Controller/ConfigController.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
namespace OCA\Deck\Controller;
88

9+
use OCA\Deck\Db\Acl;
10+
use OCA\Deck\Db\BoardMapper;
911
use OCA\Deck\Service\ConfigService;
1012
use OCP\AppFramework\Http\DataResponse;
1113
use OCP\AppFramework\Http\NotFoundResponse;
@@ -17,6 +19,8 @@ public function __construct(
1719
$AppName,
1820
IRequest $request,
1921
private ConfigService $configService,
22+
private PermissionService $permissionService,
23+
private BoardMapper $boardMapper,
2024
) {
2125
parent::__construct($AppName, $request);
2226
}

lib/Service/ConfigService.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,12 @@ public function set($key, $value) {
157157
$result = $value;
158158
break;
159159
case 'board':
160-
[$boardId, $boardConfigKey] = explode(':', $key);
160+
// extra check that user only send one of the allowed board settings and not something random
161+
$parts = explode(':', $key, 3);
162+
if (count($parts) < 3) {
163+
break;
164+
}
165+
$boardConfigKey = $parts[2];
161166
if ($boardConfigKey === 'notify-due' && !in_array($value, [self::SETTING_BOARD_NOTIFICATION_DUE_ALL, self::SETTING_BOARD_NOTIFICATION_DUE_ASSIGNED, self::SETTING_BOARD_NOTIFICATION_DUE_OFF], true)) {
162167
throw new BadRequestException('Board notification option must be one of: off, assigned, all');
163168
}

0 commit comments

Comments
 (0)