Skip to content

FIX / Expired or scheduled KB articles listed in the browse tab - #26232

Open
Mary-Clb wants to merge 2 commits into
glpi-project:11.0/bugfixesfrom
Mary-Clb:fix/kb-browse-visibility-dates
Open

Mary-Clb wants to merge 2 commits into
glpi-project:11.0/bugfixesfrom
Mary-Clb:fix/kb-browse-visibility-dates

Conversation

@Mary-Clb

@Mary-Clb Mary-Clb commented Nov 4, 2026

Copy link
Copy Markdown
Contributor
  • I have read the CONTRIBUTING document.
  • I have performed a self-review of my code.
  • I have added tests that prove my fix is effective or that my feature works.
  • This change requires a documentation update.

Description

  • It fixes !47335

Since the knowledge base browse tab was moved to the standard search engine, articles outside of their visibility period are listed to every user allowed to see them. An article whose "Visible until" date is in the past, or whose "Visible since" date is in the future, still shows up in the browse tab of the knowledge base and of the helpdesk FAQ for users without the knowledge base administration right. In 10.0 these articles were hidden from that list, and they are still hidden from the text search and from the recent and popular lists.

The default search criteria for knowledge base items now apply the begin and end date restriction for users without the knowledge base administration right. This is the same rule the former browse list used. The date criteria were moved to a reusable method, and a test checks the search results for a technician, a self-service user and a super-admin.

@Mary-Clb Mary-Clb self-assigned this Nov 4, 2026
@Mary-Clb Mary-Clb added the bug label Nov 4, 2026
@Mary-Clb
Mary-Clb marked this pull request as ready for review November 5, 2026 08:49
@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Powered by Qodo

@trasher trasher left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@trasher
trasher requested a review from Rom1-B November 5, 2026 11:51
Comment on lines +1087 to +1089
if (!Session::haveRight(KnowbaseItem::$rightname, KnowbaseItem::KNOWBASEADMIN)) {
$criteria[] = KnowbaseItem::getVisibilityDateCriteria();
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

10.0 still listed these in the "Manage" tab for their author, and that tab is gone in 11.0, so a non-admin writer can no longer find their own expired article to extend it.
Authors must continue to be able to view their own articles

Comment thread src/KnowbaseItem.php
*
* @return array<int, array<string, mixed>> WHERE clause
*/
public static function getVisibilityDateCriteria(): array

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The search case and showRecentPopular() still build the same criteria inline, they can use the new helper too: lines with comment "// Add visibility date"

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants