Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • funkwhale funkwhale
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 391
    • Issues 391
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 17
    • Merge requests 17
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • funkwhale
  • funkwhalefunkwhale
  • Issues
  • #1495

Closed
Open
Created Jun 05, 2021 by Harald Eilertsen@nighthawk

Consider making ldap an optional dependency

What is the problem you are facing?

I'm not using ldap for anything at all on my server, so it would be nice if the dependencies to ldap could be made optional.

What are the possible drawbacks or issues with the requested changes?

Another configuration to test.

Context

I've tried to remove the dependence on ldap manually in my funkwhale instance, and have not seen any ill effects so far. Mind you, this is a small one-user instance, so may not be the typical setup.

Here's the patches I have applied:

api/funkwhale_api/users/models.py:

--- extracted/api/funkwhale_api/users/models.py 2021-05-19 13:34:42.000000000 +0000
+++ api/funkwhale_api/users/models.py   2021-06-05 10:15:44.815483000 +0000
@@ -17,7 +17,7 @@
 from django.utils.translation import ugettext_lazy as _
 
 from allauth.account.models import EmailAddress
-from django_auth_ldap.backend import populate_user as ldap_populate_user
+# from django_auth_ldap.backend import populate_user as ldap_populate_user
 from oauth2_provider import models as oauth2_models
 from oauth2_provider import validators as oauth2_validators
 from versatileimagefield.fields import VersatileImageField
@@ -451,7 +451,7 @@
     return federation_models.Actor.objects.create(user=user, **args)
 
 
-@receiver(ldap_populate_user)
-def init_ldap_user(sender, user, ldap_user, **kwargs):
-    if not user.actor:
-        user.actor = create_actor(user)
+# @receiver(ldap_populate_user)
+# def init_ldap_user(sender, user, ldap_user, **kwargs):
+#     if not user.actor:
+#         user.actor = create_actor(user)

api/requirements/base.txt:

--- extracted/api/requirements/base.txt 2021-05-19 13:34:42.000000000 +0000
+++ api/requirements/base.txt   2021-06-05 10:11:25.015889000 +0000
@@ -53,8 +53,8 @@
 pyOpenSSL~=19.1.0
 
 # for LDAP authentication
-python-ldap~=3.3.0
-django-auth-ldap~=2.2.0
+#python-ldap~=3.3.0
+#django-auth-ldap~=2.2.0
 
 pydub~=0.24.0
 pyld~=1.0.0
Assignee
Assign to
Time tracking