Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
code:laravel:ldap [2020/04/14 20:24] – [Importing Users] gerardorourkecode:laravel:ldap [2020/04/26 10:46] (current) – [Removing the Password column] gerardorourke
Line 1: Line 1:
 ====== Laravel AD LDAP====== ====== Laravel AD LDAP======
  
-Reference: https://ldaprecord.com/docs/laravel/quickstart/+Reference: \\ 
 +  *https://ldaprecord.com/docs/laravel/quickstart/ 
 +  *https://github.com/DirectoryTree/LdapRecord-Laravel
  
 ===== My quick Start Guide ===== ===== My quick Start Guide =====
Line 97: Line 99:
  
 ==== Importing Users==== ==== Importing Users====
-<code>php artisan ldap:import ldap --filter "(objectclass=user)"</code>+ 
 +  *Use the **--delete** option to soft delete users who have been disabled 
 +  *Use the **--delete-missing** option to delete any users not found (because they have been deleted on the AD) - be careful if not found in filter - then all existing users could be soft deleted! (can restore if necessary using a simple SQL query). 
 +  *Use the **--restore** option to un-softdelete a user if they have been reenabled. 
 + 
 +<code>php artisan ldap:import ldap --filter "(objectclass=user)" --delete-missing --delete --restore</code>
  
 Sync any users who are **Enabled** Sync any users who are **Enabled**
Line 188: Line 195:
 </code> </code>
   *If you are caching your configuration, make sure you re-run **config:cache** to re-cache your modifications.   *If you are caching your configuration, make sure you re-run **config:cache** to re-cache your modifications.
 +
 +
 +===== Removing the Password column =====
 +
 +Using the option <code> 'password_column' => false </code> allows you to remove the password column from the users table.
 +Reference: https://ldaprecord.com/docs/laravel/auth/configuration/#database-password-sync
 +
 +<code php>
 +    'providers' => [
 +
 +        'ldap' => [
 +            'driver' => 'ldap',
 +            'model' => LdapRecord\Models\ActiveDirectory\User::class,
 +            'database' => [
 +                'password_column' => false, 
 +                'model' => App\User::class,
 +                'sync_attributes' => [
 +                    'name' => 'cn',
 +                    'username' => 'samaccountname',
 +                ],
 +            ],
 +        ],
 +    ],
 +</code>
  • code/laravel/ldap.1586892245.txt.gz
  • Last modified: 2020/04/14 20:24
  • by gerardorourke