Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(Fix) Visibility of private task assign to me #17918

Merged
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions phpunit/functional/TicketTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6418,6 +6418,19 @@ protected function timelineItemsProvider(): iterable
$normal_user_id = getItemByTypeName(\User::class, 'normal', true);
$tech_user_id = getItemByTypeName(\User::class, 'tech', true);

$n_profile = new \Profile();
$new_profile_id = $n_profile->add(
[
'name' => 'No Private Task',
'interface' => 'central',
]
);
$this->createItem(\Profile::class, [
'name' => 'No Private Task',
'interface' => 'central',
'_entities_id' => getItemByTypeName('Entity', '_test_root_entity', true),
]);

Lainow marked this conversation as resolved.
Show resolved Hide resolved
$this->login();

$ticket = $this->createItem(
Expand Down Expand Up @@ -6496,6 +6509,17 @@ protected function timelineItemsProvider(): iterable
]
);

$this->createItem(
\TicketTask::class,
[
'tickets_id' => $ticket->getID(),
'content' => 'private task of only see his task user',
Lainow marked this conversation as resolved.
Show resolved Hide resolved
'is_private' => 1,
'users_id_tech' => $normal_user_id,
'date_creation' => date('Y-m-d H:i:s', strtotime('+30s', $now)), // to ensure result order is correct
]
);

// tech has rights to see all private followups/tasks
yield [
'login' => 'tech',
Expand All @@ -6509,6 +6533,7 @@ protected function timelineItemsProvider(): iterable
],
'expected_tasks' => [
'private task of normal user',
'private task of only see his task user',
Lainow marked this conversation as resolved.
Show resolved Hide resolved
'private task of tech user',
'public task',
],
Expand All @@ -6526,6 +6551,7 @@ protected function timelineItemsProvider(): iterable
],
'expected_tasks' => [
'private task of normal user',
'private task of only see his task user',
Lainow marked this conversation as resolved.
Show resolved Hide resolved
'public task',
],
];
Expand Down Expand Up @@ -6561,6 +6587,7 @@ protected function timelineItemsProvider(): iterable
],
'expected_tasks' => [
'private task of normal user',
'private task of only see his task user',
Lainow marked this conversation as resolved.
Show resolved Hide resolved
'private task of tech user',
'public task',
],
Expand Down
1 change: 1 addition & 0 deletions src/CommonITILObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -7053,6 +7053,7 @@ public function getTimelineItems(array $options = [])
'OR' => [
'is_private' => 0,
'users_id' => Session::getCurrentInterface() === "central" ? (int)Session::getLoginUserID() : 0,
'users_id_tech' => Session::getCurrentInterface() === "central" ? (int)Session::getLoginUserID() : 0,
Lainow marked this conversation as resolved.
Show resolved Hide resolved
]
];
}
Expand Down