wrote attachment api controller, fixed bug caught by unit test in CardService

Signed-off-by: Ryan Fletcher <ryan.fletcher@codepassion.ca>
This commit is contained in:
Ryan Fletcher
2018-07-24 11:21:33 -04:00
committed by Julius Härtl
parent e88c9a760d
commit 37a2858d5f
4 changed files with 90 additions and 15 deletions

View File

@@ -356,6 +356,7 @@ class CardService {
* @throws \OCA\Deck\NoPermissionException
* @throws \OCP\AppFramework\Db\DoesNotExistException
* @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException
* @throws BadRequestException
*/
public function assignLabel($cardId, $labelId) {
@@ -421,8 +422,8 @@ class CardService {
throw new BadRequestException('card id must be a number');
}
if (is_numeric($userId) === false) {
throw new BadRequestException('user id must be a number');
if ($userId === false || $userId === null) {
throw new BadRequestException('user id must be provided');
}
$this->permissionService->checkPermission($this->cardMapper, $cardId, Acl::PERMISSION_EDIT);
@@ -461,8 +462,8 @@ class CardService {
throw new BadRequestException('card id must be a number');
}
if (is_numeric($userId) === false) {
throw new BadRequestException('user id must be a number');
if ($userId === false || $userId === null) {
throw new BadRequestException('user must be provided');
}
$assignments = $this->assignedUsersMapper->find($cardId);