diff --git a/lib/public/share.php b/lib/public/share.php
index 50f2ff1c8a2fb7407fd4f5a0c518cc008270adb2..b1f7468c83ea8665049f2b2dfc33aa19433bf8aa 100644
--- a/lib/public/share.php
+++ b/lib/public/share.php
@@ -761,7 +761,16 @@ class Share {
 	}
 
 	public static function post_removeFromGroup($arguments) {
-		// TODO
+		$query = \OC_DB::prepare('SELECT id, share_type FROM *PREFIX*share WHERE (share_type = ? AND share_with = ?) OR (share_type = ? AND share_with = ?)');
+		$result = $query->execute(array(self::SHARE_TYPE_GROUP, $arguments['gid'], self::$shareTypeGroupUserUnique, $arguments['uid']));
+		while ($item = $result->fetchRow()) {
+			if ($item['share_type'] == self::SHARE_TYPE_GROUP) {
+				// Delete all reshares by this user of the group share
+				self::delete($item['id'], true, $arguments['uid']);
+			} else {
+				self::delete($item['id']);
+			}
+		}
 	}
 
 }