Skip to content

Commit

Permalink
Fix regression introduced with fix for Bug: 13837.
Browse files Browse the repository at this point in the history
The share list used when building the task form must match
the share list used when determining the tasklist to save
a task to. Otherwise, the form may see only 1 tasklist available
(thus not including the tasklist_id), but the save controller may
see more than 1 (thus expecting the tasklist_id).
  • Loading branch information
mrubinsk committed Dec 15, 2015
1 parent 0025def commit 7c7903a
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion nag/app/controllers/SaveTask.php
Expand Up @@ -51,7 +51,7 @@ public function processRequest(Horde_Controller_Request $request, Horde_Controll
}

if ($prefs->isLocked('default_tasklist') ||
count(Nag::listTasklists(false, Horde_Perms::EDIT, false)) <= 1) {
count($this->_getTasklists()) <= 1) {
$info['tasklist_id'] = $info['old_tasklist'] = Nag::getDefaultTasklist(Horde_Perms::EDIT);
}
try {
Expand Down Expand Up @@ -119,4 +119,24 @@ public function processRequest(Horde_Controller_Request $request, Horde_Controll
$response->setRedirectUrl($url);
}

/**
* Return tasklists the current user has PERMS_EDIT on.
* See Bug: 13837.
*
* @return array A hash of tasklist objects.
*/
protected function _getTasklists()
{
$tasklist_enums = array();
$user = $GLOBALS['registry']->getAuth();
foreach (Nag::listTasklists(false, Horde_Perms::SHOW, false) as $tl_id => $tl) {
if (!$tl->hasPermission($user, Horde_Perms::EDIT)) {
continue;
}
$tasklist_enums[$tl_id] = Nag::getLabel($tl);
}

return $tasklist_enums;
}

}

0 comments on commit 7c7903a

Please sign in to comment.