[PHP] using user data in plugin

Hi,

I am planning to use grav for internal purposes in my company.
Users login via Keycloak and get forwarded to grav.

My final goal is to show specific user related data from a variety of external databases.

To achieve this I created a plugin which can output php code in a twig template, like described in the docs.

To create the right queries, i will need user related data of the logged in user, e.g. user name or email.

So far i have tried to just pass on the username as a parameter to the function
{{ example_function( {{ grav.user.username }} ) }}
Unfortunately, this kind of nested use of the functions doesn’t seem to be possible.

Is there a way to access the user data directly in my TwigExtension.php?

This should be

{{ example_function(grav.user.username) }}