DirectoryTree / LdapRecord-Discussions

A place to ask questions, get help, or share what you've built with LdapRecord.
4 stars 1 forks source link

Allow access only to two users or more or only group #9

Closed salim114 closed 4 years ago

salim114 commented 4 years ago

Hi,

I am facing an issue with restricted users or group access using Laravel, i can allow juste one user by doing this : LDAP_BASE_DN="uid=gauss,dc=example,dc=com" (please check picture)

ldappic

My questions is: 1 - how to do so allowing two or three users only ? 2 - how to allow only one group like (ou=mathematicians) when using OpenLdap https://www.forumsys.com/tutorials/integration-how-to/ldap/online-ldap-test-server/ for example ? 3 - do we manage my issues in simply working only with .env file ?

Best regards.

stevebauman commented 4 years ago

Hi there @salim114,

  1. You would use an authentication rule and have a whitelist of users that are allowed to authenticate:

    https://ldaprecord.com/docs/laravel/auth/configuration/#rules

  2. You would use a model scope, which constricts the LDAP search to only include results inside a specific Organizational Unit:

    https://ldaprecord.com/docs/laravel/usage/#scopes

  3. Not sure what you mean. I will need you to elaborate on this so I can understand further.

Hope this helps! Closing this since those docs will guide you on the creation of scopes and auth rules. Comment back if you need an example or further assistance and I'd be happy to help 👍

salim114 commented 4 years ago

Thank you very much @stevebauman you already did a lot by your contribution with Adldap2 and LdapRecord i'll be keep in touch

stevebauman commented 4 years ago

Happy to help @salim114! Thanks so much for your kind words! 😄 ❤️