Role event retention
Role event retention deletes role events older than seven years. It never deletes a role event that has not yet been forwarded to the audit store.
At a glance
| Batch class | MGCWardenAuditRoleEventRetention |
| Menu item | MGCWardenAuditRoleRetentionMenuItem, label Role event retention |
| Menu path | System administration → Setup → Role event retention |
| Who may run it | MGCWardenAuditAdministrationPriv (granted at Delete) → MGCWardenAuditAdministrationDuty → Warden audit administrator (MGCWardenAuditAdministrator). The API operation MGCWardenBatchService.runAuditRoleRetention is granted on the same privilege and re-checks the same menu item |
| Feature toggle | None. Retention is an obligation, not reporting; MGCWardenAuditReportingFeature's own summary names this class as one the toggle must never govern |
| Company scope | Per legal entity. MGCWardenAuditRoleEvent is a per-company table and the run reads only the company it runs in. Schedule it in every company where role capture runs |
| Scheduled by default | No. Nothing in the product creates a batch job for it |
| Recurrence | You choose. The floor is measured in months, so anything from daily to monthly removes rows within that margin of the seven-year point |
| Setup-gap rules watching it | RoleRetentionNotScheduled (code ROLERETENTION): no job of this class carries a recurrence in this company, while Warden Evidence & Compliance is on or role events are already kept here. Only a recurrence in this company clears it |
| Run record | None. The batch log carries one summary line |
| Overlap guard | Not guarded by MGCWardenBatchOverlapGuard |
Purpose and business justification
Role events contain personal data (who received which role). Keeping them for ever is a data minimisation failure; deleting them early loses access-control evidence. The class fixes a hard, audit-grade floor of seven years. It is not configurable.
It is the only sanctioned deleter of role events: MGCWardenAuditRoleEvent.delete() throws by design.
How and when it is triggered
- Scheduled from the menu item, with a recurrence, per company.
- Run now from the same menu item.
canRunInNewSession()returns true. - API:
MGCWardenBatchService.runAuditRoleRetention.
Configuration and scheduling options
None. No dialog fields (pack() returns conNull()) and no parameter is read. The cutoff is
DateTimeUtil::addMonths(DateTimeUtil::utcNow(), -84).
What it does
- Computes the cutoff: now less 84 months.
- In one transaction, selects every role event in this company with
EventDateTimebefore the cutoff andStoreForwarded = Yes, and deletes each withskipDeleteMethod(true)anddoDelete(). - Writes Warden role-event retention: N row(s) beyond the 7-year floor purged (store-forwarded rows only).
EventDateTime is the time role capture noticed the change, not the time of the grant.
Transaction boundary. The whole purge is one transaction. A failure rolls all of it back.
Idempotency. A second run finds nothing more to delete until more rows pass the floor.
Dependencies and prerequisites
- Role capture running in the same company, or there is nothing to retain.
- Role events forwarded to the store. A row whose forward failed is kept indefinitely.
Inputs and outputs
| Direction | Table | What |
|---|---|---|
| Reads, deletes | MGCWardenAuditRoleEvent | Forwarded rows older than 84 months |
| Inserts | MGCWardenExecutionException | One Error if the run fails |
The copy of each role event in the audit store is not touched. It is governed by the audit retention classes and the dual-control purge.
Logging and monitoring
- Batch history: the summary line above.
- Execution exceptions: Role-event retention batch failed, document key
ROLE-RETENTION. - Setup gaps:
RoleRetentionNotScheduledwhen role events are captured or kept in this company and the batch has no recurrence here. No health rule watches this batch.
Errors, recovery and troubleshooting
| Symptom | Cause and recovery |
|---|---|
| Error exception Role-event retention batch failed | The transaction rolled back; nothing was deleted. There is no Retry handler; run it again once the cause is fixed |
| Old role events are not removed | Either the batch is not scheduled in that company (its setup gaps page shows RoleRetentionNotScheduled), or the rows have StoreForwarded = No. Unforwarded rows are kept by design |
The class does not implement BatchRetryable, and run() catches every failure itself.
Impact on other functionality
- Evidence packs for a period more than seven years back no longer list those role changes from the role event table.
- Erasure. Role events on their seven-year floor are one of the retention holders that defer an erasure; see Erasure execution. This batch is what eventually releases that hold.
- Audit store. Untouched. The store copy of a role event stays until a certified purge removes it.
Related documentation
- Role event capture
- Auditor / compliance officer
- Warden retention cleanup for the Guard-side retention task
- Warden batch framework