DirectoryTree / LdapRecord-Laravel

Multi-domain LDAP Authentication & Management for Laravel.
https://ldaprecord.com/docs/laravel/v3
MIT License
496 stars 52 forks source link

[Feature] Listeners Available on Import Sync #470

Closed kellerisddev closed 2 years ago

kellerisddev commented 2 years ago

Describe the feature you'd like:

I am currently using the ADLdap2/AdLdap2-Laravel package and it has support for Listeners which can be used on nightly import/sync to perform additional tasks on the User model such as syncing local roles based on AD Group membership.

'Adldap\Laravel\Events\Synchronized' => [ 'App\Listeners\ADSynchronizedUserListener', ],

'Adldap\Laravel\Events\Imported' => [ 'App\Listeners\ADImportedUsersListener', ],

I searched this package documentation and I am not seeing anything analogous to that here and It would be nice if this package had that availability as well.

stevebauman commented 2 years ago

Hi @kellerisddev,

This is my mistake -- there are many import events that are fired, but these events aren't shown in the documentation in a clear place. I'll update the import documentation now to include this, but here they are:

Event
LdapRecord\Laravel\Events\Import\Completed
LdapRecord\Laravel\Events\Import\Deleted
LdapRecord\Laravel\Events\Import\DeletedMissing
LdapRecord\Laravel\Events\Import\Imported
LdapRecord\Laravel\Events\Import\ImportFailed
LdapRecord\Laravel\Events\Import\Importing
LdapRecord\Laravel\Events\Import\Restored
LdapRecord\Laravel\Events\Import\Saved
LdapRecord\Laravel\Events\Import\Started
LdapRecord\Laravel\Events\Import\Synchronized
LdapRecord\Laravel\Events\Import\Synchronizing
kellerisddev commented 2 years ago

Thank you, I figured that you had much more invested in this that could be leveraged

stevebauman commented 2 years ago

Happy to help. I've just added these into the documentation under the "Import" docs. I've also added further docs about when each event is fired and when:

https://ldaprecord.com/docs/laravel/v2/auth/database/importing/#events

Let me know if you have any other questions or suggestions 🙏

kellerisddev commented 2 years ago

Just one thing, should the namespace be LdapRecord\Laravel\Events\Import instead of LdapRecord\Events\Import\ ?

stevebauman commented 2 years ago

🙈 Thanks @kellerisddev! You're correct -- I've just updated this. Give it a minute or so before it is visible on the website as it deploys 👍