Sharing group shares stable7

backport of https://github.com/owncloud/core/pull/10107. I just want to give Jenkins the chance to test it before we merge it to stable7.
This would mean that class name has to match the file name, right? This wouldn't allow to collect all exceptions in one file. Still it could make sense of course. Keep in mind that this is a backport, the same code is already in master. I would prefer to not modify it here to keep in sync with master.