Projet

Général

Profil

0001-Add-new-setting-for-LDAP-paged-results-size.patch

Florent Angebault, 07 juin 2022 17:18

Télécharger (2,14 ko)

Voir les différences:

Subject: [PATCH] Add new setting for LDAP paged results size

 src/authentic2/backends/ldap_backend.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
src/authentic2/backends/ldap_backend.py
451 451
        'user_filter': 'uid=%s',  # will be '(|(mail=%s)(uid=%s))' if
452 452
        # A2_ACCEPT_EMAIL_AUTHENTICATION is set (see update_default)
453 453
        'sync_ldap_users_filter': '',
454
        'page_size': 100,
454 455
        'user_basedn': '',
455 456
        'group_basedn': '',
456 457
        'member_of_attribute': '',
......
1612 1613
    @classmethod
1613 1614
    def paged_search(cls, conn, *args, **kwargs):
1614 1615
        COOKIE = ''
1615
        PAGE_SIZE = 100
1616
        PAGE_SIZE = kwargs.pop('page_size', 100)
1616 1617
        CRITICALITY = True
1617 1618
        first_pass = True
1618 1619
        pg_ctrl = SimplePagedResultsControl(CRITICALITY, PAGE_SIZE, COOKIE)
......
1635 1636
        user_filter = cls.get_sync_ldap_user_filter(block)
1636 1637
        attribute_names = cls.get_ldap_attributes_names(block)
1637 1638
        results = cls.paged_search(
1638
            conn, user_basedn, ldap.SCOPE_SUBTREE, user_filter, attrlist=attribute_names
1639
            conn, user_basedn, ldap.SCOPE_SUBTREE, user_filter, attrlist=attribute_names, page_size=block.get('page_size')
1639 1640
        )
1640 1641
        backend = cls()
1641 1642
        for dn, attrs in results:
......
1701 1702
            )
1702 1703
            user_filter = cls.get_sync_ldap_user_filter(block)
1703 1704
            results = cls.paged_search(
1704
                conn, basedn, ldap.SCOPE_SUBTREE, user_filter, attrlist=attribute_names
1705
                conn, basedn, ldap.SCOPE_SUBTREE, user_filter, attrlist=attribute_names, page_size=block.get('page_size')
1705 1706
            )
1706 1707
            for dn, attrs in results:
1707 1708
                data = attrs.copy()
1708
-