Can you map authenticated user to security levels using script?

We use Idp for user to login as a general user.
On the other hand, we use external database, for user management - which user have what roles and have what privileges.

But Also nice to use Ignition built it security levels..
I am curious if it is possible, to map the currently logged user, to security levels, using script?
Example:
If user is "John Doe" set "UpperManagement" Level to True.