Package: entitlements
Generated from api/packages/entitlements
Source: api/packages/entitlements. The sections after the README are extracted from the code on every docs build.
README
Section titled “README”What granted a user access to a course, with validity and a unique source (ADR 0130). Phase 6.4 CM-1 and CM-2.
What it does
Section titled “What it does”-
entitlementstable:subject_type/subject_id(a course),status(active,revoked,expired),valid_from,valid_until,source_type, uniquesource_key,source_ref, revocation reason. -
Source types:
order_item,admin,compliance,lti,wellms_order,migration,family(written today);seat,group_legacy,voucher_legacy(reserved, nothing writes them yet). -
EntitlementService, the only writer of purchased access:grantCourse()(idempotent bysource_key),grantManual(),revoke(),revokeAllForUser(),expireDue(),project()andhasAccess(). It reachescourse_useronly through the plainCourseAccessService, so policies, H5P and SCORM keep reading the same projection. -
EntitlementCourseAccess, a decorator onCourseAccessServiceContract: every access written by an admin, an LTI launch or a compliance assignment (AccessSourceContext::as('lti', ...), fromcourse-access) also gets an entitlement. An explicit removal revokes every entitlement of the user for the course (admin_removed). -
Revoking one entitlement removes
course_useronly when no other active entitlement remains; the latest end date wins and an open-ended entitlement beats a dated one. Progress is never deleted. -
ulams:entitlements:expire(hourly): marks lapsed entitlementsexpiredand keeps the course row, so progress survives. -
ulams:entitlements:parity(nightly once a backfill has passed): comparescourse_userwith the entitlements in force (same date rule asCourse::hasUser()), stores a report inentitlement_parity_reports, fails on any difference.--latestprints the last report. The access backfill lives in thecommercepackage (it reads the Wellms cart tables). -
Access that exists without an entitlement is adopted as a
migrationentitlement before another source changes it. -
familyentitlements (ADR 0192) are derived: the course-variants package writes one for the variant a learner uses, throughsyncDerived()(create, move the end, bring back after a lapse), so one entitlement for any course of a family covers every variant. They end with the entitlements they derive from.project()announces every recomputation with theAccessProjectedevent (ids only).
Settings
Section titled “Settings”ENTITLEMENTS_EXPIRE (default true) and ENTITLEMENTS_PARITY (default true) switch the scheduled commands.
Not yet (planned)
Section titled “Not yet (planned)”Seat pools and assignments (CM-9).
Endpoints
Section titled “Endpoints”None. The commerce package applies order events through this service; the existing admin access endpoints of
course-access now also record and revoke entitlements.
API endpoints
Section titled “API endpoints”None.
Permissions
Section titled “Permissions”None.
Settings
Section titled “Settings”Registered with AdministrableConfig::registerConfig (editable in the admin panel under Configuration → Settings).
None.
Events
Section titled “Events”| Event | Description | Notification templates |
|---|---|---|
AccessProjected |
course_user of one user and course was recomputed from the entitlements in force (granted, revoked or expired). Ids only. Listeners derive access from it, like the course-variants package does for a family of variants. |
Artisan commands
Section titled “Artisan commands”| Command | Description | Signature |
|---|---|---|
ulams:entitlements:expire |
Expire entitlements whose end date has passed | ulams:entitlements:expire |
ulams:entitlements:parity |
Check that course_user and the entitlements give every learner the same access | ulams:entitlements:parity {--latest : Print the last stored report instead of running a check} |
Scheduled jobs
Section titled “Scheduled jobs”| Kind | Target | Frequency |
|---|---|---|
| command | 'ulams:entitlements:expire' |
hourly()->withoutOverlapping() |
| command | 'ulams:entitlements:parity' |
dailyAt('03:30')->withoutOverlapping()->when(fn () => $this->backfilled()) |
Environment variables read
Section titled “Environment variables read”ENTITLEMENTS_EXPIRE, ENTITLEMENTS_PARITY