Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

function members() bug #109

Open
itouchdennis opened this issue May 18, 2016 · 0 comments
Open

function members() bug #109

itouchdennis opened this issue May 18, 2016 · 0 comments

Comments

@itouchdennis
Copy link

Returns no member, if there is just one member in the given group.

Hint: if there is only 1 member there, the $group['member'] is not an array.
One possible fix:

`
public function members($group, $fields = [])
{
$group = $this->find($group);

    if (is_array($group) && array_key_exists('member', $group)) {
        $members = [];

        if(!is_array($group['member'])) {
            $group['member'] = [$group['member']];
        }

        foreach ($group['member'] as $member) {
            $members[] = $this->adldap->search()
                ->setDn($member)
                ->select($fields)
                ->where('objectClass', '=', 'user')
                ->where('objectClass', '=', 'person')
                ->first();
        }

        return $members;
    }

    return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant