Download the PHP package carnegielearning/ldap-orm-bundle without Composer
On this page you can find all versions of the php package carnegielearning/ldap-orm-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download carnegielearning/ldap-orm-bundle
More information about carnegielearning/ldap-orm-bundle
Files in carnegielearning/ldap-orm-bundle
Package ldap-orm-bundle
Short Description Another LDAP ORM for Symfony2
License GPL
Informations about the package ldap-orm-bundle
Carnegie Learning LdapOrm
A Symfony bundle that provides ORM over LDAP.
This code is based upon Ucsf Ldap Orm which in turn is based on Mathieu Goulin's GorgLdapOrmBundle.
We are forever indebted to them for providing an excellent base for the work we've continued at Carnegie Learning. Originally we forked UcsfLdapOrm, however we found many improvements and wanted to give back to the community.
What's changed and/or been added so far:
- Added the
LdapEntity
class. This is a Symfony entity which represents thetop
LDAP object class. - Added many subclasses of
LdapEntity
to describe the object classes fromtop
down toInetOrgPerson
. - Added
Repository::filterByComplex()
which gives the entity manager/repository the ability to filter with custom constructed, complex boolean logic. (See code comment API documentation for details.) - Removed the dependency upon TWIG at all.
Installation
Requires PHP5.5+ and Symphony 2.8+
- Add with composer
composer require carnegielearning/ldap-orm-bundle
- Add the bundle to AppKernel.php
new CarnegieLearning\LdapOrmBundle\CarnegieLearningLdapOrmBundle()
- Install using composer
$ composer update carnegielearning/ldap-orm-bundle
Testing Requirements
It is suggested that you run the unit tests using grunt. This will allow for an in memory ldap server to be stood up in place and facilitate file watching as well.
- Install Node.js and npm
- Install Grunt into the global namespace. Refer to the grunt documentation for help.
- Run the installation for npm.
- Be sure that a java binary exists within the development environment. Please refer to the ldap sdk form more information.
- Run grunt. This will run a file watcher that watches for changes in the source folders/files as well as test folders/files. To exit be sure to use ctrl-c as this will kill the in-memory-ldap server
- It is possible to also run just the unit tests with out the file watcher portion. This can be accomplished with
Documentation
Develop with LdapOrm
Configure an LDAP service in config.yml
- uri: The URI you need for connecting to the LDAP service.
- __use_tls__: 'true' or 'false' to decide on connecting with TLS
- __bind_dn__: The DN for binding to the LDAP service
- password: The password associated with the given bind DN
- __password_type__:
sha1
orplaintext
. I use plaintext when the URI is LDAPS.
Dependency injection for LDAP Entity Managers and Services
Creating Entities (usually to represent an object class)
class ComExamplePersonService {
protected $comExamplePersonRepository;
public function __construct(LdapEntityManager $entityManager) {
// Make a repo for ComExamplePerson entities
$this->comExamplePersonRepository = $entityManager->getRepository(ComExamplePerson::class);
// Make a another repo for SomethignElse entities (just another example...)
$this->somethingElseRepository = $entityManager->getRepository(SomethingElse::class);
...
}
public function getPersonByUid($uid, $includeAddress = false, $attributes = null) {
$person = $this->comExampePersonRepository->findByUid($uid, $attributes);
...
return $person;
}
` class PeopleController extends Controller {
/**
* @Route("/person/detail/{uid}")
* @Template()
*/
public function detailAction(Request $request, $uid)
{
$comExamplePersonService = $this->get('comexample_person_service');
$person = $comExamplePersonService->getPersonByUid($uid);
...
return array('person' => $person);
}
## To do
1. ~~Remove need for generic LDAP config~~
2. ~~Configuration documentation~~
3. ~~Development example~~
4. Rewrite test suite (In progress...)
5. Remove deprecated search results iterator