#3167·Archery

LDAP认证权限问题

Author: Lee-lixCreated May 10, 2026Updated May 18, 2026

重现步骤

1.配置了ldap登录,使用lDAP帐号登录后,登录正常,但是会提示没有权限 2、查询用户的组,没有组权限, 3、默认情况下,ldap登录的用户会有默认的组权限,但是登录后没有

预期外的结果

LDAP帐号登录后,没有权限

日志文本

bash
2026-05-10 13:10:59,809 - archery.settings - INFO - 认证后端:('django_auth_ldap.backend.LDAPBackend', 'django.contrib.auth.backends.ModelBackend')
[2026-05-10 13:11:13,525][MainThread:140214908163904][task_id:default][exception_logging_middleware.py:12][ERROR]- Traceback (most recent call last):
  File "/opt/venv4archery/lib/python3.11/site-packages/django/core/handlers/base.py", line 197, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv4archery/lib/python3.11/site-packages/django/contrib/auth/decorators.py", line 22, in _wrapped_view
    if test_func(request.user):
       ^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv4archery/lib/python3.11/site-packages/django/contrib/auth/decorators.py", line 78, in check_perms
    raise PermissionDenied
django.core.exceptions.PermissionDenied

2026-05-10 13:11:13,525 - default - ERROR - Traceback (most recent call last):
  File "/opt/venv4archery/lib/python3.11/site-packages/django/core/handlers/base.py", line 197, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv4archery/lib/python3.11/site-packages/django/contrib/auth/decorators.py", line 22, in _wrapped_view
    if test_func(request.user):
       ^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv4archery/lib/python3.11/site-packages/django/contrib/auth/decorators.py", line 78, in check_perms
    raise PermissionDenied
django.core.exceptions.PermissionDenied

2026-05-10 13:11:13,593 - django.request - WARNING - Forbidden (Permission denied): /sqlworkflow_list/
Traceback (most recent call last):
  File "/opt/venv4archery/lib/python3.11/site-packages/django/core/handlers/exception.py", line 56, in inner
    response = get_response(request)
               ^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv4archery/lib/python3.11/site-packages/django/core/handlers/base.py", line 197, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv4archery/lib/python3.11/site-packages/django/contrib/auth/decorators.py", line 22, in _wrapped_view
    if test_func(request.user):
       ^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv4archery/lib/python3.11/site-packages/django/contrib/auth/decorators.py", line 78, in check_perms
    raise PermissionDenied
django.core.exceptions.PermissionDenied

版本

1.14.0

部署方式

Docker

是否还有其他可以辅助定位问题的信息?比如数据库版本等

LDAP配置如下: ENABLE_LDAP=True AUTH_LDAP_ALWAYS_UPDATE_USER=true AUTH_LDAP_USER_ATTR_MAP=username=cn,display=displayname,email=mail AUTH_LDAP_SERVER_URI="ldap://" AUTH_LDAP_BIND_DN='' AUTH_LDAP_BIND_PASSWORD='' AUTH_LDAP_USER_SEARCH_BASE='' AUTH_LDAP_USER_FLAGS_BY_GROUP="{ 'is_active': '****' }"