diff --git a/karma/karma/openid.py b/karma/karma/openid.py index 844738c..0dc455b 100644 --- a/karma/karma/openid.py +++ b/karma/karma/openid.py @@ -20,3 +20,10 @@ def handle_federated_userinfo(self, user_data): pass return super().handle_federated_userinfo(user_data) + def automap_user_attrs(self, user, user_data): + super().automap_user_attrs(user, user_data) + groups = getattr(user_data, "groups", []) + for group_name in groups: + group = Group.objects.get_or_create(name=group_name)[0] + group.user_set.add(user) + group.save()