How to test user's privilege level

What is the way to test a user’s privilege and username from PHP in librenms 1.56?

In previous versions I could access $_SESSION['userlevel'] and $_SESSION['user'] to test who is accessing certain plugins and their privileges,

however since I updated to librenms 1.56 these variables are not set in $_SESSION, hence my question.

This is has broken the way our plugins work, since I cannot test who wants to do what.

Thank you