[GH-ISSUE #1279] AUTH_LDAP_USER_FLAGS_BY_GROUP implementation #785

Closed
opened 2026-03-01 14:46:17 +03:00 by kerem · 3 comments
Owner

Originally created by @vladimirdulov on GitHub (Dec 5, 2023).
Original GitHub issue: https://github.com/ArchiveBox/ArchiveBox/issues/1279

Please add AUTH_LDAP_USER_FLAGS_BY_GROUP settings implementation to set values of "is_staff" and "is_superuser" for Django LDAP authenticated users.

https://django-auth-ldap.readthedocs.io/en/latest/reference.html#auth-ldap-user-flags-by-group

https://django-auth-ldap.readthedocs.io/en/latest/example.html

e.g.

AUTH_LDAP_USER_FLAGS_BY_GROUP = {
    "is_active": "cn=active,ou=django,ou=groups,dc=example,dc=com",
    "is_staff": "cn=staff,ou=django,ou=groups,dc=example,dc=com",
    "is_superuser": "cn=superuser,ou=django,ou=groups,dc=example,dc=com",
}
Originally created by @vladimirdulov on GitHub (Dec 5, 2023). Original GitHub issue: https://github.com/ArchiveBox/ArchiveBox/issues/1279 Please add AUTH_LDAP_USER_FLAGS_BY_GROUP settings implementation to set values of "is_staff" and "is_superuser" for Django LDAP authenticated users. https://django-auth-ldap.readthedocs.io/en/latest/reference.html#auth-ldap-user-flags-by-group https://django-auth-ldap.readthedocs.io/en/latest/example.html e.g. ``` AUTH_LDAP_USER_FLAGS_BY_GROUP = { "is_active": "cn=active,ou=django,ou=groups,dc=example,dc=com", "is_staff": "cn=staff,ou=django,ou=groups,dc=example,dc=com", "is_superuser": "cn=superuser,ou=django,ou=groups,dc=example,dc=com", } ```
kerem closed this issue 2026-03-01 14:46:17 +03:00
Author
Owner

@pirate commented on GitHub (Dec 6, 2023):

This sounds reasonable to add but I don't have any experience with LDAP myself, would you be willing to submit a PR for this change?

<!-- gh-comment-id:1841925384 --> @pirate commented on GitHub (Dec 6, 2023): This sounds reasonable to add but I don't have any experience with LDAP myself, would you be willing to submit a PR for this change?
Author
Owner

@vladimirdulov commented on GitHub (Dec 6, 2023):

Sure, I'll try to get a time for it.

Currently LDAP users cannot login at all as is_staff is False, at the same time the local user auth doesn't work either as it's replaced with LDAP auth (when LDAP env var is True).
As a workaround we are updating is_staff and is_superuser flags for every LDAP user using DJANGO console.
Apparently it's not convenient.

$ archivebox manage shell <<EOF
from django.contrib.auth.models import User
User.objects.filter(username='USERNAME').update(is_superuser=True, is_staff=True)
EOF
<!-- gh-comment-id:1842609012 --> @vladimirdulov commented on GitHub (Dec 6, 2023): Sure, I'll try to get a time for it. Currently LDAP users cannot login at all as `is_staff` is False, at the same time the local user auth doesn't work either as it's replaced with LDAP auth (when LDAP env var is True). As a workaround we are updating `is_staff` and `is_superuser ` flags for every LDAP user using DJANGO console. Apparently it's not convenient. ``` $ archivebox manage shell <<EOF from django.contrib.auth.models import User User.objects.filter(username='USERNAME').update(is_superuser=True, is_staff=True) EOF ```
Author
Owner

@pirate commented on GitHub (Dec 19, 2023):

I believe this is fixed now that https://github.com/ArchiveBox/ArchiveBox/pull/1281 is merged, post back here if you're still having problems and I can reopen the issue.

<!-- gh-comment-id:1861911568 --> @pirate commented on GitHub (Dec 19, 2023): I believe this is fixed now that https://github.com/ArchiveBox/ArchiveBox/pull/1281 is merged, post back here if you're still having problems and I can reopen the issue.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ArchiveBox#785
No description provided.