Commit 4fa25981 authored by Lukas Burgey's avatar Lukas Burgey

Fix a bug in the userinfo updating

parent 4780bd9b
...@@ -268,23 +268,24 @@ class User(AbstractUser): ...@@ -268,23 +268,24 @@ class User(AbstractUser):
LOGGER.info(self.msg('New: %s'), ent) LOGGER.info(self.msg('New: %s'), ent)
self.vos.add(ent) self.vos.add(ent)
self.user_changed_vo_added(loc_ent) self.user_changed_vo_added(ent)
def update_userinfo_groups(self, userinfo): def update_userinfo_groups(self, userinfo):
if self.idp.userinfo_field_groups is None: if self.idp.userinfo_field_groups is None:
return return
groups = userinfo.get(self.idp.userinfo_field_groups, []) local_groups = self.vos.instance_of(Group)
remote_groups = userinfo.get(self.idp.userinfo_field_groups, [])
# check if groups were removed # check if groups were removed
for group in self.vos.instance_of(Group): for group in local_groups:
if group.name not in groups: if group.name not in remote_groups:
self.vos.remove(group) self.vos.remove(group)
self.user_changed_vo_removed(group) self.user_changed_vo_removed(group)
# check if groups were added # check if groups were added
for group_name in groups: for group_name in remote_groups:
group = Group.get_group(name=group_name, idp=self.idp) group = Group.get_group(name=group_name, idp=self.idp)
# check if user needs to be in this group # check if user needs to be in this group
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment