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.php
  • cms/gurudwara.php
  • cms/blogentry.php
  • cms/edit-article.php

Client-side modules

  • assets/js/cms-guard.js
  • assets/js/cms-api-client.js
  • assets/js/cms-blogentry.js
  • assets/js/cms-edit-article.js

Server-side APIs

  • php/api/cms/me.php
  • php/api/cms/list-articles.php
  • php/api/cms/get-article.php
  • php/api/cms/save-article.php

Auth and policy helpers

  • php/lib/cms_auth.php
  • php/api/cms/_shared.php

Security model

  1. Valid Firebase ID token.
  2. User record in users.
  3. users.is_active = 1.
  4. 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

  1. Confirm DB migration success.
  2. Confirm at least one admin account.
  3. Verify editor login and draft save flow.
  4. Verify publish success at valid word count.
  5. Verify publish rejection outside threshold.
  6. Verify unauthorized users receive forbidden behavior.

Incident response

  1. Disable impacted users (is_active = 0).
  2. Inspect heritage_article_revisions for edit history.
  3. Restore content manually from latest valid revision.
  4. Rotate credentials for affected accounts if needed.

Documentation maintenance requirement

Whenever CMS evolves, update both CMSadminguide.md and CMSadminguide.php in the same change.