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
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions changelog.d/20241125_193231_rragundez_ldap_default_role.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
### Added

- A default role if IAM_TYPE='LDAP' and if the user is not a member of any group in 'DJANGO_AUTH_LDAP_GROUPS' (https://github.com/cvat-ai/cvat/pull/8708)
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
# add default group if no other group has been assigned
if not len(user_groups):
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
Loading