Plugin Documentation

Documentation
← Back

Understanding Capabilities (RBAC Explained)

2 March 2026 jiffytrade Role Based Access Control (RBAC)

JiffyTrade uses a structured capability system to control permissions.

Each action inside the plugin is protected by a specific capability.

RBAC allows you to define the minimum WordPress role required for each capability.


🧠 What Is a Capability?

A capability represents a specific action a user can perform.

Examples:

  • View documents
  • Send invoices
  • Mark invoices as paid
  • Permanently delete documents
  • Manage customers
  • Access backups
  • View reports

You configure which role is required for each capability.


🔗 Capability Hierarchy (How Permissions Cascade)

Certain capabilities logically depend on others.

JiffyTrade enforces consistency rules so permission structures make sense.

Below is the agreed capability relationship structure.


👥 Customer Capabilities

  • manage_customersview_customers
  • delete_customersmanage_customers

Meaning:

  • A user who can manage customers must also be able to view them.
  • A user who can delete customers must be able to manage them.

Additionally:

Customers cannot be deleted while linked documents exist.
The system blocks deletion until all related documents are removed.


📄 Document Capabilities

  • manage_documentsview_documents
  • cancel_documentsmanage_documents
  • issue_quotes_invoicesmanage_documents
  • mark_invoices_paidissue_quotes_invoices
  • unlock_documentsmanage_documents
  • unlock_financial_documentsunlock_documents
  • send_remindersview_documents

This ensures:

  • You cannot issue documents without being able to manage them.
  • You cannot mark invoices as paid unless you can issue them.
  • You cannot unlock financial documents unless you can unlock documents generally.
  • Reminder sending requires visibility of documents.

🗑 Trash & Deletion Capabilities

  • restore_trashed_documentstrash_documents
  • delete_documents_permanentlytrash_documents
  • delete_documents_permanentlyrestore_trashed_documents

This ensures:

  • Anyone restoring documents can also move them to Trash.
  • Permanent deletion requires higher authority than simple trashing.

Additionally:

Quotes with associated invoices cannot be permanently deleted until all related invoices are removed. Paid invoices can never be deleted, until unlocked and marked as unpaid.

This rule is enforced at system level.


📊 Reports & Data

  • export_reportsview_reports
  • backup_restorebackup_create

This ensures:

  • Exporting data requires visibility of reports.
  • Restoring backups requires authority to create backups.

📈 Dashboard & Permissions

  • view_dashboard_statsview_dashboard
  • manage_accessview_permissions

This ensures:

  • Users viewing dashboard statistics must be able to access the dashboard.
  • Anyone managing permissions must be able to view the permissions tab.

⚠ Soft Warning Rules

JiffyTrade includes logic warnings if you configure permissions inconsistently.

Examples:

  • Setting manage_x lower than view_x
  • Setting tab-level manage permissions lower than manage_settings
  • Granting advanced actions without foundational visibility

These warnings do not automatically override your configuration —
but they highlight potentially unsafe or illogical setups.


🔐 System-Level Enforcement vs UI-Level Control

It’s important to understand:

Even if a button is hidden in the UI, the capability is still enforced server-side.

This means:

  • Actions cannot be triggered via direct URL access.
  • Permissions cannot be bypassed via manual requests.
  • Financial safeguards are enforced beyond the interface.

RBAC operates at logic level, not just display level.


🎯 Why the Hierarchy Matters

Without structured hierarchy:

  • A user might be able to permanently delete without restoring
  • A user might mark invoices as paid without issuing them
  • A user might export financial data without viewing reports

The capability chain prevents contradictory authority.