I’m trying to make an easy was to adjust what rosters a user is on. Currently we can use the built in roster template, and that works for now. But I would like to make it easier for the end users.
What I want to do is 3 things:
- Find out the current user
- Display all the rosters that user is in
- Be able to make changes and save back to the roster
Here’s the most basic example code example, without all the extra code connecting it to the display elements:
#In Perspective:
#1. Get current user name (Doesn't work)
# The call in Vision isn't available in Perspective
# system.security.getUsername()
# Closest I can find, gets all users currently on system, but I can't tell who I am from the script
system.perspective.getSessionInfo()
#2. Display rosters (Works)
rosters = system.roster.getRosters()
#3. Save rosters (Works)
system.roster.removeUsers(b, [user])
system.roster.addUsers(b, [user])
#In Vision:
#1. Get current user name (Works)
system.security.getUsername()
#2. Display rosters (Works)
rosters = system.alarm.getRosters()
#3. Save rosters (Doesn't work)
# System.roster is only available in Perspective, so these calls fail
system.roster.removeUsers(b, [user])
system.roster.addUsers(b, [user])
I’ve searched through the API, and can’t tell if I’m just missing something, or it’s just not possible to do this way currently.