Skip to content
Snippets Groups Projects
Commit 6c7baacf authored by Michael Gapczynski's avatar Michael Gapczynski
Browse files

Throw exception for items already shared in a collection

parent 26e406c3
Branches
No related tags found
No related merge requests found
......@@ -225,11 +225,12 @@ class Share {
}
if ($collectionTypes = self::getCollectionItemTypes($itemType)) {
foreach ($collectionTypes as $collectionType) {
$collections = self::getItems($collectionType, null, self::SHARE_TYPE_USER, $shareWith, $uidOwner);
$collections = self::getItems($collectionType, null, self::$shareTypeUserAndGroups, $shareWith, $uidOwner);
if ($backend = self::getBackend($collectionType)) {
if ($backend->inCollection($collections, $item)) {
\OC_Log::write('OCP\Share', 'Sharing '.$item.' failed, because this item is already shared with '.$shareWith.' inside a collection', \OC_Log::ERROR);
return false;
$message = 'Sharing '.$item.' failed, because this item is already shared with '.$shareWith.' inside a collection';
\OC_Log::write('OCP\Share', $message, \OC_Log::ERROR);
throw new \Exception($message);
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment