Include state in service group sync.

The "empty" group will never appear as all users have a state so it has been removed.

I haven't yet found a good way to apply this to Teamspeak - perhaps go back to the token generation logic and create one with a user's state instead of "Member" and exempt those names from group sync?

Addresses #950
This commit is contained in:
Adarnof
2018-02-21 17:11:22 -05:00
parent 6f7cf8805d
commit 4d194457d8
7 changed files with 7 additions and 21 deletions

View File

@@ -40,11 +40,9 @@ class Phpbb3Tasks:
user = User.objects.get(pk=pk)
logger.debug("Updating phpbb3 groups for user %s" % user)
if Phpbb3Tasks.has_account(user):
groups = []
groups = [user.profile.state.name]
for group in user.groups.all():
groups.append(str(group.name))
if len(groups) == 0:
groups.append('empty')
logger.debug("Updating user %s phpbb3 groups to %s" % (user, groups))
try:
Phpbb3Manager.update_groups(user.phpbb3.username, groups)