I figured it out... from the main macro call in: 

   def expand_macro(self, formatter, name, content):

formatter contains the session, and the session id is the login of the 
current user:

   user  = formatter.req.session.sid


On Wednesday, May 19, 2021 at 7:35:28 PM UTC-7 SydRa wrote:

> Hi everyone, 
> I'm writing a plugin that is meant to show statistics specific to the 
> current user. Everything works fine, but I cannot figure out how to 
> determine the currently logged in user to filter the results. Is there a 
> builtin user class of env variable that contains the current user ID?
>
> Alternatively, I'm using ODIC authentication to get SSO with Office 365 on 
> this trac, and it might be possible to get the user ID from a server 
> environment variable. In php I'd do this with    usr = 
> strstr($_SERVER['OIDC_CLAIM_upn'],'@',true);
>
> Is there an equivalent in python?
>
> Thanks!
> Ralph
>
_______________________________________________
th-users mailing list
th-users@lists.trac-hacks.org
https://lists.trac-hacks.org/mailman/listinfo/th-users

Reply via email to