philbertphotos / osticket-multildap-auth-plugin

Plugin for OS Ticket that allows for authentication with multiple domains.
GNU General Public License v3.0
28 stars 16 forks source link

Problems on sync with osticket 1.17.3 #67

Closed buzzzo closed 1 year ago

buzzzo commented 1 year ago

Hi

Is it supposed to work with the latest version ? Sync does not work and there is no documentation on how to enable sync via cron.

More documentation would be wonderful.

Thx

philbertphotos commented 1 year ago

It works with the latest version and the sync works with just a click really it uses Osticket built in cron function if thats on and running so is LDAP sync providing that you check it on in the plugin.

buzzzo commented 1 year ago

Thx for answer.

The sync button actually does nothing (v17.1.3). Plus i see various error in logs: => /var/log/php-fpm/www-error.log <== [11-Mar-2023 22:02:36 UTC] PHP Fatal error: Uncaught OrmException: LdapMultiAuthPlugin: minDelay: Field not defined in /var/vhost/xxxx/include/class.orm.php:413 Stack trace:

0 /var/vhost/xxx/include/class.orm.php(417): VerySimpleModel->get()

1 /var/vhost/ixxxx/include/plugins/multi-ldap/auth.php(147): VerySimpleModel->__get()

2 /var/vhost/ixxxxinclude/plugins/multi-ldap/auth.php(93): LdapMultiAuthPlugin->allowAction()

3 /var/vhost/xxxx/include/class.signal.php(98): LdapMultiAuthPlugin->onCronProcessed()

4 /var/vhost/xxxx/scp/autocron.php(66): Signal::send()

5 {main}

thrown in /var/vhost/xxxinclude/class.orm.php on line 413

AND:

5 {main} thrown in /var/vhost/xxx

/include/class.orm.php on line 413 [11-Mar-2023 23:10:25 Europe/Rome] PHP Warning: Undefined array key "sync" in /var/vhost/xxxxt/scp/sync_mldap.php on line 3 [11-Mar-2023 23:10:25 Europe/Rome] PHP Fatal error: Uncaught Error: Class "LDAPMultiAuthentication" not found in /var/vhost/xxxx/scp/sync_mldap.php:16

What is seems to work is: 1) create manually user 2) register with auth type mldap 3) try to login: success

What seems to NOT work: 1) sync users from ad (is it supposed to FIRST create users from osticket and then the sync works ?)

Thx

philbertphotos commented 1 year ago

That is weird ... can you delete "/var/vhost/xxxx/scp/sync_mldap.php" just encase so the app copys over the most current version

minDelay not defined is a strange error.

philbertphotos commented 1 year ago

Oh the sync button does not work yet.. but the cron sync does ...

philbertphotos commented 1 year ago

When users try to login with their LDAP username and password it will create them for you automatically no need to add them first does the same for agents.

https://forum.osticket.com/d/96938-resolved-help-with-cronjob/3

buzzzo commented 1 year ago

After deleteting the mentioned file i've receive errors too:

==> /var/log/php-fpm/www-error.log <== [12-Mar-2023 10:09:54 Europe/Rome] PHP Warning: Undefined array key "sync" in /var/vhost/it.gci.it/scp/sync_mldap.php on line 3 [12-Mar-2023 10:09:54 Europe/Rome] PHP Fatal error: Uncaught Error: Class "LDAPMultiAuthentication" not found in /var/vhost/it.gci.it/scp/sync_mldap.php:16 Stack trace:

0 {main}

thrown in /var/vhost/it.gci.it/scp/sync_mldap.php on line 16 [12-Mar-2023 09:10:18 UTC] PHP Fatal error: Uncaught OrmException: LdapMultiAuthPlugin: minDelay: Field not defined in /var/vhost/it.gci.it/include/class.orm.php:413 Stack trace:

0 /var/vhost/it.gci.it/include/class.orm.php(417): VerySimpleModel->get()

1 /var/vhost/it.gci.it/include/plugins/multi-ldap/auth.php(147): VerySimpleModel->__get()

2 /var/vhost/it.gci.it/include/plugins/multi-ldap/auth.php(93): LdapMultiAuthPlugin->allowAction()

3 /var/vhost/it.gci.it/include/class.signal.php(98): LdapMultiAuthPlugin->onCronProcessed()

