Where to use system.security.getRoles()

I am hoping to use,

if any(role.startswith(security_prefix) for role in system.security.getRoles()):

in a onStartup script but I just get the error,

AttributeError: 'com.inductiveautomation.ignition.common.script.Imm' object has no attribute 'getRoles'

Not sure why, all the examples I see of this being used are in event scripts - where am I supposed to be able to use this?

Those functions are documented for use with Vision, not Perspective. You will want to examine your session properties in Perspective.

Okay, I had a small feeling but couldn't be sure. Now that you mention it I actually do see where it specifies on the documentation site.

Consider looking in the session properties for the current authenticated user's info.