LDAP Auth groups broken in 2.4.x and 2.5.x

Problem:
We are using LDAP auth and external groups sync. Everything works normal in 2.3.4 but after upgrading to 2.4.1 user jump out from his User Group on every login.
I tested this on 2.5.1 and behavior is the same. After downgrading to 2.3.4 it works normal.

When user loggs in, it gets permission denied. I manualy trigger external group sync and user apper in group, refresh the foreman and it works until user loggs in again.

Immidiatelly after login user jump out of the usergroup and get permission denied again.
Expected outcome:

Foreman and Proxy versions:
2.4.x
2.5.x

Foreman and Proxy plugin versions:

Distribution and version:
Debian: Buster

Other relevant data:

Interesting, there was no change in the code since 1.22 that I could found. Do you see any additional information in the production.log? Can you enable debug log level, ldap and sql loggers and upload the log then?