Skip to content

Package: policy-lifecycle

Generated from api/packages/policy-lifecycle

Source: api/packages/policy-lifecycle. The sections after the README are extracted from the code on every docs build.

Policy lifecycle (Phase 6.1 of docs/ROADMAP-PROMPT.md, ADR 0140, plan docs/plans/phase-6-remaining.md 4.3). A policy owner uploads a policy, names the departments that must be trained on it, and gets one Course Builder course per department, each lesson and quiz question citing the policy text. The owner reviews and publishes the courses in the Studio, approves the first version, and sees who is assigned, who finished and which policy version their certificate certifies.

AI proposes, the owner approves: the package only prepares each department’s Course Builder session up to the outline review; approving outlines, generating, applying and publishing are the builder’s own reviewed steps, and approving the policy version is an explicit owner action. No AI decides who must take a course or whether anyone completed it.

  • Tables: policies, policy_versions (the uploaded files, privately stored), policy_variants (department, audience group, Course Builder session and source, LMS course, enrolment path and rule), policy_certificates (an issued certificate tied to the policy version in force; templates-pdf is not changed).
  • Permissions: policy_manage (all policies) and policy_owner (policies the user owns). The admin role gets both.
  • API: /api/admin/policies (list, create, show, versions, variants, generate, approve, dashboard, CSV export).
  • Departments run one after the other (a builder author may have two AI runs at a time); the cost estimate per department is shown on the policy before anything is generated.
  • Approval enrols each department’s group through a compliance rule (group equals <name>) on a one-course path, so reminders, escalation, certificates and the compliance reports apply unchanged.
  • Every state change is written to the Living Course audit chain (policy.* actions).
  • Policy changes (P6R-9): a new file is a new revision of each department’s source; Living Course proposes the updates, the owner reviews and approves, all department courses are updated, then certificates linked to the previous version are revoked and those people get the exam course (minor) or the course (major) through compliance (policy_change source). The class is suggested from the proposals. Tables policy_rollouts, policy_reassignments. E-mails, in-app notices and webhooks policy.change.approved, policy.retraining.assigned.

Install: registered in api/config/app.php; run the migrations and PolicyPermissionSeeder (part of PermissionsSeeder). Tests: php artisan test --testsuite policy-lifecycle.

Method Path Auth Action
GET /api/policies/my-changes yes LearnerController@mine
GET /api/admin/policies yes PolicyController@index
POST /api/admin/policies yes PolicyController@store
GET /api/admin/policies/{policy} yes PolicyController@show
GET /api/admin/policies/{policy}/versions yes PolicyController@versions
POST /api/admin/policies/{policy}/versions yes VersionController@store
GET /api/admin/policies/{policy}/versions/{number} yes VersionController@show
GET /api/admin/policies/{policy}/variants yes VariantController@index
POST /api/admin/policies/{policy}/variants/generate yes VariantController@generate
GET /api/admin/policies/{policy}/variants/{variant}/academy yes AcademyController@show
POST /api/admin/policies/{policy}/variants/{variant}/academy yes AcademyController@store
DELETE /api/admin/policies/{policy}/variants/{variant}/academy yes AcademyController@destroy
POST /api/admin/policies/{policy}/versions/{number}/approve yes VersionController@approve
POST /api/admin/policies/{policy}/versions/{number}/reject yes VersionController@reject
GET /api/admin/policies/{policy}/dashboard yes DashboardController@show
GET /api/admin/policies/{policy}/dashboard/export yes DashboardController@export
Permission Seeded for roles Constant
policy_manage PolicyPermissionsEnum::MANAGE
policy_owner PolicyPermissionsEnum::OWNER

Registered with AdministrableConfig::registerConfig (editable in the admin panel under Configuration → Settings).

None.

Event Description Notification templates
CertificateRevokedNotice Tells the holder that a certificate of theirs was revoked, with the reason the revoker gave. Not sent for the certificates a policy change supersedes: that learner gets the retraining notice, which says so.
PolicyChangeApproved A new policy version was approved and rolled out. The recipient is the policy owner; departments counts, per department, the certificates revoked and the people reassigned.
PolicyRetrainingAssigned A learner’s certificate was superseded by an approved policy change and they were given an exam (minor change) or the course (major change). The recipient is the learner; summary is the source diff in one factual sentence.

None.

None.

POLICY_ACADEMY_TEMPLATE