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

LDAP: Get more informations from account #28873

Closed
henri9813 opened this issue Oct 15, 2018 · 1 comment
Closed

LDAP: Get more informations from account #28873

henri9813 opened this issue Oct 15, 2018 · 1 comment

Comments

@henri9813
Copy link

Description
Actually, the ldap security component described here: https://symfony.com/doc/current/security/ldap.html

return only a username.

It could be funny to get more data like, email address, or other..

Example

providers:
        my_ldap:
            ldap:
                service: Symfony\Component\Ldap\Ldap
                base_dn: "ou=MyOU,ou=Users,dc=myldap,dc=com"
                search_dn: "cn=MyOU,dc=mydap,dc=com"
                search_password: "mySuperPassword"
                default_roles: ROLE_USER
                uid_key: cn

               #Additionnal data 
               email_field: email
               first_name: firstname
               last_name: lastname

Example in twig:

<a href="/profile">{{ app.user.firstname }} {{ app.user.lastname }} 

A cool things that i wanna done if that could exist, it to load gravatar images from the email that this new feature could give me..

Thank you ! :)

@Simperfit
Copy link
Contributor

@henri9813 do you want to work on this ?

@fabpot fabpot closed this as completed Jun 22, 2019
fabpot added a commit that referenced this issue Jun 22, 2019
…fit)

This PR was merged into the 4.4 branch.

Discussion
----------

[Ldap] Add users extraFields in ldap component

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes <!-- please update src/**/CHANGELOG.md files -->
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | yes <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->
| Fixed tickets | #28873, #19329 <!-- #-prefixed issue number(s), if any -->
| License       | MIT
| Doc PR        | todo when validated, before merge <!-- required for new features -->

As I'm using ldap too in some personal project, It seems that this feature is a really good nice to have IMHO.

Adding the wanted field in the `user_metadata` array transform them as field -> value in the `metadata` field of the user.

Commits
-------

bcfff04 [Ldap] Add users extra_fields in ldap component
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants