Getting the role of a user


#1

Hi,
I want to get the role of a logged in user in my custom script using V8js. How can I proceed?

Thanks in advance.


#2

When you make a POST or GET request to /user/session for a non-admin user it’ll return the role_id.

You can use platform.api.get(“user/session”) in your script. The role needs to allow script access for GET on /user/session.


#3

Thanks @toddappleton. That worked.