4 /var/vhost/it.gci.it/scp/autocron.php(66): Signal::send()

5 {main}

thrown in /var/vhost/it.gci.it/include/class.orm.php on line 413 [12-Mar-2023 10:10:25 Europe/Rome] PHP Warning: Undefined array key "sync" in /var/vhost/it.gci.it/scp/sync_mldap.php on line 3 [12-Mar-2023 10:10:25 Europe/Rome] PHP Fatal error: Uncaught Error: Class "LDAPMultiAuthentication" not found in /var/vhost/it.gci.it/scp/sync_mldap.php:16 Stack trace:

0 {main}

thrown in /var/vhost/it.gci.it/scp/sync_mldap.php on line 16

Question: The autocreation (auto-register) of user after login can happens only if the ad user is first synched on osticket ? (so user should exists on osticket BUT not registered)?

buzzzo commented 1 year ago

The problems for sync seems to be related to: [11-Mar-2023 22:31:07 UTC] PHP Fatal error: Uncaught OrmException: LdapMultiAuthPlugin: minDelay: Field not defined in /var/vhost/it.gci.it/include/class.orm.php:413

philbertphotos commented 1 year ago

Ok let me test it agian and get back to you in a day or two with a fix.

philbertphotos commented 1 year ago

@buzzzo the auto user creation works if the user is found in LDAP and the password syncs. They plugin runs on my network and with 5000 users and 18,000 students and user seamlessly logs in for the first time and creates the ticket. Without my intervention,

Then it syncs the account with the other information as needed in the sync cycle.

philbertphotos commented 1 year ago

@buzzzo found the problem should have a fix in a day or two.

buzzzo commented 1 year ago

@buzzzo found the problem should have a fix in a day or two.

Thx very much

buzzzo commented 1 year ago

Hi any news on this ? Thx

philbertphotos commented 1 year ago

@buzzzo its fixed ...there was a incompatibility with the new version and I had to make it backwards compatible with 1.6 to avoid making two versions. I will release it in a few hours after some debugging between the two builds.

Fe3lApAcUt commented 1 year ago

Hey @philbertphotos Kindly asking you to commit the changes or are there new issues now? Thanks and best regards

philbertphotos commented 1 year ago

@Fe3lApAcUt and @buzzzo update is uploaded sorry it took me so long. There will be minor changes over the next few weeks.

philbertphotos commented 1 year ago

I am sure there will be a few bugs with the changes that were made but I sure hope not since I have to update my live version. This has not been regression tested BUT should work.

Fe3lApAcUt commented 1 year ago

@philbertphotos Thanks for your work!

I'm getting the following error when I run the cron job:

`PHP Fatal error: Uncaught Error: Object of class stdClass could not be converted to string in C:\xampp\htdocs\helpdesk\scp\sync_mldap.php:137 Stack trace:

0 C:\xampp\htdocs\helpdesk\scp\sync_mldap.php(23): SyncLDAPMultiClass->getconfig(Object(stdClass))

1 C:\xampp\htdocs\helpdesk\include\plugins\multi-ldap\auth.php(100): SyncLDAPMultiClass->__construct(Object(stdClass))

2 C:\xampp\htdocs\helpdesk\include\class.signal.php(98): LdapMultiAuthPlugin->onCronProcessed(NULL, Array)

3 C:\xampp\htdocs\helpdesk\include\class.cron.php(122): Signal::send('cron', NULL, Array)

4 C:\xampp\htdocs\helpdesk\include\api.cron.php(15): Cron::run()

5 C:\xampp\htdocs\helpdesk\include\api.cron.php(45): CronApiController->run()

6 C:\xampp\htdocs\helpdesk\api\cron.php(23): LocalCronApiController::call()

7 {main}

thrown in C:\xampp\htdocs\helpdesk\scp\sync_mldap.php on line 137`

Does anyone see this in their cron log and can this be fixed?

BR Marcel

philbertphotos commented 1 year ago

@Fe3lApAcUt This has been fixed look out for the update.

philbertphotos commented 1 year ago

Not currently using this version in my live environment as yet but in my DEV box both 1.6.3 and 1.7.3 are working and syncing now.

philbertphotos commented 1 year ago

Fixed.