Skip to content

Commit

Permalink
Merge pull request #307 from openimis/feature/test-login
Browse files Browse the repository at this point in the history
fix CI on group auto provisioning
  • Loading branch information
delcroip authored Jun 5, 2024
2 parents 6512cf7 + 2147ab0 commit 94c2544
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions core/models/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,13 @@ def auto_provision_user(self, **kwargs):
user.i_user = i_user
user.save()
if core.auto_provisioning_user_group:
group = Group.objects.get(
name=core.auto_provisioning_user_group)
user_group = UserGroup(user=user, group=group)
user_group.save()
group = Group.objects.filter(
name=core.auto_provisioning_user_group).first()
if group:
user_group = UserGroup(user=user, group=group)
user_group.save()
else:
logger.error(f"Group {core.auto_provisioning_user_group} was not found")
return user, True

def get_or_create(self, **kwargs):
Expand Down

0 comments on commit 94c2544

Please sign in to comment.