fix(events): handle nil auth when building event doers
ProjectUser.Create and friends are called with a nil auth in tests; the old interface-typed Doer just serialized as null, so a nil doer keeps that behavior (and maps to the system actor in the audit entry).
This commit is contained in:
parent
f0eff52949
commit
0eb39fae9a
|
|
@ -27,6 +27,9 @@ import (
|
|||
// flows acting on behalf of disabled accounts (e.g. user deletion), and the
|
||||
// event only needs the principal as it authenticated.
|
||||
func doerFromAuth(a web.Auth) *user.User {
|
||||
if a == nil {
|
||||
return nil
|
||||
}
|
||||
if u, is := a.(*user.User); is {
|
||||
return u
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue