Fix ACL and archived REST endpoints
Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
@@ -86,8 +86,8 @@ class CardApiController extends ApiController {
|
||||
*
|
||||
* Update a card
|
||||
*/
|
||||
public function update($title, $type, $order = 0, $description = '', $owner, $duedate = null) {
|
||||
$card = $this->cardService->update($this->request->getParam('cardId'), $title, $this->request->getParam('stackId'), $type, $order, $description, $owner, $duedate, 0);
|
||||
public function update($title, $type, $order = 0, $description = '', $owner, $duedate = null, $archived = null) {
|
||||
$card = $this->cardService->update($this->request->getParam('cardId'), $title, $this->request->getParam('stackId'), $type, $order, $description, $owner, $duedate, 0, $archived);
|
||||
return new DataResponse($card, HTTP::STATUS_OK);
|
||||
}
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ class Board extends RelationalEntity {
|
||||
*/
|
||||
public function setAcl($acl) {
|
||||
foreach ($acl as $a) {
|
||||
$this->acl[$a->id] = $a;
|
||||
$this->acl[] = $a;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -249,7 +249,7 @@ class CardService {
|
||||
* @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException
|
||||
* @throws BadRequestException
|
||||
*/
|
||||
public function update($id, $title, $stackId, $type, $order = 0, $description = '', $owner, $duedate = null, $deletedAt) {
|
||||
public function update($id, $title, $stackId, $type, $order = 0, $description = '', $owner, $duedate = null, $deletedAt = null, $archived = null) {
|
||||
|
||||
if (is_numeric($id) === false) {
|
||||
throw new BadRequestException('card id must be a number');
|
||||
@@ -276,7 +276,7 @@ class CardService {
|
||||
throw new StatusException('Operation not allowed. This board is archived.');
|
||||
}
|
||||
$card = $this->cardMapper->find($id);
|
||||
if ($card->getArchived()) {
|
||||
if ($archived !== null && $card->getArchived() && $archived === true) {
|
||||
throw new StatusException('Operation not allowed. This card is archived.');
|
||||
}
|
||||
$changes = new ChangeSet($card);
|
||||
@@ -301,7 +301,13 @@ class CardService {
|
||||
$card->setOrder($order);
|
||||
$card->setOwner($owner);
|
||||
$card->setDuedate($duedate);
|
||||
$card->setDeletedAt($deletedAt);
|
||||
if ($deletedAt) {
|
||||
$card->setDeletedAt($deletedAt);
|
||||
}
|
||||
if ($archived !== null) {
|
||||
$card->setArchived($archived);
|
||||
}
|
||||
|
||||
|
||||
// Trigger update events before setting description as it is handled separately
|
||||
$changes->setAfter($card);
|
||||
|
||||
Reference in New Issue
Block a user