feat(wiki): per-folder access control for wiki sections #674
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Add folder-level write protection for wiki sections, allowing admins to lock specific wiki areas while keeping others open for editing. Similar to Wikipedia's page protection levels.
Current State
CanRead(unit.TypeWiki)andCanWrite(unit.TypeWiki)inrouters/web/repo/wiki.goDesign
Access Control File
A
_access.ymlfile in any wiki folder defines permissions for that folder and its children:Permission Inheritance
_access.ymlexists in a folder, permissions are inherited from the parent folderEnforcement
WikiPost()/EditWikiPost()before allowing edits — walk the folder chain for_access.ymlfilesrenderViewPage()for read restrictions_access.ymlfiles themselves are only editable by repo adminsUI
Files to Modify
routers/web/repo/wiki.goservices/wiki/wiki_access.go_access.yml, permission resolutiontemplates/repo/wiki/view.tmplRelated
Wikipedia Parity
Wikipedia has multiple protection levels (semi-protected, fully protected, cascading protection) that prevent unauthorized edits to high-traffic or sensitive pages while keeping the majority of the wiki open.