Fixes the empty group-class dropdown in the page editor.
Problem
GET /wp-json/us-scheduler/v1/offerings guarded its listing with book_lesson, which is granted only to the us_student role. The editor's group-class picker (assets/js/blocks.js) calls that endpoint, so an administrator or instructor editing a page got a rest_forbidden 403 and the JS .catch fell back to an empty array — a blank picker with no visible error.
Change
OfferingEndpoint::canBook() becomes canRead() and accepts book_lessonormanage_offerings. Still login-only; there is no anonymous consumer.
The listing itself is untouched: active offerings only, public ones plus the invite-only classes the caller has been granted, with the e-transfer email omitted.
Corrected the GET /offerings row in docs/features/offerings.md, which claimed the endpoint was public.
Instructors now see every studio group class in the picker rather than just their own, which matches what the block actually renders.
Tests
Four permission tests added to tests/Unit/Offering/OfferingEndpointTest.php: student with book_lesson, manager with manage_offerings and no book_lesson, logged-in user with neither, and a logged-out visitor.
composer test — 633 tests, 1812 assertions, all passing
Fixes the empty group-class dropdown in the page editor.
## Problem
`GET /wp-json/us-scheduler/v1/offerings` guarded its listing with `book_lesson`, which is granted only to the `us_student` role. The editor's group-class picker (`assets/js/blocks.js`) calls that endpoint, so an administrator or instructor editing a page got a `rest_forbidden` 403 and the JS `.catch` fell back to an empty array — a blank picker with no visible error.
## Change
- `OfferingEndpoint::canBook()` becomes `canRead()` and accepts `book_lesson` **or** `manage_offerings`. Still login-only; there is no anonymous consumer.
- The listing itself is untouched: active offerings only, public ones plus the invite-only classes the caller has been granted, with the e-transfer email omitted.
- Corrected the `GET /offerings` row in `docs/features/offerings.md`, which claimed the endpoint was public.
Instructors now see every studio group class in the picker rather than just their own, which matches what the block actually renders.
## Tests
Four permission tests added to `tests/Unit/Offering/OfferingEndpointTest.php`: student with `book_lesson`, manager with `manage_offerings` and no `book_lesson`, logged-in user with neither, and a logged-out visitor.
- `composer test` — 633 tests, 1812 assertions, all passing
- `composer lint` — no errors
- `composer cs` — clean
Closes #121
🤖 Generated with [Claude Code](https://claude.com/claude-code)
The block editor's group-class picker fetches GET /offerings, whose
permission callback only accepted book_lesson — a capability held by
students alone. Administrators and instructors editing a page were
rejected with a 403 and the picker silently rendered an empty list.
Read access now accepts book_lesson or manage_offerings. The listing is
unchanged: active offerings only, public ones plus the invite-only
classes the caller has been granted, without the e-transfer email.
Closes#121
Co-Authored-By: Claude Opus 5 <[email protected]>
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Fixes the empty group-class dropdown in the page editor.
Problem
GET /wp-json/us-scheduler/v1/offeringsguarded its listing withbook_lesson, which is granted only to theus_studentrole. The editor's group-class picker (assets/js/blocks.js) calls that endpoint, so an administrator or instructor editing a page got arest_forbidden403 and the JS.catchfell back to an empty array — a blank picker with no visible error.Change
OfferingEndpoint::canBook()becomescanRead()and acceptsbook_lessonormanage_offerings. Still login-only; there is no anonymous consumer.GET /offeringsrow indocs/features/offerings.md, which claimed the endpoint was public.Instructors now see every studio group class in the picker rather than just their own, which matches what the block actually renders.
Tests
Four permission tests added to
tests/Unit/Offering/OfferingEndpointTest.php: student withbook_lesson, manager withmanage_offeringsand nobook_lesson, logged-in user with neither, and a logged-out visitor.composer test— 633 tests, 1812 assertions, all passingcomposer lint— no errorscomposer cs— cleanCloses #121
🤖 Generated with Claude Code