{"action":"created","issue":{"url":"https://api.github.com/repos/owncloud/core/issues/26346","repository_url":"https://api.github.com/repos/owncloud/core","labels_url":"https://api.github.com/repos/owncloud/core/issues/26346/labels{/name}","comments_url":"https://api.github.com/repos/owncloud/core/issues/26346/comments","events_url":"https://api.github.com/repos/owncloud/core/issues/26346/events","html_url":"https://github.com/owncloud/core/issues/26346","id":182378286,"number":26346,"title":"Unshare feature is incomplete for groups when a user tries to unshare/delete a file","user":{"login":"GustavoSLinden","id":22778766,"avatar_url":"https://avatars.githubusercontent.com/u/22778766?v=3","gravatar_id":"","url":"https://api.github.com/users/GustavoSLinden","html_url":"https://github.com/GustavoSLinden","followers_url":"https://api.github.com/users/GustavoSLinden/followers","following_url":"https://api.github.com/users/GustavoSLinden/following{/other_user}","gists_url":"https://api.github.com/users/GustavoSLinden/gists{/gist_id}","starred_url":"https://api.github.com/users/GustavoSLinden/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GustavoSLinden/subscriptions","organizations_url":"https://api.github.com/users/GustavoSLinden/orgs","repos_url":"https://api.github.com/users/GustavoSLinden/repos","events_url":"https://api.github.com/users/GustavoSLinden/events{/privacy}","received_events_url":"https://api.github.com/users/GustavoSLinden/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/owncloud/core/labels/bug","name":"bug","color":"fc2929"},{"url":"https://api.github.com/repos/owncloud/core/labels/feature:sharing","name":"feature:sharing","color":"d4c5f9"},{"url":"https://api.github.com/repos/owncloud/core/labels/sev2-high","name":"sev2-high","color":"fc2929"}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/owncloud/core/milestones/95","html_url":"https://github.com/owncloud/core/milestones/9.0.6","labels_url":"https://api.github.com/repos/owncloud/core/milestones/95/labels","id":1896108,"number":95,"title":"9.0.6","description":null,"creator":{"login":"PVince81","id":277525,"avatar_url":"https://avatars.githubusercontent.com/u/277525?v=3","gravatar_id":"","url":"https://api.github.com/users/PVince81","html_url":"https://github.com/PVince81","followers_url":"https://api.github.com/users/PVince81/followers","following_url":"https://api.github.com/users/PVince81/following{/other_user}","gists_url":"https://api.github.com/users/PVince81/gists{/gist_id}","starred_url":"https://api.github.com/users/PVince81/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PVince81/subscriptions","organizations_url":"https://api.github.com/users/PVince81/orgs","repos_url":"https://api.github.com/users/PVince81/repos","events_url":"https://api.github.com/users/PVince81/events{/privacy}","received_events_url":"https://api.github.com/users/PVince81/received_events","type":"User","site_admin":false},"open_issues":55,"closed_issues":28,"state":"open","created_at":"2016-07-21T09:55:18Z","updated_at":"2016-10-20T08:57:00Z","due_on":"2016-10-24T00:00:00Z","closed_at":null},"comments":19,"created_at":"2016-10-11T21:24:18Z","updated_at":"2016-10-20T08:57:00Z","closed_at":"2016-10-20T08:57:00Z","body":"\r\n### Steps to reproduce\r\n1. Create a group and assign 2 members (user1 and user2).\r\n2. Share a file with user1 to the group.\r\n3. Unshare the file with user2.\r\n\r\n### Expected behaviour\r\nEverything should work perfectly. \r\n\r\n### Actual behaviour\r\nThe file is correctly unshared but after these 3 errors some functions did not work correctly:\r\n\r\n```javascript\r\n{\"reqId\":\"iaLbkobz6NFFnbKTN5ZT\",\"remoteAddr\":\"10.35.82.142\",\"app\":\"PHP\",\"message\":\"Undefined index: shareType at \\/var\\/www\\/nextcloud\\/apps\\/files_sharing\\/lib\\/updater.php#172\",\"level\":3,\"time\":\"2016-10-11T19:25:29+00:00\",\"method\":\"DELETE\",\"url\":\"\\/remote.php\\/webdav\\/test.txt\",\"user\":\"user2\"}\r\n{\"reqId\":\"iaLbkobz6NFFnbKTN5ZT\",\"remoteAddr\":\"10.35.82.142\",\"app\":\"PHP\",\"message\":\"Undefined index: shareWith at \\/var\\/www\\/nextcloud\\/apps\\/files_sharing\\/lib\\/updater.php#177\",\"level\":3,\"time\":\"2016-10-11T19:25:29+00:00\",\"method\":\"DELETE\",\"url\":\"\\/remote.php\\/webdav\\/test.txt\",\"user\":\"user2\"}\r\n{\"reqId\":\"iaLbkobz6NFFnbKTN5ZT\",\"remoteAddr\":\"10.35.82.142\",\"app\":\"PHP\",\"message\":\"Undefined index: fileTarget at \\/var\\/www\\/nextcloud\\/apps\\/files_sharing\\/lib\\/updater.php#177\",\"level\":3,\"time\":\"2016-10-11T19:25:29+00:00\",\"method\":\"DELETE\",\"url\":\"\\/remote.php\\/webdav\\/test.txt\",\"user\":\"user2\"}\r\n```\r\n\r\n### Server configuration\r\n\r\nOperating system: Debian 7 x86_64\r\n\r\nWeb server: Apache 2.2\r\n\r\nDatabase: Postgresql 9.4\r\n\r\nPHP version: 5.4.45-0+deb7u2\r\n\r\nownCloud version: 9.0.1\r\n\r\nUpdated from an older ownCloud or fresh install: Updated\r\n\r\n### Logs\r\n\r\n#### ownCloud log (data/owncloud.log)\r\n\r\n```javascript\r\n{\"reqId\":\"iaLbkobz6NFFnbKTN5ZT\",\"remoteAddr\":\"10.35.82.142\",\"app\":\"PHP\",\"message\":\"Undefined index: shareType at \\/var\\/www\\/nextcloud\\/apps\\/files_sharing\\/lib\\/updater.php#172\",\"level\":3,\"time\":\"2016-10-11T19:25:29+00:00\",\"method\":\"DELETE\",\"url\":\"\\/remote.php\\/webdav\\/test.txt\",\"user\":\"user2\"}\r\n{\"reqId\":\"iaLbkobz6NFFnbKTN5ZT\",\"remoteAddr\":\"10.35.82.142\",\"app\":\"PHP\",\"message\":\"Undefined index: shareWith at \\/var\\/www\\/nextcloud\\/apps\\/files_sharing\\/lib\\/updater.php#177\",\"level\":3,\"time\":\"2016-10-11T19:25:29+00:00\",\"method\":\"DELETE\",\"url\":\"\\/remote.php\\/webdav\\/test.txt\",\"user\":\"user2\"}\r\n{\"reqId\":\"iaLbkobz6NFFnbKTN5ZT\",\"remoteAddr\":\"10.35.82.142\",\"app\":\"PHP\",\"message\":\"Undefined index: fileTarget at \\/var\\/www\\/nextcloud\\/apps\\/files_sharing\\/lib\\/updater.php#177\",\"level\":3,\"time\":\"2016-10-11T19:25:29+00:00\",\"method\":\"DELETE\",\"url\":\"\\/remote.php\\/webdav\\/test.txt\",\"user\":\"user2\"}\r\n```\r\n\r\n####  Workaround\r\n\r\nThis patch could be applied to correct the errors:\r\n\r\n```PHP\r\n--- /var/www/owncloud/apps/files_sharing/lib/updater.php\t2016-10-11 17:58:35.121227338 -0300\r\n+++ /var/www/owncloud/apps/files_sharing/lib/updater.php\t2016-10-11 18:00:05.449227352 -0300\r\n@@ -168,10 +168,15 @@\r\n \tstatic public function postUnshareFromSelfHook($params) {\r\n \t\tif ($params['itemType'] === 'file' || $params['itemType'] === 'folder') {\r\n \t\t\tforeach ($params['unsharedItems'] as $item) {\r\n-\t\t\t\tif ($item['shareType'] === \\OCP\\Share::SHARE_TYPE_GROUP) {\r\n+\t\t\t\tif ( isset($item['shareType']) && $item['shareType'] === \\OCP\\Share::SHARE_TYPE_GROUP) {\r\n \t\t\t\t\tforeach (\\OC_Group::usersInGroup($item['shareWith']) as $user) {\r\n \t\t\t\t\t\tself::correctUsersFolder($user, $item['fileTarget']);\r\n \t\t\t\t\t}\r\n+\t\t\t\t}\r\n+\t\t\t\telseif ( isset($item['share_type']) && $item['share_type'] === \\OCP\\Share::SHARE_TYPE_GROUP) {\r\n+\t\t\t\t\tforeach (\\OC_Group::usersInGroup($item['share_with']) as $user) {\r\n+                                                self::correctUsersFolder($user, $item['file_target']);\r\n+                                        }\r\n \t\t\t\t} else {\r\n \t\t\t\t\tself::correctUsersFolder($item['shareWith'], $item['fileTarget']);\r\n \t\t\t\t}\r\n```"},"comment":{"url":"https://api.github.com/repos/owncloud/core/issues/comments/255048597","html_url":"https://github.com/owncloud/core/issues/26346#issuecomment-255048597","issue_url":"https://api.github.com/repos/owncloud/core/issues/26346","id":255048597,"user":{"login":"PVince81","id":277525,"avatar_url":"https://avatars.githubusercontent.com/u/277525?v=3","gravatar_id":"","url":"https://api.github.com/users/PVince81","html_url":"https://github.com/PVince81","followers_url":"https://api.github.com/users/PVince81/followers","following_url":"https://api.github.com/users/PVince81/following{/other_user}","gists_url":"https://api.github.com/users/PVince81/gists{/gist_id}","starred_url":"https://api.github.com/users/PVince81/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PVince81/subscriptions","organizations_url":"https://api.github.com/users/PVince81/orgs","repos_url":"https://api.github.com/users/PVince81/repos","events_url":"https://api.github.com/users/PVince81/events{/privacy}","received_events_url":"https://api.github.com/users/PVince81/received_events","type":"User","site_admin":false},"created_at":"2016-10-20T08:57:00Z","updated_at":"2016-10-20T08:57:00Z","body":"All PRs merged, fix will be in 8.2.9 and 9.0.6"}}
{"actor":{"display_login":"PVince81"}}