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
|
// flows acting on behalf of disabled accounts (e.g. user deletion), and the
|
||||||
// event only needs the principal as it authenticated.
|
// event only needs the principal as it authenticated.
|
||||||
func doerFromAuth(a web.Auth) *user.User {
|
func doerFromAuth(a web.Auth) *user.User {
|
||||||
|
if a == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
if u, is := a.(*user.User); is {
|
if u, is := a.(*user.User); is {
|
||||||
return u
|
return u
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue