Skip to content

Commit

Permalink
[#487][#491] Check lock on saved date before updating a task.
Browse files Browse the repository at this point in the history
We were only checking the new task date in a task update operation,
instead of also checking the saved date. As a result, it was
possible to move a task from a locked date to an unlocked one, and
then update any other field.

As a side effect, we break the assumption in PartialUpdateTasksAction
that every DirtyTask contains a date, which helps fixing #491.
  • Loading branch information
jaragunde committed May 7, 2021
1 parent 349c88f commit d893458
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions model/facade/action/PartialUpdateTasksAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,19 @@ protected function doExecute() {

//first check permission on task write
foreach ($this->tasks as $i => $task) {
if(!$configDao->isWriteAllowedForDate($task->getDate()) ||
// Do not allow assigning a task to a locked date
if ($task->isDateDirty()) {
if(!$configDao->isWriteAllowedForDate($task->getDate())) {
$discardedTasks[] = $task;
unset($this->tasks[$i]);
continue;
}
}

// Do not allow updating tasks saved in locked dates or belonging
// to a different user
$oldTask = $taskDao->getById($task->getId());
if(!$configDao->isWriteAllowedForDate($oldTask->getDate()) ||
(!$taskDao->checkTaskUserId(
$task->getId(), $task->getUserId()))) {
$discardedTasks[] = $task;
Expand All @@ -103,7 +115,6 @@ protected function doExecute() {
}

// Do not allow updating tasks which belong to inactive projects
$oldTask = $taskDao->getById($task->getId());
$projectId = $oldTask->getProjectId();
$projectVO = $projectDAO->getById($projectId);
if (!$projectVO || !$projectVO->getActivation()) {
Expand Down

0 comments on commit d893458

Please sign in to comment.