Files
James Griffin 0fbafc9d18
Some checks failed
CI / Coding Standards (push) Failing after 2m31s
CI / PHPStan (push) Failing after 50s
CI / Tests (PHP 8.1) (push) Successful in 50s
CI / Tests (PHP 8.2) (push) Successful in 48s
CI / Tests (PHP 8.3) (push) Successful in 40s
CI / No Debug Code (push) Successful in 2s
Initial plugin scaffold: lesson scheduling WordPress plugin
- Custom DB tables for availability slots and lesson bookings
- Instructor (wp-admin) and student (front-end) roles with custom capabilities
- REST API under us-scheduler/v1 for availability CRUD and booking
- [us_booking] and [us_student_login] shortcodes for student front end
- PHPUnit + Brain\Monkey unit test suite (29 tests)
- Gitea Actions CI: lint, PHPStan, tests on PHP 8.1/8.2/8.3, no-debug check
- Feature docs under docs/features/

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-30 12:44:46 -03:00

29 lines
941 B
Markdown

# Feature: User Roles
## Overview
Two custom WordPress user roles control access to all scheduling features.
## Roles
### Instructor (`us_instructor`)
Created on plugin activation. Logs in via standard wp-admin. Can:
- Manage their own availability slots (add/delete)
- View their upcoming confirmed/pending lessons in wp-admin
**Capabilities:** `read`, `manage_availability`, `view_own_lessons`
### Student (`us_student`)
Logs in via the front-end `[us_student_login]` shortcode. Can:
- Browse available lesson slots from all instructors
- Book a lesson slot
**Capabilities:** `read`, `book_lesson`, `view_own_lessons`
## Implementation
- Class: `Unsupervised\Schedular\Roles\RoleManager`
- Roles are created on `plugins_loaded → init` and on plugin activation via `Installer`.
- Permissions are checked with `current_user_can()` against the capability string, not the role name.
## Tests
- `tests/Unit/Roles/RoleManagerTest.php`