CMS Admin Guide
This page mirrors CMSadminguide.md. Keep both files synchronized.
Scope
- Grant and revoke CMS access.
- Verify database migrations are applied.
- Maintain CMS stability and secure operation.
- Support editors during publishing workflow.
- Keep CMS documentation aligned with implementation.
CMS architecture (current)
Pages
cms/gurbani.phpcms/gurudwara.phpcms/blogentry.phpcms/edit-article.php
Client-side modules
assets/js/cms-guard.jsassets/js/cms-api-client.jsassets/js/cms-blogentry.jsassets/js/cms-edit-article.js
Server-side APIs
php/api/cms/me.phpphp/api/cms/list-articles.phpphp/api/cms/get-article.phpphp/api/cms/save-article.php
Auth and policy helpers
php/lib/cms_auth.phpphp/api/cms/_shared.php
Security model
- Valid Firebase ID token.
- User record in
users. users.is_active = 1.users.role IN ('editor', 'admin').
Security is enforced on server APIs; client-side guard is not sufficient by itself.
Database setup
Apply database/sql/migration_cms_blog.sql for existing DBs, or database/sql/schema.sql for new installs.
CMS-related additions: users.role, users.is_active, heritage_articles.updated_by_user_id, heritage_articles.editor_notes, and heritage_article_revisions.
User and role management
Grant editor/admin access
UPDATE users SET role = 'editor', is_active = 1 WHERE email = 'editor@example.com';
UPDATE users SET role = 'admin', is_active = 1 WHERE email = 'admin@example.com';
Revoke CMS access
UPDATE users SET role = 'member' WHERE email = 'editor@example.com';
Or disable account:
UPDATE users SET is_active = 0 WHERE email = 'user@example.com';
Publishing policy (current)
- Publish threshold is 1000 to 10000 words.
- Validation is enforced in
php/api/cms/save-article.php. - Draft save is allowed outside threshold with warning.
Operational checklist
- Confirm DB migration success.
- Confirm at least one admin account.
- Verify editor login and draft save flow.
- Verify publish success at valid word count.
- Verify publish rejection outside threshold.
- Verify unauthorized users receive forbidden behavior.
Incident response
- Disable impacted users (
is_active = 0). - Inspect
heritage_article_revisionsfor edit history. - Restore content manually from latest valid revision.
- Rotate credentials for affected accounts if needed.
Documentation maintenance requirement
Whenever CMS evolves, update both CMSadminguide.md and CMSadminguide.php in the same change.