Skip to content

Knowledge Folder Lock Badges PR Review

Ed Mozley edited this page Nov 28, 2026 · 1 revision

Knowledge folder lock badges - PR review

PR #448 by @Dr4inder Β· No issue Β· Verdict: merge Β· 5.12.0

In Knowledge, a πŸ”’ beside a folder's name is meant to say this folder has its own permissions, the same as it does on an article. On folders it said something else. User page: Knowledge.

What you saw

Folder Before After
Follows the folder above, but was set to Restricted before inheritance was switched on πŸ”’ - although the restriction no longer applies no lock
Has its own rules, open to everyone no lock - although it does not follow its folder πŸ”’
Has its own rules, restricted πŸ”’ πŸ”’
Follows the folder above no lock no lock

What was wrong

Ticking Use the same permissions as the folder above keeps the folder's own Open / Restricted setting (is_restricted) stored, so it comes back if inheritance is switched off again - but while inheritance is on, that setting does nothing. Every folder renderer drew the lock from is_restricted, so it showed a setting that was asleep and missed an open folder with its own rules. Articles already used inherit_permissions, so the two disagreed in the same list.

It was four places, not one: the sidebar tree, the tree layout, the details layout, and the cards/list rows.

βœ… What was good - keep it this way

What Why it matters
Uses the inherits field api/knowledge/folders.php already sends No API or schema change
Number(f.inherits) === 0 Right whether the value arrives as 0 or "0"
All four folder views changed; the tooltip reuses the article badge's Has its own permissions One meaning for the lock in the whole module, no new strings
A TRAP: comment that is_restricted stays stored but inactive The next person does not "fix" it back
tests/knowledge-permission-badges.php runs the shipped renderers in Chrome, every layout and the sidebar It fails on the old code (13 folder checks) and cannot drift from the real functions
Access checks, stored permissions and the API untouched A display fix that cannot change who sees what

πŸ”§ What was added when merging

Nothing - merged as it was.

Left as it is

  • The Permission exceptions dialog still draws its lock from is_restricted. That is right there: the dialog only lists things with their own rules, so its lock means Restricted.
  • A long folder name in the sidebar is cut short with "…", and the lock goes with it. That was so before this PR, for every long name.
  • The string knowledge.folders.restricted is no longer used; it is left in the locale files.

πŸ§ͺ What was checked

Test Result
tests/knowledge-permission-badges.php (the PR's) 40 passed
tests/knowledge-folder-navigation.php 6 passed
tests/escape-helpers-quotes.php, tests/web-exposure-guard.php pass

And on screen, on a test install with four ZZ folders, one of each kind: before, the inheriting folder showed the lock and the open one with its own rules did not; after, the other way round.


See also: Knowledge Β· Bugs resolved

FreeITSM

Getting Started

Modules

Multi-tenancy (planned)

Responses to feedback

Blue sky thinking

Bugs resolved

Pull requests

Links

Clone this wiki locally