diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index 5e096760fce..1fc2592c6a5 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -257,6 +257,22 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t } } } + else + { + // Caller did not ask to filter on tasks of a specific user (this probably means he want also tasks of all users, into public project + // or into all other projects if user has permission to). + if (empty($user->rights->project->all->lire)) + { + // User is not allowed on this project and project is not public, so we hide line + if (! in_array($lines[$i]->fk_project, $projectsArrayId)) + { + // TODO + // If user is assigned to a task into a private project user has no permission on, we must use showlinegray=1 (to show task without showing project) + // if user is not assigned to any task into tree, we must use showline=0 + $showline=0; + } + } + } if ($showline) { @@ -367,7 +383,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t if (! $showlineingray) $inc++; $level++; - if ($lines[$i]->id) projectLinesa($inc, $lines[$i]->id, $lines, $level, $var, $showproject, $taskrole, $projectsListId); + if ($lines[$i]->id) projectLinesa($inc, $lines[$i]->id, $lines, $level, $var, $showproject, $taskrole, $projectsListId, 0, $showalsopublicproj); $level--; $total += $lines[$i]->duration; } diff --git a/htdocs/projet/tasks/index.php b/htdocs/projet/tasks/index.php index 077a56c1976..8795cf98486 100644 --- a/htdocs/projet/tasks/index.php +++ b/htdocs/projet/tasks/index.php @@ -80,7 +80,7 @@ else else print $langs->trans("ProjectsPublicDesc").'

'; } -// Get list of project id allowed to user +// Get list of project id allowed to user (in a string list separated by coma) $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,$mine,1,$socid); // Get list of tasks in tasksarray and taskarrayfiltered @@ -121,7 +121,7 @@ print "\n"; // Show all lines in taskarray (recursive function to go down on tree) $j=0; $level=0; -$nboftaskshown=projectLinesa($j, 0, $tasksarray, $level, true, 1, $tasksrole, $projectsListId); +$nboftaskshown=projectLinesa($j, 0, $tasksarray, $level, true, 1, $tasksrole, $projectsListId, 0); print ""; print '';