owncloud/core — pull request #1479 by schiesbn (2013-02-05 18:08:09+00:00)
Title: sharing, unset the right item to avoid false positives during the check if resharing is allowed

In some cases it can happen that a user can no longer share any file/folder because every share will be detected as a forbidden re-share.

You can try this out by following this steps:

- You need to have two users (userA, userB), both in the same group (groupA).
- Login as userA
- userA shares a folder with userB with all permissions (create, update, delete, share)
- userA shares the same folder with groupA, permissions: create, update
- Login as userB
- Try to share a random folder from him with userA, you will get a message that resharing is not allowed.

The problem:

Because of the same share with different permissions the ID will be switched here:
https://github.com/owncloud/core/blob/stable45/lib/public/share.php#L748

Later during the test if this is a collection of the requested item_type it want to remove the item again:
https://github.com/owncloud/core/blob/stable45/lib/public/share.php#L847

This will fail because of the switch above which will result in different ids in items[] than the actual ID of the row.

The solution:

I added a array to track the ID switches so that they can be later mapped