Merge pull request #22143 from owncloud/fix_12385

When a user is removed we should remove the right shares
This commit is contained in:
Thomas Müller 2016-02-05 11:53:28 +01:00
commit e6bab280a6
2 changed files with 16 additions and 11 deletions

View File

@ -480,13 +480,18 @@ Feature: sharing
Then the OCS status code should be "100"
And the HTTP status code should be "200"
Scenario: Keep usergroup shares (#22143)
Given As an "admin"
And user "user0" exists
And user "user1" exists
And user "user2" exists
And group "group" exists
And user "user1" belongs to group "group"
And user "user2" belongs to group "group"
And user "user0" created a folder "/TMP"
And file "TMP" of user "user0" is shared with group "group"
And user "user1" created a folder "/myFOLDER"
And User "user1" moves file "/TMP" to "/myFOLDER/myTMP"
And user "user2" does not exist
And user "user1" should see following elements
| /myFOLDER/myTMP/ |

View File

@ -38,7 +38,7 @@ class Hooks extends \OC\Share\Constants {
public static function post_deleteUser($arguments) {
// Delete any items shared with the deleted user
$query = \OC_DB::prepare('DELETE FROM `*PREFIX*share`'
.' WHERE `share_with` = ? AND `share_type` = ? OR `share_type` = ?');
.' WHERE `share_with` = ? AND (`share_type` = ? OR `share_type` = ?)');
$query->execute(array($arguments['uid'], self::SHARE_TYPE_USER, self::$shareTypeGroupUserUnique));
// Delete any items the deleted user shared
$query = \OC_DB::prepare('SELECT `id` FROM `*PREFIX*share` WHERE `uid_owner` = ?');