Bouncer Plugin - Approval Workflow

About Bouncer

View on GitHub

The Bouncer plugin implements an approval workflow for CakePHP applications. Users propose changes (create or edit records), and admins/moderators can review, approve, or reject those changes before they are published to the actual database tables.

Features Demonstrated

User Workflow
  • View All Articles - See published content
  • Submit New Article - Create content for approval
  • Edit Articles - Click edit on any article to propose changes
  • Draft Management - Automatic draft recovery on re-edit
  • Validation - Errors shown immediately, not after approval
Admin/Moderator Workflow
  • View Pending Changes - Review queue
  • Diff View - See exactly what changed
  • Approve/Reject - With optional reason/note
  • Bypass Option - Admins can publish directly without approval
  • Transaction Safety - Atomic approval process

Use Cases

Content Management
Editorial approval for articles, blog posts, and user-generated content.
Data Entry Systems
Quality control workflow with supervisor approval before data goes live.
User Moderation
Review user-submitted changes, profiles, or marketplace listings.

Configuration Highlights

// In SandboxArticlesTable
$this->addBehavior('Bouncer.Bouncer', [
    'userField' => 'user_id',              // Track who made changes
    'requireApproval' => ['add', 'edit'],  // Which actions need approval
    'validateOnDraft' => true,             // Validate before storing draft
    'autoSupersede' => true,               // Auto-update existing drafts
]);

Try It Out!

Start by creating a new article, then check the pending queue to approve it. Admins can also bypass the approval workflow and publish directly.

Note: This demo uses simulated user IDs (user_id=1 for regular users, reviewer_id=1 for admins). In a real application, you would integrate with CakePHP's Authentication plugin.

Send your feedback or bugreport!