Skip to content

feat: add knowledge base toggle settings#11

Merged
mpge merged 1 commit into
mainfrom
feat/kb-toggle-settings
Apr 8, 2026
Merged

feat: add knowledge base toggle settings#11
mpge merged 1 commit into
mainfrom
feat/kb-toggle-settings

Conversation

@mpge

@mpge mpge commented Apr 8, 2026

Copy link
Copy Markdown
Member

Summary

  • Add KnowledgeBaseService with three toggle settings:
    • knowledge_base_enabled - master on/off switch
    • knowledge_base_public - whether KB is publicly accessible without auth
    • knowledge_base_feedback_enabled - whether article feedback is shown
  • Guard methods: can_access() and permission_check() for protecting KB routes
  • Settings CRUD via get_settings() and update_settings()
  • All settings default to enabled/true

Test plan

  • Verify defaults (all enabled/true)
  • Verify each toggle can be disabled and re-enabled
  • Verify get_settings() returns all keys and reflects changes
  • Verify update_settings() persists values and ignores unknown keys
  • Verify access guard blocks when KB is disabled
  • Verify private KB blocks unauthenticated users
  • Verify private KB allows authenticated users
  • Verify permission callback returns WP_Error with correct codes

Add KnowledgeBaseService with three toggle settings:
knowledge_base_enabled, knowledge_base_public, and
knowledge_base_feedback_enabled. Provides guard methods (can_access,
permission_check) for protecting KB routes/endpoints based on settings.
Includes comprehensive PHPUnit tests covering defaults, toggles, access
guards, and permission callbacks for enabled/disabled/public/private
combinations.
@mpge
mpge merged commit 3074e9b into main Apr 8, 2026
3 checks passed
@mpge
mpge deleted the feat/kb-toggle-settings branch April 8, 2026 13:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant