-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fire group membership events from LDAP at login #40367
Conversation
} | ||
|
||
private function registerBackendDependents(IAppContainer $appContainer, IEventDispatcher $dispatcher) { | ||
private function registerBackendDependents(IAppContainer $appContainer, IEventDispatcher $dispatcher): void { |
Check notice
Code scanning / Psalm
DeprecatedInterface Note
} | ||
|
||
public function handle(Event $event): void { | ||
if ($event instanceof PostLoginEvent) { |
Check notice
Code scanning / Psalm
RedundantConditionGivenDocblockType Note
Here is the current state: It crashes with:
The problem is that the user<->group relation is cached in several places, and in this case there is a specific cache for So the cache should be emptied, but which one and when? Also, clearing the whole cache each time a user logs in with a new group membership may be too often on big instances with tons of users and groups. Another approach would be to add a method to add this specific user<>group relation ship to caches. I am gonna try this first. |
This sounds complicated, there are these caches:
The most problematic are |
0ab3781
to
e1ba954
Compare
I implemented this solution and it works. |
f0345e4
to
cf811b9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure the logic really has to run with each login
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
…fore firing the event Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
It seems now psalm correctly supports this. Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
cf811b9
to
500374a
Compare
If my analysis is correct, the groups are fetched to cache on each login anyway, so this does not add much overhead, it only compares with DB. |
/backport 500374a to stable27 |
/backport 500374a to stable26 |
/backport 500374a to stable25 |
Summary
Rework of #30512 to use new group membership mappings from #39446
TODO
Checklist