@@ -70,18 +70,17 @@ Event payload
7070 " subject" : " <namespaced subject key, e.g. user^alice>" ,
7171 " role" : " <namespaced role key, e.g. role^instructor>" ,
7272 " scope" : " <namespaced scope key, e.g. course-v1^course-v1:Org+Course+Run>" ,
73- " actor " : " <username of the caller, or None for system actor>" ,
73+ " actor_id " : < database ID of the caller ( int ) , or None for system actor> ,
7474 }
7575
7676The actor is resolved from `` django_crum.get_current_user()`` at API call time. No callers
77- need to pass ``actor= `` explicitly. The username is stored as a plain string rather than a
78- reference to the ``User `` record, so attribution is preserved even if the user is deleted.
77+ need to pass `` actor_id=`` explicitly.
7978
8079Audit table
8180---------- -
8281
8382`` RoleAssignmentAudit`` mirrors the event payload. Registered in Django admin, filterable by
84- user, role, scope, actor , and timestamp.
83+ user, role, scope, actor_id , and timestamp.
8584
8685Subject, role, and scope are stored as plain namespaced key strings (e.g. `` user^ alice`` ,
8786`` role^ instructor`` , `` lib^ lib:Org1:lib1`` ). There are no FK references to live `` Subject`` ,
@@ -141,12 +140,11 @@ Consequences
141140# . **Events are best-effort.** If the audit write fails, the Casbin policy is still durable.
142141 Consumers requiring guaranteed delivery must implement their own retry logic.
143142
144- #. **``actor`` is nullable. ** Non-request contexts (management commands, background tasks)
145- record ``None ``, logged as a system operation. ``actor `` is stored as a plain username
146- string rather than a FK to ``User ``. Attribution is preserved unconditionally: deleting
147- or retiring a user does not affect existing audit records. This also avoids a dependency
148- on the ``User `` table from the audit log, keeping audit records fully independent from
149- live data.
143+ # . **``actor_id`` is nullable.** Non-request contexts (management commands, background tasks)
144+ record `` None `` , logged as a system operation. `` actor_id`` is stored as a plain integer
145+ (the database ID of the caller) rather than a FK to `` User`` . This avoids a dependency
146+ on the `` User`` table and keeps audit records fully independent from live data. Attribution
147+ is preserved unconditionally: deleting or retiring a user does not affect existing records.
150148
151149# . **Audit records are independent from live authorization state.** Deleting a subject,
152150 scope, or role does not remove its audit history. Records may reference identifiers that
0 commit comments