Description
After about an hour of work, I am finally able to successfully add a new user and then add them to an existing group. However, I was perplexed by receiving an error about the Group not being populated:
My initial code:
with server.auth.sign_in(auth):
user = TSC.UserItem('stone_cold', 'Publisher')
new_user = server.users.add(user)
gs, pi = server.groups.get()
for g in gs:
if g.name == 'Ballers':
server.groups.add_user(g, new_user.id)
Working code:
with server.auth.sign_in(auth):
user = TSC.UserItem('stone_cold', 'Publisher')
new_user = server.users.add(user)
gs, pi = server.groups.get()
for g in gs:
if g.name == 'Ballers':
server.groups.populate_users(g)
server.groups.add_user(g, new_user.id)
Why do I need to use the populate_users() method on the Group just to add a user to it? As a second issue, why is populate_users() a Groups endpoint method and not a method of the GroupItem itself, where it could be called automatically prior to the attempt to add?