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

Returns an instance of Entry but needs an instance of User #493

Closed
groundbreaker08 opened this issue Mar 1, 2018 · 3 comments
Closed

Returns an instance of Entry but needs an instance of User #493

groundbreaker08 opened this issue Mar 1, 2018 · 3 comments

Comments

@groundbreaker08
Copy link

groundbreaker08 commented Mar 1, 2018

  • Laravel Version: 5.6
  • Adldap2-Laravel Version: 4.0
  • PHP Version: 7.2
  • LDAP Type: EDIT - OpenLDAP

Description:

After confirming that there were no objectCategory on the filter used. (my search in ldap doesnt need objectCategory that's why it was removed)
Found out that the problem was $user instanceof User is getting a false value since the query return an instance of Entry.

It says here that this really returns a value in an instance of Entry
image

Steps To Reproduce:

We need to create a custom schema and run this in our terminal to show the die we placed temporarily on the method.
I want to search using email and an objectClass of person. The valid ldap search i used before needs a mail attribute.

` public function objectClassPerson()
{
return "somePerson";
}

public function objectCategoryPerson()
{
    return 'somePerson';
}

public function objectCategory()
{
    return 'objectclass';
}

public function employeeId()
{
    return 'uid';
}

public function commonName()
{
    return 'cn';
}

public function anr()
{
    return 'mail';
}

public function userId()
{
    return 'uid';
}`

php artisan adldap:import someEmail

@stevebauman
Copy link
Member

This sounds like you're not using ActiveDirectory. What LDAP variant are you using?

@groundbreaker08
Copy link
Author

Hi @stevebauman . just updated the LDAP type usage. and yes. it's not ActiveDirectory. and referred also this issue to #21

@stevebauman
Copy link
Member

Hi @groundbreaker08, you need to use the OpenLDAP schema in your adldap.php configuration file.

It says here that this really returns a value in an instance of Entry

This comment wasn't meant to be taken literally in the context of Adldap2 Model classes. I use the word "entry" in many comments throughout the code to refer to raw LDAP records. Even still, the Entry model is a sub-class of the base Model class and will pass this instance of check.

Once you set your schema to OpenLDAP, clear your configuration cache using php artsian config:clear and then try re-authenticating.

If you still encounter problems just let me know and I will re-open this issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants