I wrote a hook that sends me a mail when the user is registered (via postCreateUser). I need to add it immediatily to an existing group. In the documentation, I was not able to find classes or examples to implement this, or not undersanding, how it's make. Please help.
Inject OCP\IGroupManager to your HooksHandler class and use it for your goal. Read the application development documentation first. You will use DI Container to inject group manager: https://doc.owncloud.org/server/latest/developer_manual/app/fundamentals/container.html
Thank you! This interface OCP\IGroupManager (https://doc.owncloud.org/api/classes/OCP.IGroupManager.html) only allows me to learn through the hook, when the user was added to the group. But I need a command with which I can add a user to the group. I can't find it's method in IGroupManager.
First, get the group with get function of GroupManager. After that use addMember function of the Group. Here is how OCC Group AddMember command work. https://github.com/owncloud/core/blob/master/core/Command/Group/AddMember.php#L62
Great!!!! Thank you very much, I'm understend, try, and now all works, like as I expected!