WP Manifestindependent plugin directory
manifest / utilities / mcs-building-keys-plugin

MCS Building Keys

WordPress plugin for the MCS physical key database

★ 0stars
v1.0.0latest · 3mo ago

Install

Download source zip No release zip yet

This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.

Install straight from GitHub with WP-CLI:

wp plugin install https://github.com/alscheuring/mcs-building-keys-plugin/archive/refs/heads/main.zip
No built-in updater. New versions won't appear under Dashboard → Updates. Install new releases yourself, or let Git Updater track the repository.

WordPress plugin for managing the MCS physical key database — a port of the key management module from portal.mcs.cmu.edu/facilities.

Features

  • Key inventory — track every physical key by number, building, department, lab, and room
  • Key assignment — assign keys to key holders with a two-step flow (assign → complete assignment form)
  • Verification — mark keys as verified by an admin
  • Missing keys — report and resolve missing keys with audit trail
  • Key requests — requestors submit a form; admins approve (auto-assigns an available key) or deny
  • Key holders — auto-created for @andrew.cmu.edu / @cmu.edu email addresses
  • Audit trail — every key action is logged with admin email, holder, and notes
  • CSV export — download the full key inventory as a spreadsheet
  • Reference data — manage buildings, departments, and labs from the admin UI

Requirements

  • WordPress 6.0+
  • PHP 8.1+
  • MySQL 5.7+

Installation

  1. Upload the mcs-building-keys folder to wp-content/plugins/
  2. Activate the plugin — database tables are created automatically on activation
  3. Navigate to Building Keys in the WordPress admin menu

Database Tables

All tables use the wp_mcs_bk_ prefix:

Table Purpose
wp_mcs_bk_buildings Building lookup (name)
wp_mcs_bk_departments Department lookup (name)
wp_mcs_bk_labs Lab/room lookup (name, room number, building)
wp_mcs_bk_keyholders Key holder records (name, andrew email)
wp_mcs_bk_keys Physical keys with assignment/verification/missing state
wp_mcs_bk_requests Key requests with approval workflow
wp_mcs_bk_audits Full audit trail for every key action

Key Status

Key status is derived, not stored:

Status Condition
missing reported_missing_at is set and missing_resolved_at is null
verified verified_at is set (and not missing)
unverified Neither of the above

REST API

Namespace: mcs-building-keys/v1
Authentication: WordPress nonce (X-WP-Nonce) + capability mcs_manage_building_keys or manage_options

Keys

Method Endpoint Description
GET /keys List keys (search, filters, pagination)
POST /keys Create key
GET /keys/{id} Get key
PATCH /keys/{id} Update key
DELETE /keys/{id} Delete key
POST /keys/{id}/assign Assign to holder
POST /keys/{id}/unassign Unassign
POST /keys/{id}/verify Toggle verified status
POST /keys/{id}/complete-form Mark assignment form complete
POST /keys/{id}/report-missing Report key missing
POST /keys/{id}/resolve-missing Resolve missing status
GET /keys/{id}/audits Get audit trail
GET /export Download CSV

Requests

Method Endpoint Description
GET /requests List requests
POST /requests Submit request
GET /requests/{id} Get request
POST /requests/{id}/approve Approve and assign key
POST /requests/{id}/deny Deny

Key Holders

Method Endpoint Description
GET /keyholders List all holders
POST /keyholders Create holder
PATCH /keyholders/{id} Update holder
GET /keyholders/search?q= Search by name/email

Reference Data

Method Endpoint Description
GET /reference Get buildings, departments, labs
POST /reference/buildings Add building
POST /reference/departments Add department
GET /reference/labs List labs
POST /reference/labs Add lab
DELETE /reference/labs/{id} Delete lab
GET /stats Dashboard stats

Roles & Capabilities

Role Capability
administrator mcs_manage_building_keys (added automatically)
building_keys_manager mcs_manage_building_keys

Key Holders Auto-Creation

When a key request is submitted with an @andrew.cmu.edu or @cmu.edu email, a KeyHolder record is automatically created if one doesn't exist. This mirrors the behavior of the original Laravel portal.

Assignment Form Flow

  1. Admin assigns a key → assignment_form_completed = false (pending)
  2. Admin marks form complete (with optional signer name) → assignment_form_completed = true

The admin dashboard highlights keys with a pending form in the stats bar.

File Structure

mcs-building-keys/
├── mcs-building-keys.php           # Plugin entry point
├── includes/
│   ├── class-mcs-bk-db.php         # Database schema installation
│   ├── class-mcs-bk-key.php        # Key CRUD, assign/unassign, status, stats
│   ├── class-mcs-bk-keyholder.php  # Key holder CRUD + auto-create
│   ├── class-mcs-bk-audit.php      # Audit log
│   ├── class-mcs-bk-request.php    # Key request CRUD + approve/deny
│   └── class-mcs-bk-api.php        # WP REST API routes
├── admin/
│   ├── class-mcs-bk-admin.php      # Admin menu, role, asset enqueue
│   └── partials/
│       └── main.php                # Admin page HTML
└── assets/
    ├── css/admin.css               # Admin styles
    └── js/admin.js                 # Admin SPA (vanilla JS)

Releases

1 release.

Tag
Published
v1.0.0 latest
Jul 16, 2026 3mo ago

These releases are tags only. The author does not attach a packaged zip, so there are no download counts to report.