summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/private/share20/defaultshareprovider.php34
-rw-r--r--tests/lib/share20/defaultshareprovidertest.php3
2 files changed, 28 insertions, 9 deletions
diff --git a/lib/private/share20/defaultshareprovider.php b/lib/private/share20/defaultshareprovider.php
index 7a08ecb1210..f4c33d68b46 100644
--- a/lib/private/share20/defaultshareprovider.php
+++ b/lib/private/share20/defaultshareprovider.php
@@ -36,6 +36,9 @@ use OCP\Files\Node;
*/
class DefaultShareProvider implements IShareProvider {
+ // Special share type for user modified group shares
+ const SHARE_TYPE_USERGROUP = 2;
+
/** @var IDBConnection */
private $dbConn;
@@ -185,8 +188,18 @@ class DefaultShareProvider implements IShareProvider {
$qb = $this->dbConn->getQueryBuilder();
$qb->select('*')
->from('share')
- ->where($qb->expr()->eq('parent', $qb->createParameter('parent')))
- ->setParameter(':parent', $parent->getId())
+ ->where($qb->expr()->eq('parent', $qb->createNamedParameter($parent->getId())))
+ ->andWhere(
+ $qb->expr()->in(
+ 'share_type',
+ [
+ $qb->expr()->literal(\OCP\Share::SHARE_TYPE_USER),
+ $qb->expr()->literal(\OCP\Share::SHARE_TYPE_GROUP),
+ $qb->expr()->literal(\OCP\Share::SHARE_TYPE_LINK),
+ $qb->expr()->literal(self::SHARE_TYPE_USERGROUP),
+ ]
+ )
+ )
->orderBy('id');
$cursor = $qb->execute();
@@ -210,8 +223,7 @@ class DefaultShareProvider implements IShareProvider {
$qb = $this->dbConn->getQueryBuilder();
$qb->delete('share')
- ->where($qb->expr()->eq('id', $qb->createParameter('id')))
- ->setParameter(':id', $share->getId());
+ ->where($qb->expr()->eq('id', $qb->createNamedParameter($share->getId())));
try {
$qb->execute();
@@ -244,8 +256,18 @@ class DefaultShareProvider implements IShareProvider {
$qb->select('*')
->from('share')
- ->where($qb->expr()->eq('id', $qb->createParameter('id')))
- ->setParameter(':id', $id);
+ ->where($qb->expr()->eq('id', $qb->createNamedParameter($id)))
+ ->andWhere(
+ $qb->expr()->in(
+ 'share_type',
+ [
+ $qb->expr()->literal(\OCP\Share::SHARE_TYPE_USER),
+ $qb->expr()->literal(\OCP\Share::SHARE_TYPE_GROUP),
+ $qb->expr()->literal(\OCP\Share::SHARE_TYPE_LINK),
+ $qb->expr()->literal(self::SHARE_TYPE_USERGROUP),
+ ]
+ )
+ );
$cursor = $qb->execute();
$data = $cursor->fetch();
diff --git a/tests/lib/share20/defaultshareprovidertest.php b/tests/lib/share20/defaultshareprovidertest.php
index 166fbd25f17..4db6b2b14e7 100644
--- a/tests/lib/share20/defaultshareprovidertest.php
+++ b/tests/lib/share20/defaultshareprovidertest.php
@@ -375,9 +375,6 @@ class DefaultShareProviderTest extends \Test\TestCase {
->method('where')
->will($this->returnSelf());
$qb->expects($this->once())
- ->method('setParameter')
- ->will($this->returnSelf());
- $qb->expects($this->once())
->method('execute')
->will($this->throwException(new \Exception));