Skip to content
This repository was archived by the owner on Jul 24, 2023. It is now read-only.
This repository was archived by the owner on Jul 24, 2023. It is now read-only.

Can not get all the users from AD group #757

Open
@oztinaz

Description

@oztinaz
  • Laravel Version: 5.5
  • Adldap2-Laravel Version: 8.1.5
  • PHP Version: 7.2.20
  • LDAP Type: ActiveDirectory

Description:

I have an AD group with so many members (I don't know the exact amount but it's around 70k).
I can get all users from cli via using ldapSearch and it takes 3-4 seconds but I need to get them in Laravel. I can get 2000 of the with the code below.

foreach ($this->adldap->getProviders() as $key => $provider) {
            /** @var Provider $provider */
            $adldapUsers = $provider->connect()->search()->users()->get();
        }

But of course I want to get them all. I've already tried #82, #624, #333 and Adldap2/Adldap2#590 solution offers, yet still couldn't find my way.

I've also tried the code below to get all users by their uidnumber, but actually I don't want to do that. I want something more accurate, more generic.

Initial values of $from and $to are respectively 0, 1000

foreach ($this->adldap->getProviders() as $key => $provider) {
            $counter = 0;
            $adldapUsers = [];
            while ($counter < 5) {
                /** @var Provider $provider */
                $tmp = $provider->connect()->search()->users()->whereBetween('uidnumber', [$this->from, $this->to]);
                if (empty($tmp)) {
                    $counter++;
                } else {
                    $counter = 0;
                }
                array_push($adldapUsers, $tmp);
                $this->from = $this->to + 1;
                $this->to *= 2;
            }
        }

Can you help me?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions