|
|
|
|
@ -156,7 +156,7 @@ class Share {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (self::getItems($itemType, $item, self::SHARE_TYPE_USER, $shareWith, $uidOwner, self::FORMAT_NONE, 1)) {
|
|
|
|
|
if (self::getItems($itemType, $item, self::SHARE_TYPE_USER, $shareWith, $uidOwner, self::FORMAT_NONE, null, 1)) {
|
|
|
|
|
\OC_Log::write('OCP\Share', 'Sharing '.$item.' failed, because this item is already shared with the user '.$shareWith, \OC_Log::ERROR);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
@ -169,7 +169,7 @@ class Share {
|
|
|
|
|
\OC_Log::write('OCP\Share', 'Sharing '.$item.' failed, because '.$uidOwner.' is not a member of the group '.$shareWith, \OC_Log::ERROR);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
if (self::getItems($itemType, $item, self::SHARE_TYPE_GROUP, $shareWith, $uidOwner, self::FORMAT_NONE, 1)) {
|
|
|
|
|
if (self::getItems($itemType, $item, self::SHARE_TYPE_GROUP, $shareWith, $uidOwner, self::FORMAT_NONE, null, 1)) {
|
|
|
|
|
\OC_Log::write('OCP\Share', 'Sharing '.$item.' failed, because this item is already shared with the group '.$shareWith, \OC_Log::ERROR);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
@ -221,7 +221,7 @@ class Share {
|
|
|
|
|
* @return Returns true on success or false on failure
|
|
|
|
|
*/
|
|
|
|
|
public static function unshare($itemType, $item, $shareType, $shareWith) {
|
|
|
|
|
if ($item = self::getItems($itemType, $item, $shareType, $shareWith, \OC_User::getUser(), self::FORMAT_NONE, 1)) {
|
|
|
|
|
if ($item = self::getItems($itemType, $item, $shareType, $shareWith, \OC_User::getUser(), self::FORMAT_NONE, null, 1)) {
|
|
|
|
|
self::delete($item['id']);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
@ -308,7 +308,7 @@ class Share {
|
|
|
|
|
* @return Returns true on success or false on failure
|
|
|
|
|
*/
|
|
|
|
|
public static function setPermissions($itemType, $item, $shareType, $shareWith, $permissions) {
|
|
|
|
|
if ($item = self::getItems($itemType, $item, $shareType, $shareWith, \OC_User::getUser(), self::FORMAT_NONE, 1)) {
|
|
|
|
|
if ($item = self::getItems($itemType, $item, $shareType, $shareWith, \OC_User::getUser(), self::FORMAT_NONE, null, 1)) {
|
|
|
|
|
// Check if this item is a reshare and verify that the permissions granted don't exceed the parent shared item
|
|
|
|
|
if (isset($item['parent'])) {
|
|
|
|
|
$query = \OC_DB::prepare('SELECT permissions FROM *PREFIX*share WHERE id = ? LIMIT 1');
|
|
|
|
|
|