2017 © Pedro Peláez
 

library nuldap-laravel

image

nusait/nuldap-laravel

  • Monday, June 20, 2016
  • by nusait
  • Repository
  • 6 Watchers
  • 0 Stars
  • 109 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 3 Open issues
  • 9 Versions
  • 4 % Grown

The README.md

NuLdap

This is a LDAP package meant for Northwestern University. (But can be extended for other entities), (*1)

Installation via Composer

composer require nusait/nuldap-laravel

Then update composer, (*2)

composer update

Laravel

Add the service provider to config/app.php, (*3)

Nusait\Nuldap\NuldapServiceProvider::class,

Publish the config:, (*4)

php artisan vendor:publish --provider="Nusait\Nuldap\NuldapServiceProvider" 

To use the fake Ldap, make sure to add to your .env file the line:, (*5)

ldap_fake=true

When using NuldapFake, any search will return a user with pre-filled data using Faker. Whatever search term you provide for a field will return as the value for that field, i.e. a searchNetid('asdf') will return a user with ['netid'] = 'asdf'. In order to simulate not finding a user, prepend the query with nf-, i.e. searchNetid('nf-blah') and it will not find that user., (*6)

New Instance:

$ldap = \App::make('ldap') or $ldap = app('ldap'), (*7)

Validate:

$ldap->validate($netid, $password);

returns a boolean, (*8)

Searching:

You can search by netid, email, emplid, or studentid., (*9)

$ldap->search('netid', $netid);
$ldap->search('email', $email);
$ldap->search('emplid', $emplid);
$ldap->search('studentid', $studentid);

This returns the raw ldap metadata., (*10)

You can also search using the magic methods:, (*11)

$ldap->searchNetid($netid);
$ldap->searchEmail($email);
$ldap->searchEmplid($emplid);
$ldap->searchStudentid($studentid);

Parsing User

$ldap->parseUser($ldapUser [, $transformer ]);

You can parse the raw metadata of a user to create an associative array of the user. You can pass your own transformer into the function. The transformer must implement the TransformerInterface in the Contracts folder., (*12)

The default transforms maps the following keys and value:, (*13)

return [
    'netid'       => $this->getSetValueOrNull($ldapUser, 'uid'),
    'phone'       => $this->getSetValueOrNull($ldapUser, 'telephonenumber'),
    'email'       => $this->getSetValueOrNull($ldapUser, 'mail'),
    'title'       => $this->getSetValueOrNull($ldapUser, 'title'),
    'first_name'  => $this->getSetValueOrNull($ldapUser, 'givenname'),
    'last_name'   => $this->getSetValueOrNull($ldapUser, 'sn'),
    'displayname' => $this->getSetValueOrNull($ldapUser, 'displayname'),
    'emplid'      => (int)$this->getSetValueOrNull($ldapUser, 'employeenumber'),
    'studentid'   => (int)$this->getSetValueOrNull($ldapUser, 'nustudentnumber')
];

The Versions

20/06 2016

dev-laravel50

dev-laravel50

  Sources   Download

The Requires

 

The Development Requires

by Vahid Azam

29/04 2016

dev-master

9999999-dev

  Sources   Download

The Requires

 

The Development Requires

by Vahid Azam

29/04 2016
18/04 2016