Hook when a user is added in a group

Is there a hook triggered after adding a user in a group ?

I need to synchronize users in forgejo app which manage admins and regular users. I want to launch synchronization when a user is added or removed from yunohost admin (e.g.) group.

Thanks for your help.

Unfortunately nope: yunohost/src/user.py at 19eb48b6e73267685e1417122ac47908c1cf2472 · YunoHost/yunohost · GitHub (no hook_callback in that function)

Thank you @tituspijean for your quick reply.

Is there a chance someone add it in the future ? Should I create an issue ?

Yes and yes! :slight_smile:

FYI : Hook for adding user in group · Issue #2213 · YunoHost/issues · GitHub

Actually, since you are referring to Forgejo in the issue (it’s always nice to give the full context, for XY problem avoidance, etc.)… wouldn’t this be what you need?

This is what I already use :blush:

This synchronization process is triggered by Forgejo itself on midnight every day.
What I want is to keep synchronization up to date. For this purpose, I «manually» trigger it during the create / delete user hook and the add / remove app access hook. My issue (you understood it) is the lack of hook when a user is added / removed into / from a group.

1 Like

You could increase the frequency of the cron, but yeah it makes sense to such a hook in YunoHost. :wink: