Need to get current user outside of user frosting


#1

I’m trying to utilize sentry in reporting errors in my sprinkles. If you don’t know, Sentry is a bug reporting application.

I’m able to set the current user in user frosting either through a singleton I can call anywhere (Sentry::setUser) or using a callback on the sentry configuration object (sendBefore)

Since either of these calls happen outside the $ci container of user frosting is there any method to call statically to get the current logged in user? Or is there a way using classMapper or extends to hook into the user() function in Authenticator.

Or is there a better way to get this information?


#2

I’m not sure if this will work or not, but could you use the currentUser service? https://learn.userfrosting.com/services/default-services#currentuser

You could override this in your custom sprinkle?