Announcement

Collapse
No announcement yet.

Handle add ldap user event

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Handle add ldap user event

    Please, I whant to execute some code when new ldap user loged in.
    Idea was to add user entity hook, but it does not work cause of

    ldaplogin.php:
    $this->entityManager->saveEntity($user, [
    // Prevent `user` service being loaded by hooks.
    SaveOption::SKIP_HOOKS => true,
    SaveOption::KEEP_NEW => true,
    ]);​
    Is it possible to handle this ?

  • #2
    I haven't tried, but I found this. On 702 line of Espo\Core\Authentication.php hook manager is used to trigger one of these hooks: ['app', 'authentication', 'onSuccessHookClassNameList'] or ['app', 'authentication', 'onSuccessByTokenHookClassNameList'].
    You can define your custom hooks and retrieve user from passed params. Then you can check whether it is ldap user and whether it was just created by utilizing createdAt field
    Last edited by a.slyzhko; 07-19-2024, 07:33 PM.

    Comment


    • #3
      Extremely huge thanks​ !
      It works.

      Comment

      Working...
      X