Thanks to visit codestin.com
Credit goes to github.com

Skip to content

cannot extend LDAP component #27039

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

Closed
therik opened this issue Apr 25, 2018 · 2 comments
Closed

cannot extend LDAP component #27039

therik opened this issue Apr 25, 2018 · 2 comments

Comments

@therik
Copy link

therik commented Apr 25, 2018

Q A
Bug report? no
Feature request? yes
BC Break report? no
RFC? no
Symfony version >=3.4

Hello,
I'm trying to run ldap_modify_batch() to let users change their passwords in Active Directory, but the LDAP component won't let me get the $resource for it, all the fields and getters are private. I can't see any easy way to extend this or even just get the resource so I can call the function directly.

Is there a way to extend it that I'm missing, or a way to get the resource out?

@mablae
Copy link
Contributor

mablae commented Apr 26, 2018

@xabbuh How to implement this?

Having a ManipulationInterface with concrete implementations for Remove/Update/Add and ManipulationCollectionInterface and a new method "executeBatch" on EntryManagerInterface ?

@heiglandreas
Copy link
Contributor

Without having deep knowledge in Symfony I'D test this:

Instead of invoking LDAP::create() I'd create the LDAP-Instance by calling new LDAP($adapter) where $adapter = new Symfony\Component\Ldap\Adapter\ExtLdap\Adapter($config). This adapter contains the method Adapter::getConnection() which should return a connection-object that itself has a getResource-method.

So the complete code might look something like this:

$adapter = new  Symfony\Component\Ldap\Adapter\ExtLdap\Adapter($config)
$ldap = new Ldap($adapter);
$ldap->bind();
$resource = $adapter->getConnection()->getResource();

Then you can use $resource for the ext-ldap calls.

I'm not sure whether the middle two lines are needed at all…

But as I said, I have no deep symfony experience, so perhaps someone else might want to chime in here to tell you the "proper" way to do it 😉

fabpot added a commit that referenced this issue May 18, 2018
…ablae)

This PR was merged into the 4.2-dev branch.

Discussion
----------

[LDAP] Add "applyOperations" method to EntryManager

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #27039
| License       | MIT
| Doc PR        | symfony/symfony-docs#9715

This PR adds a new method called `applyOperations` to the LDAP `EntryManager` class.
Internally it is mapping the new `UpdateOperation` object to the `ldap_modify_batch` method.

Tests green against openldap.

Thanks for any feedback.

Todo:

  * [x] Add Docs PR

Commits
-------

8fc09c7 Add applyOperations batch method to EntryManager
@fabpot fabpot closed this as completed May 18, 2018
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

5 participants