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.
please use phpunit's annotations to assert exceptions