Add role to active user

I’ve gone looking but can’t seem to fine the method or proper syntax, to edit a user role assignment. I need to assign a specific role to them.

I see this in the manual

# Retrieve the user we're going to edit.
userToChange = system.user.getUser("default", "george")
# Make a change to the user. In this case, we're adding some contact info.
contactInfo = {"email":"","sms": "5551212"}
# Edit the user. Because the user object we're passing in has a user name, the function
# already knows which user to edit.
system.user.editUser("default", userToChange)

Is it as simple as user.addRoles()? if so do I pass in a singular role or do I have to pass in the updated role sequence?

This page in the manual has some relevant examples: system.user.getNewUser - Ignition User Manual 8.1 - Ignition Documentation

Relevant snippet:

# We can add a role. If the role doesn't already exist, user save will fail, depending on user source.
# We can add a lot of roles.
roles = ["Administrator", "prisoner"]
# We can remove a role.
1 Like

It’s nice that you guys give prisoners login rights