Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If in LDAP mode, users not being assign a default role at login #8708

Merged
merged 8 commits into from
Nov 25, 2024
3 changes: 3 additions & 0 deletions cvat/apps/iam/signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ def create_user(sender, user=None, ldap_user=None, **kwargs):
if role == settings.IAM_ADMIN_ROLE:
user.is_staff = user.is_superuser = True
break
# don't need to add default groups for superuser
if not (user.is_superuser or user.is_staff):
user_groups.append(Group.objects.get(name=settings.IAM_DEFAULT_ROLE))

# It is important to save the user before adding groups. Please read
# https://django-auth-ldap.readthedocs.io/en/latest/users.html#populating-users
Expand Down