/** * Resolve a group share to a user specific share * Thus if the user moved their group share make sure this is properly reflected here. * * @param Share $share * @param IUser $user * @return Share Returns the updated share if one was found else return the original share. */ private function resolveGroupShare(Share $share, IUser $user) { $qb = $this->dbConn->getQueryBuilder(); $stmt = $qb->select('*')->from('share')->where($qb->expr()->eq('parent', $qb->createNamedParameter($share->getId())))->andWhere($qb->expr()->eq('share_type', $qb->createNamedParameter(self::SHARE_TYPE_USERGROUP)))->andWhere($qb->expr()->eq('share_with', $qb->createNamedParameter($user->getUID())))->setMaxResults(1)->execute(); $data = $stmt->fetch(); $stmt->closeCursor(); if ($data !== false) { $share->setPermissions((int) $data['permissions']); $share->setTarget($data['file_target']); } return $share; }