summaryrefslogtreecommitdiffstats
path: root/lib/private/Share20
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2020-06-24 16:49:16 +0200
committerJoas Schilling <coding@schilljs.com>2020-06-24 16:49:16 +0200
commit89ed2c37bf656ceb772bb6759c8977a7dc78b3fb (patch)
tree4a467f829fcc748531cad54e7c08e06dd98d1b7d /lib/private/Share20
parent654cd18864c943d9ff93c2e6151bb6529fa44513 (diff)
downloadnextcloud-server-89ed2c37bf656ceb772bb6759c8977a7dc78b3fb.tar.gz
nextcloud-server-89ed2c37bf656ceb772bb6759c8977a7dc78b3fb.zip
Update share type constant usage
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/private/Share20')
-rw-r--r--lib/private/Share20/DefaultShareProvider.php120
-rw-r--r--lib/private/Share20/LegacyHooks.php6
-rw-r--r--lib/private/Share20/Manager.php169
-rw-r--r--lib/private/Share20/ProviderFactory.php15
4 files changed, 156 insertions, 154 deletions
diff --git a/lib/private/Share20/DefaultShareProvider.php b/lib/private/Share20/DefaultShareProvider.php
index 302c3573a30..202b11a6c3d 100644
--- a/lib/private/Share20/DefaultShareProvider.php
+++ b/lib/private/Share20/DefaultShareProvider.php
@@ -136,7 +136,7 @@ class DefaultShareProvider implements IShareProvider {
$qb->insert('share');
$qb->setValue('share_type', $qb->createNamedParameter($share->getShareType()));
- if ($share->getShareType() === \OCP\Share::SHARE_TYPE_USER) {
+ if ($share->getShareType() === IShare::TYPE_USER) {
//Set the UID of the user we share with
$qb->setValue('share_with', $qb->createNamedParameter($share->getSharedWith()));
$qb->setValue('accepted', $qb->createNamedParameter(IShare::STATUS_PENDING));
@@ -145,7 +145,7 @@ class DefaultShareProvider implements IShareProvider {
if ($share->getExpirationDate() !== null) {
$qb->setValue('expiration', $qb->createNamedParameter($share->getExpirationDate(), 'datetime'));
}
- } elseif ($share->getShareType() === \OCP\Share::SHARE_TYPE_GROUP) {
+ } elseif ($share->getShareType() === IShare::TYPE_GROUP) {
//Set the GID of the group we share with
$qb->setValue('share_with', $qb->createNamedParameter($share->getSharedWith()));
@@ -153,7 +153,7 @@ class DefaultShareProvider implements IShareProvider {
if ($share->getExpirationDate() !== null) {
$qb->setValue('expiration', $qb->createNamedParameter($share->getExpirationDate(), 'datetime'));
}
- } elseif ($share->getShareType() === \OCP\Share::SHARE_TYPE_LINK) {
+ } elseif ($share->getShareType() === IShare::TYPE_LINK) {
//set label for public link
$qb->setValue('label', $qb->createNamedParameter($share->getLabel()));
//Set the token of the share
@@ -244,7 +244,7 @@ class DefaultShareProvider implements IShareProvider {
public function update(\OCP\Share\IShare $share) {
$originalShare = $this->getShareById($share->getId());
- if ($share->getShareType() === \OCP\Share::SHARE_TYPE_USER) {
+ if ($share->getShareType() === IShare::TYPE_USER) {
/*
* We allow updating the recipient on user shares.
*/
@@ -261,7 +261,7 @@ class DefaultShareProvider implements IShareProvider {
->set('note', $qb->createNamedParameter($share->getNote()))
->set('accepted', $qb->createNamedParameter($share->getStatus()))
->execute();
- } elseif ($share->getShareType() === \OCP\Share::SHARE_TYPE_GROUP) {
+ } elseif ($share->getShareType() === IShare::TYPE_GROUP) {
$qb = $this->dbConn->getQueryBuilder();
$qb->update('share')
->where($qb->expr()->eq('id', $qb->createNamedParameter($share->getId())))
@@ -280,7 +280,7 @@ class DefaultShareProvider implements IShareProvider {
$qb = $this->dbConn->getQueryBuilder();
$qb->update('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_type', $qb->createNamedParameter(IShare::TYPE_USERGROUP)))
->set('uid_owner', $qb->createNamedParameter($share->getShareOwner()))
->set('uid_initiator', $qb->createNamedParameter($share->getSharedBy()))
->set('item_source', $qb->createNamedParameter($share->getNode()->getId()))
@@ -298,7 +298,7 @@ class DefaultShareProvider implements IShareProvider {
->andWhere($qb->expr()->neq('permissions', $qb->createNamedParameter(0)))
->set('permissions', $qb->createNamedParameter($share->getPermissions()))
->execute();
- } elseif ($share->getShareType() === \OCP\Share::SHARE_TYPE_LINK) {
+ } elseif ($share->getShareType() === IShare::TYPE_LINK) {
$qb = $this->dbConn->getQueryBuilder();
$qb->update('share')
->where($qb->expr()->eq('id', $qb->createNamedParameter($share->getId())))
@@ -350,7 +350,7 @@ class DefaultShareProvider implements IShareProvider {
$qb = $this->dbConn->getQueryBuilder();
$stmt = $qb->select('*')
->from('share')
- ->where($qb->expr()->eq('share_type', $qb->createNamedParameter(self::SHARE_TYPE_USERGROUP)))
+ ->where($qb->expr()->eq('share_type', $qb->createNamedParameter(IShare::TYPE_USERGROUP)))
->andWhere($qb->expr()->eq('share_with', $qb->createNamedParameter($recipient)))
->andWhere($qb->expr()->eq('parent', $qb->createNamedParameter($share->getId())))
->andWhere($qb->expr()->orX(
@@ -408,9 +408,9 @@ class DefaultShareProvider implements IShareProvider {
$qb->expr()->in(
'share_type',
$qb->createNamedParameter([
- \OCP\Share::SHARE_TYPE_USER,
- \OCP\Share::SHARE_TYPE_GROUP,
- \OCP\Share::SHARE_TYPE_LINK,
+ IShare::TYPE_USER,
+ IShare::TYPE_GROUP,
+ IShare::TYPE_LINK,
], IQueryBuilder::PARAM_INT_ARRAY)
)
)
@@ -443,7 +443,7 @@ class DefaultShareProvider implements IShareProvider {
* If the share is a group share delete all possible
* user defined groups shares.
*/
- if ($share->getShareType() === \OCP\Share::SHARE_TYPE_GROUP) {
+ if ($share->getShareType() === IShare::TYPE_GROUP) {
$qb->orWhere($qb->expr()->eq('parent', $qb->createNamedParameter($share->getId())));
}
@@ -476,7 +476,7 @@ class DefaultShareProvider implements IShareProvider {
$qb = $this->dbConn->getQueryBuilder();
$stmt = $qb->select('*')
->from('share')
- ->where($qb->expr()->eq('share_type', $qb->createNamedParameter(self::SHARE_TYPE_USERGROUP)))
+ ->where($qb->expr()->eq('share_type', $qb->createNamedParameter(IShare::TYPE_USERGROUP)))
->andWhere($qb->expr()->eq('share_with', $qb->createNamedParameter($recipient)))
->andWhere($qb->expr()->eq('parent', $qb->createNamedParameter($share->getId())))
->andWhere($qb->expr()->orX(
@@ -525,7 +525,7 @@ class DefaultShareProvider implements IShareProvider {
$qb = $this->dbConn->getQueryBuilder();
$qb->insert('share')
->values([
- 'share_type' => $qb->createNamedParameter(self::SHARE_TYPE_USERGROUP),
+ 'share_type' => $qb->createNamedParameter(IShare::TYPE_USERGROUP),
'share_with' => $qb->createNamedParameter($recipient),
'uid_owner' => $qb->createNamedParameter($share->getShareOwner()),
'uid_initiator' => $qb->createNamedParameter($share->getSharedBy()),
@@ -566,7 +566,7 @@ class DefaultShareProvider implements IShareProvider {
->where(
$qb->expr()->eq('parent', $qb->createNamedParameter($share->getParent()))
)->andWhere(
- $qb->expr()->eq('share_type', $qb->createNamedParameter(self::SHARE_TYPE_USERGROUP))
+ $qb->expr()->eq('share_type', $qb->createNamedParameter(IShare::TYPE_USERGROUP))
)->andWhere(
$qb->expr()->eq('share_with', $qb->createNamedParameter($recipient))
);
@@ -580,20 +580,20 @@ class DefaultShareProvider implements IShareProvider {
* @inheritdoc
*/
public function move(\OCP\Share\IShare $share, $recipient) {
- if ($share->getShareType() === \OCP\Share::SHARE_TYPE_USER) {
+ if ($share->getShareType() === IShare::TYPE_USER) {
// Just update the target
$qb = $this->dbConn->getQueryBuilder();
$qb->update('share')
->set('file_target', $qb->createNamedParameter($share->getTarget()))
->where($qb->expr()->eq('id', $qb->createNamedParameter($share->getId())))
->execute();
- } elseif ($share->getShareType() === \OCP\Share::SHARE_TYPE_GROUP) {
+ } elseif ($share->getShareType() === IShare::TYPE_GROUP) {
// Check if there is a usergroup share
$qb = $this->dbConn->getQueryBuilder();
$stmt = $qb->select('id')
->from('share')
- ->where($qb->expr()->eq('share_type', $qb->createNamedParameter(self::SHARE_TYPE_USERGROUP)))
+ ->where($qb->expr()->eq('share_type', $qb->createNamedParameter(IShare::TYPE_USERGROUP)))
->andWhere($qb->expr()->eq('share_with', $qb->createNamedParameter($recipient)))
->andWhere($qb->expr()->eq('parent', $qb->createNamedParameter($share->getId())))
->andWhere($qb->expr()->orX(
@@ -611,7 +611,7 @@ class DefaultShareProvider implements IShareProvider {
$qb = $this->dbConn->getQueryBuilder();
$qb->insert('share')
->values([
- 'share_type' => $qb->createNamedParameter(self::SHARE_TYPE_USERGROUP),
+ 'share_type' => $qb->createNamedParameter(IShare::TYPE_USERGROUP),
'share_with' => $qb->createNamedParameter($recipient),
'uid_owner' => $qb->createNamedParameter($share->getShareOwner()),
'uid_initiator' => $qb->createNamedParameter($share->getSharedBy()),
@@ -646,9 +646,9 @@ class DefaultShareProvider implements IShareProvider {
));
$qb->andWhere($qb->expr()->orX(
- $qb->expr()->eq('share_type', $qb->createNamedParameter(\OCP\Share::SHARE_TYPE_USER)),
- $qb->expr()->eq('share_type', $qb->createNamedParameter(\OCP\Share::SHARE_TYPE_GROUP)),
- $qb->expr()->eq('share_type', $qb->createNamedParameter(\OCP\Share::SHARE_TYPE_LINK))
+ $qb->expr()->eq('share_type', $qb->createNamedParameter(IShare::TYPE_USER)),
+ $qb->expr()->eq('share_type', $qb->createNamedParameter(IShare::TYPE_GROUP)),
+ $qb->expr()->eq('share_type', $qb->createNamedParameter(IShare::TYPE_LINK))
));
/**
@@ -744,9 +744,9 @@ class DefaultShareProvider implements IShareProvider {
$qb->expr()->in(
'share_type',
$qb->createNamedParameter([
- \OCP\Share::SHARE_TYPE_USER,
- \OCP\Share::SHARE_TYPE_GROUP,
- \OCP\Share::SHARE_TYPE_LINK,
+ IShare::TYPE_USER,
+ IShare::TYPE_GROUP,
+ IShare::TYPE_LINK,
], IQueryBuilder::PARAM_INT_ARRAY)
)
)
@@ -770,7 +770,7 @@ class DefaultShareProvider implements IShareProvider {
}
// If the recipient is set for a group share resolve to that user
- if ($recipientId !== null && $share->getShareType() === \OCP\Share::SHARE_TYPE_GROUP) {
+ if ($recipientId !== null && $share->getShareType() === IShare::TYPE_GROUP) {
$share = $this->resolveGroupShares([$share], $recipientId)[0];
}
@@ -791,8 +791,8 @@ class DefaultShareProvider implements IShareProvider {
->andWhere($qb->expr()->eq('file_source', $qb->createNamedParameter($path->getId())))
->andWhere(
$qb->expr()->orX(
- $qb->expr()->eq('share_type', $qb->createNamedParameter(\OCP\Share::SHARE_TYPE_USER)),
- $qb->expr()->eq('share_type', $qb->createNamedParameter(\OCP\Share::SHARE_TYPE_GROUP))
+ $qb->expr()->eq('share_type', $qb->createNamedParameter(IShare::TYPE_USER)),
+ $qb->expr()->eq('share_type', $qb->createNamedParameter(IShare::TYPE_GROUP))
)
)
->andWhere($qb->expr()->orX(
@@ -837,7 +837,7 @@ class DefaultShareProvider implements IShareProvider {
/** @var Share[] $shares */
$shares = [];
- if ($shareType === \OCP\Share::SHARE_TYPE_USER) {
+ if ($shareType === IShare::TYPE_USER) {
//Get shares directly with this user
$qb = $this->dbConn->getQueryBuilder();
$qb->select('s.*',
@@ -859,7 +859,7 @@ class DefaultShareProvider implements IShareProvider {
}
$qb->setFirstResult($offset);
- $qb->where($qb->expr()->eq('share_type', $qb->createNamedParameter(\OCP\Share::SHARE_TYPE_USER)))
+ $qb->where($qb->expr()->eq('share_type', $qb->createNamedParameter(IShare::TYPE_USER)))
->andWhere($qb->expr()->eq('share_with', $qb->createNamedParameter($userId)))
->andWhere($qb->expr()->orX(
$qb->expr()->eq('item_type', $qb->createNamedParameter('file')),
@@ -879,7 +879,7 @@ class DefaultShareProvider implements IShareProvider {
}
}
$cursor->closeCursor();
- } elseif ($shareType === \OCP\Share::SHARE_TYPE_GROUP) {
+ } elseif ($shareType === IShare::TYPE_GROUP) {
$user = $this->userManager->get($userId);
$allGroups = $this->groupManager->getUserGroupIds($user);
@@ -920,7 +920,7 @@ class DefaultShareProvider implements IShareProvider {
$groups = array_filter($groups);
- $qb->andWhere($qb->expr()->eq('share_type', $qb->createNamedParameter(\OCP\Share::SHARE_TYPE_GROUP)))
+ $qb->andWhere($qb->expr()->eq('share_type', $qb->createNamedParameter(IShare::TYPE_GROUP)))
->andWhere($qb->expr()->in('share_with', $qb->createNamedParameter(
$groups,
IQueryBuilder::PARAM_STR_ARRAY
@@ -968,7 +968,7 @@ class DefaultShareProvider implements IShareProvider {
$cursor = $qb->select('*')
->from('share')
- ->where($qb->expr()->eq('share_type', $qb->createNamedParameter(\OCP\Share::SHARE_TYPE_LINK)))
+ ->where($qb->expr()->eq('share_type', $qb->createNamedParameter(IShare::TYPE_LINK)))
->andWhere($qb->expr()->eq('token', $qb->createNamedParameter($token)))
->andWhere($qb->expr()->orX(
$qb->expr()->eq('item_type', $qb->createNamedParameter('file')),
@@ -1013,15 +1013,15 @@ class DefaultShareProvider implements IShareProvider {
$shareTime->setTimestamp((int)$data['stime']);
$share->setShareTime($shareTime);
- if ($share->getShareType() === \OCP\Share::SHARE_TYPE_USER) {
+ if ($share->getShareType() === IShare::TYPE_USER) {
$share->setSharedWith($data['share_with']);
$user = $this->userManager->get($data['share_with']);
if ($user !== null) {
$share->setSharedWithDisplayName($user->getDisplayName());
}
- } elseif ($share->getShareType() === \OCP\Share::SHARE_TYPE_GROUP) {
+ } elseif ($share->getShareType() === IShare::TYPE_GROUP) {
$share->setSharedWith($data['share_with']);
- } elseif ($share->getShareType() === \OCP\Share::SHARE_TYPE_LINK) {
+ } elseif ($share->getShareType() === IShare::TYPE_LINK) {
$share->setPassword($data['password']);
$share->setSendPasswordByTalk((bool)$data['password_by_talk']);
$share->setToken($data['token']);
@@ -1122,13 +1122,13 @@ class DefaultShareProvider implements IShareProvider {
$qb->delete('share');
- if ($shareType === \OCP\Share::SHARE_TYPE_USER) {
+ if ($shareType === IShare::TYPE_USER) {
/*
* Delete all user shares that are owned by this user
* or that are received by this user
*/
- $qb->where($qb->expr()->eq('share_type', $qb->createNamedParameter(\OCP\Share::SHARE_TYPE_USER)));
+ $qb->where($qb->expr()->eq('share_type', $qb->createNamedParameter(IShare::TYPE_USER)));
$qb->andWhere(
$qb->expr()->orX(
@@ -1136,7 +1136,7 @@ class DefaultShareProvider implements IShareProvider {
$qb->expr()->eq('share_with', $qb->createNamedParameter($uid))
)
);
- } elseif ($shareType === \OCP\Share::SHARE_TYPE_GROUP) {
+ } elseif ($shareType === IShare::TYPE_GROUP) {
/*
* Delete all group shares that are owned by this user
* Or special user group shares that are received by this user
@@ -1144,8 +1144,8 @@ class DefaultShareProvider implements IShareProvider {
$qb->where(
$qb->expr()->andX(
$qb->expr()->orX(
- $qb->expr()->eq('share_type', $qb->createNamedParameter(\OCP\Share::SHARE_TYPE_GROUP)),
- $qb->expr()->eq('share_type', $qb->createNamedParameter(self::SHARE_TYPE_USERGROUP))
+ $qb->expr()->eq('share_type', $qb->createNamedParameter(IShare::TYPE_GROUP)),
+ $qb->expr()->eq('share_type', $qb->createNamedParameter(IShare::TYPE_USERGROUP))
),
$qb->expr()->eq('uid_owner', $qb->createNamedParameter($uid))
)
@@ -1153,16 +1153,16 @@ class DefaultShareProvider implements IShareProvider {
$qb->orWhere(
$qb->expr()->andX(
- $qb->expr()->eq('share_type', $qb->createNamedParameter(self::SHARE_TYPE_USERGROUP)),
+ $qb->expr()->eq('share_type', $qb->createNamedParameter(IShare::TYPE_USERGROUP)),
$qb->expr()->eq('share_with', $qb->createNamedParameter($uid))
)
);
- } elseif ($shareType === \OCP\Share::SHARE_TYPE_LINK) {
+ } elseif ($shareType === IShare::TYPE_LINK) {
/*
* Delete all link shares owned by this user.
* And all link shares initiated by this user (until #22327 is in)
*/
- $qb->where($qb->expr()->eq('share_type', $qb->createNamedParameter(\OCP\Share::SHARE_TYPE_LINK)));
+ $qb->where($qb->expr()->eq('share_type', $qb->createNamedParameter(IShare::TYPE_LINK)));
$qb->andWhere(
$qb->expr()->orX(
@@ -1191,7 +1191,7 @@ class DefaultShareProvider implements IShareProvider {
$qb = $this->dbConn->getQueryBuilder();
$qb->select('id')
->from('share')
- ->where($qb->expr()->eq('share_type', $qb->createNamedParameter(\OCP\Share::SHARE_TYPE_GROUP)))
+ ->where($qb->expr()->eq('share_type', $qb->createNamedParameter(IShare::TYPE_GROUP)))
->andWhere($qb->expr()->eq('share_with', $qb->createNamedParameter($gid)));
$cursor = $qb->execute();
@@ -1205,7 +1205,7 @@ class DefaultShareProvider implements IShareProvider {
$chunks = array_chunk($ids, 100);
foreach ($chunks as $chunk) {
$qb->delete('share')
- ->where($qb->expr()->eq('share_type', $qb->createNamedParameter(self::SHARE_TYPE_USERGROUP)))
+ ->where($qb->expr()->eq('share_type', $qb->createNamedParameter(IShare::TYPE_USERGROUP)))
->andWhere($qb->expr()->in('parent', $qb->createNamedParameter($chunk, IQueryBuilder::PARAM_INT_ARRAY)));
$qb->execute();
}
@@ -1216,7 +1216,7 @@ class DefaultShareProvider implements IShareProvider {
*/
$qb = $this->dbConn->getQueryBuilder();
$qb->delete('share')
- ->where($qb->expr()->eq('share_type', $qb->createNamedParameter(\OCP\Share::SHARE_TYPE_GROUP)))
+ ->where($qb->expr()->eq('share_type', $qb->createNamedParameter(IShare::TYPE_GROUP)))
->andWhere($qb->expr()->eq('share_with', $qb->createNamedParameter($gid)));
$qb->execute();
}
@@ -1234,7 +1234,7 @@ class DefaultShareProvider implements IShareProvider {
$qb = $this->dbConn->getQueryBuilder();
$qb->select('id')
->from('share')
- ->where($qb->expr()->eq('share_type', $qb->createNamedParameter(\OCP\Share::SHARE_TYPE_GROUP)))
+ ->where($qb->expr()->eq('share_type', $qb->createNamedParameter(IShare::TYPE_GROUP)))
->andWhere($qb->expr()->eq('share_with', $qb->createNamedParameter($gid)));
$cursor = $qb->execute();
@@ -1251,7 +1251,7 @@ class DefaultShareProvider implements IShareProvider {
* Delete all special shares wit this users for the found group shares
*/
$qb->delete('share')
- ->where($qb->expr()->eq('share_type', $qb->createNamedParameter(self::SHARE_TYPE_USERGROUP)))
+ ->where($qb->expr()->eq('share_type', $qb->createNamedParameter(IShare::TYPE_USERGROUP)))
->andWhere($qb->expr()->eq('share_with', $qb->createNamedParameter($uid)))
->andWhere($qb->expr()->in('parent', $qb->createNamedParameter($chunk, IQueryBuilder::PARAM_INT_ARRAY)));
$qb->execute();
@@ -1271,13 +1271,13 @@ class DefaultShareProvider implements IShareProvider {
$qb = $this->dbConn->getQueryBuilder();
$or = $qb->expr()->orX(
- $qb->expr()->eq('share_type', $qb->createNamedParameter(\OCP\Share::SHARE_TYPE_USER)),
- $qb->expr()->eq('share_type', $qb->createNamedParameter(\OCP\Share::SHARE_TYPE_GROUP)),
- $qb->expr()->eq('share_type', $qb->createNamedParameter(\OCP\Share::SHARE_TYPE_LINK))
+ $qb->expr()->eq('share_type', $qb->createNamedParameter(IShare::TYPE_USER)),
+ $qb->expr()->eq('share_type', $qb->createNamedParameter(IShare::TYPE_GROUP)),
+ $qb->expr()->eq('share_type', $qb->createNamedParameter(IShare::TYPE_LINK))
);
if ($currentAccess) {
- $or->add($qb->expr()->eq('share_type', $qb->createNamedParameter(self::SHARE_TYPE_USERGROUP)));
+ $or->add($qb->expr()->eq('share_type', $qb->createNamedParameter(IShare::TYPE_USERGROUP)));
}
$qb->select('id', 'parent', 'share_type', 'share_with', 'file_source', 'file_target', 'permissions')
@@ -1296,11 +1296,11 @@ class DefaultShareProvider implements IShareProvider {
$link = false;
while ($row = $cursor->fetch()) {
$type = (int)$row['share_type'];
- if ($type === \OCP\Share::SHARE_TYPE_USER) {
+ if ($type === IShare::TYPE_USER) {
$uid = $row['share_with'];
$users[$uid] = isset($users[$uid]) ? $users[$uid] : [];
$users[$uid][$row['id']] = $row;
- } elseif ($type === \OCP\Share::SHARE_TYPE_GROUP) {
+ } elseif ($type === IShare::TYPE_GROUP) {
$gid = $row['share_with'];
$group = $this->groupManager->get($gid);
@@ -1314,9 +1314,9 @@ class DefaultShareProvider implements IShareProvider {
$users[$uid] = isset($users[$uid]) ? $users[$uid] : [];
$users[$uid][$row['id']] = $row;
}
- } elseif ($type === \OCP\Share::SHARE_TYPE_LINK) {
+ } elseif ($type === IShare::TYPE_LINK) {
$link = true;
- } elseif ($type === self::SHARE_TYPE_USERGROUP && $currentAccess === true) {
+ } elseif ($type === IShare::TYPE_USERGROUP && $currentAccess === true) {
$uid = $row['share_with'];
$users[$uid] = isset($users[$uid]) ? $users[$uid] : [];
$users[$uid][$row['id']] = $row;
@@ -1345,7 +1345,7 @@ class DefaultShareProvider implements IShareProvider {
$type = (int) $share['share_type'];
$permissions = (int) $share['permissions'];
- if ($type === self::SHARE_TYPE_USERGROUP) {
+ if ($type === IShare::TYPE_USERGROUP) {
unset($shares[$share['parent']]);
if ($permissions === 0) {
@@ -1377,10 +1377,10 @@ class DefaultShareProvider implements IShareProvider {
* @throws \OCP\Files\NotFoundException
*/
private function propagateNote(IShare $share) {
- if ($share->getShareType() === \OCP\Share::SHARE_TYPE_USER) {
+ if ($share->getShareType() === IShare::TYPE_USER) {
$user = $this->userManager->get($share->getSharedWith());
$this->sendNote([$user], $share);
- } elseif ($share->getShareType() === \OCP\Share::SHARE_TYPE_GROUP) {
+ } elseif ($share->getShareType() === IShare::TYPE_GROUP) {
$group = $this->groupManager->get($share->getSharedWith());
$groupMembers = $group->getUsers();
$this->sendNote($groupMembers, $share);
diff --git a/lib/private/Share20/LegacyHooks.php b/lib/private/Share20/LegacyHooks.php
index 1e2391f0bd0..285b45be809 100644
--- a/lib/private/Share20/LegacyHooks.php
+++ b/lib/private/Share20/LegacyHooks.php
@@ -102,9 +102,9 @@ class LegacyHooks {
// Prepare hook
$shareType = $share->getShareType();
$sharedWith = '';
- if ($shareType === \OCP\Share::SHARE_TYPE_USER ||
- $shareType === \OCP\Share::SHARE_TYPE_GROUP ||
- $shareType === \OCP\Share::SHARE_TYPE_REMOTE) {
+ if ($shareType === IShare::TYPE_USER ||
+ $shareType === IShare::TYPE_GROUP ||
+ $shareType === IShare::TYPE_REMOTE) {
$sharedWith = $share->getSharedWith();
}
diff --git a/lib/private/Share20/Manager.php b/lib/private/Share20/Manager.php
index 3d7a274e662..91fb11adc76 100644
--- a/lib/private/Share20/Manager.php
+++ b/lib/private/Share20/Manager.php
@@ -208,45 +208,45 @@ class Manager implements IManager {
/**
* Check for generic requirements before creating a share
*
- * @param \OCP\Share\IShare $share
+ * @param IShare $share
* @throws \InvalidArgumentException
* @throws GenericShareException
*
* @suppress PhanUndeclaredClassMethod
*/
- protected function generalCreateChecks(\OCP\Share\IShare $share) {
- if ($share->getShareType() === \OCP\Share::SHARE_TYPE_USER) {
+ protected function generalCreateChecks(IShare $share) {
+ if ($share->getShareType() === IShare::TYPE_USER) {
// We expect a valid user as sharedWith for user shares
if (!$this->userManager->userExists($share->getSharedWith())) {
throw new \InvalidArgumentException('SharedWith is not a valid user');
}
- } elseif ($share->getShareType() === \OCP\Share::SHARE_TYPE_GROUP) {
+ } elseif ($share->getShareType() === IShare::TYPE_GROUP) {
// We expect a valid group as sharedWith for group shares
if (!$this->groupManager->groupExists($share->getSharedWith())) {
throw new \InvalidArgumentException('SharedWith is not a valid group');
}
- } elseif ($share->getShareType() === \OCP\Share::SHARE_TYPE_LINK) {
+ } elseif ($share->getShareType() === IShare::TYPE_LINK) {
if ($share->getSharedWith() !== null) {
throw new \InvalidArgumentException('SharedWith should be empty');
}
- } elseif ($share->getShareType() === \OCP\Share::SHARE_TYPE_REMOTE) {
+ } elseif ($share->getShareType() === IShare::TYPE_REMOTE) {
if ($share->getSharedWith() === null) {
throw new \InvalidArgumentException('SharedWith should not be empty');
}
- } elseif ($share->getShareType() === \OCP\Share::SHARE_TYPE_REMOTE_GROUP) {
+ } elseif ($share->getShareType() === IShare::TYPE_REMOTE_GROUP) {
if ($share->getSharedWith() === null) {
throw new \InvalidArgumentException('SharedWith should not be empty');
}
- } elseif ($share->getShareType() === \OCP\Share::SHARE_TYPE_EMAIL) {
+ } elseif ($share->getShareType() === IShare::TYPE_EMAIL) {
if ($share->getSharedWith() === null) {
throw new \InvalidArgumentException('SharedWith should not be empty');
}
- } elseif ($share->getShareType() === \OCP\Share::SHARE_TYPE_CIRCLE) {
+ } elseif ($share->getShareType() === IShare::TYPE_CIRCLE) {
$circle = \OCA\Circles\Api\v1\Circles::detailsCircle($share->getSharedWith());
if ($circle === null) {
throw new \InvalidArgumentException('SharedWith is not a valid circle');
}
- } elseif ($share->getShareType() === \OCP\Share::SHARE_TYPE_ROOM) {
+ } elseif ($share->getShareType() === IShare::TYPE_ROOM) {
} else {
// We can't handle other types yet
throw new \InvalidArgumentException('unknown share type');
@@ -258,7 +258,7 @@ class Manager implements IManager {
}
// Cannot share with yourself
- if ($share->getShareType() === \OCP\Share::SHARE_TYPE_USER &&
+ if ($share->getShareType() === IShare::TYPE_USER &&
$share->getSharedWith() === $share->getSharedBy()) {
throw new \InvalidArgumentException('Can’t share with yourself');
}
@@ -306,12 +306,12 @@ class Manager implements IManager {
$userMountPoint = array_shift($userMountPoints);
/* Check if this is an incoming share */
- $incomingShares = $this->getSharedWith($share->getSharedBy(), Share::SHARE_TYPE_USER, $userMountPoint, -1, 0);
- $incomingShares = array_merge($incomingShares, $this->getSharedWith($share->getSharedBy(), Share::SHARE_TYPE_GROUP, $userMountPoint, -1, 0));
- $incomingShares = array_merge($incomingShares, $this->getSharedWith($share->getSharedBy(), Share::SHARE_TYPE_CIRCLE, $userMountPoint, -1, 0));
- $incomingShares = array_merge($incomingShares, $this->getSharedWith($share->getSharedBy(), Share::SHARE_TYPE_ROOM, $userMountPoint, -1, 0));
+ $incomingShares = $this->getSharedWith($share->getSharedBy(), IShare::TYPE_USER, $userMountPoint, -1, 0);
+ $incomingShares = array_merge($incomingShares, $this->getSharedWith($share->getSharedBy(), IShare::TYPE_GROUP, $userMountPoint, -1, 0));
+ $incomingShares = array_merge($incomingShares, $this->getSharedWith($share->getSharedBy(), IShare::TYPE_CIRCLE, $userMountPoint, -1, 0));
+ $incomingShares = array_merge($incomingShares, $this->getSharedWith($share->getSharedBy(), IShare::TYPE_ROOM, $userMountPoint, -1, 0));
- /** @var \OCP\Share\IShare[] $incomingShares */
+ /** @var IShare[] $incomingShares */
if (!empty($incomingShares)) {
foreach ($incomingShares as $incomingShare) {
$permissions |= $incomingShare->getPermissions();
@@ -339,8 +339,8 @@ class Manager implements IManager {
// Check that read permissions are always set
// Link shares are allowed to have no read permissions to allow upload to hidden folders
- $noReadPermissionRequired = $share->getShareType() === \OCP\Share::SHARE_TYPE_LINK
- || $share->getShareType() === \OCP\Share::SHARE_TYPE_EMAIL;
+ $noReadPermissionRequired = $share->getShareType() === IShare::TYPE_LINK
+ || $share->getShareType() === IShare::TYPE_EMAIL;
if (!$noReadPermissionRequired &&
($share->getPermissions() & \OCP\Constants::PERMISSION_READ) === 0) {
throw new \InvalidArgumentException('Shares need at least read permissions');
@@ -361,13 +361,13 @@ class Manager implements IManager {
/**
* Validate if the expiration date fits the system settings
*
- * @param \OCP\Share\IShare $share The share to validate the expiration date of
- * @return \OCP\Share\IShare The modified share object
+ * @param IShare $share The share to validate the expiration date of
+ * @return IShare The modified share object
* @throws GenericShareException
* @throws \InvalidArgumentException
* @throws \Exception
*/
- protected function validateExpirationDateInternal(\OCP\Share\IShare $share) {
+ protected function validateExpirationDateInternal(IShare $share) {
$expirationDate = $share->getExpirationDate();
if ($expirationDate !== null) {
@@ -437,13 +437,13 @@ class Manager implements IManager {
/**
* Validate if the expiration date fits the system settings
*
- * @param \OCP\Share\IShare $share The share to validate the expiration date of
- * @return \OCP\Share\IShare The modified share object
+ * @param IShare $share The share to validate the expiration date of
+ * @return IShare The modified share object
* @throws GenericShareException
* @throws \InvalidArgumentException
* @throws \Exception
*/
- protected function validateExpirationDate(\OCP\Share\IShare $share) {
+ protected function validateExpirationDate(IShare $share) {
$expirationDate = $share->getExpirationDate();
if ($expirationDate !== null) {
@@ -513,10 +513,10 @@ class Manager implements IManager {
/**
* Check for pre share requirements for user shares
*
- * @param \OCP\Share\IShare $share
+ * @param IShare $share
* @throws \Exception
*/
- protected function userCreateChecks(\OCP\Share\IShare $share) {
+ protected function userCreateChecks(IShare $share) {
// Check if we can share with group members only
if ($this->shareWithGroupMembersOnly()) {
$sharedBy = $this->userManager->get($share->getSharedBy());
@@ -536,7 +536,7 @@ class Manager implements IManager {
*
* Also this is not what we want in the future.. then we want to squash identical shares.
*/
- $provider = $this->factory->getProviderForType(\OCP\Share::SHARE_TYPE_USER);
+ $provider = $this->factory->getProviderForType(IShare::TYPE_USER);
$existingShares = $provider->getSharesByPath($share->getNode());
foreach ($existingShares as $existingShare) {
// Ignore if it is the same share
@@ -554,7 +554,7 @@ class Manager implements IManager {
}
// The share is already shared with this user via a group share
- if ($existingShare->getShareType() === \OCP\Share::SHARE_TYPE_GROUP) {
+ if ($existingShare->getShareType() === IShare::TYPE_GROUP) {
$group = $this->groupManager->get($existingShare->getSharedWith());
if (!is_null($group)) {
$user = $this->userManager->get($share->getSharedWith());
@@ -570,10 +570,10 @@ class Manager implements IManager {
/**
* Check for pre share requirements for group shares
*
- * @param \OCP\Share\IShare $share
+ * @param IShare $share
* @throws \Exception
*/
- protected function groupCreateChecks(\OCP\Share\IShare $share) {
+ protected function groupCreateChecks(IShare $share) {
// Verify group shares are allowed
if (!$this->allowGroupSharing()) {
throw new \Exception('Group sharing is now allowed');
@@ -593,7 +593,7 @@ class Manager implements IManager {
*
* Also this is not what we want in the future.. then we want to squash identical shares.
*/
- $provider = $this->factory->getProviderForType(\OCP\Share::SHARE_TYPE_GROUP);
+ $provider = $this->factory->getProviderForType(IShare::TYPE_GROUP);
$existingShares = $provider->getSharesByPath($share->getNode());
foreach ($existingShares as $existingShare) {
try {
@@ -613,10 +613,10 @@ class Manager implements IManager {
/**
* Check for pre share requirements for link shares
*
- * @param \OCP\Share\IShare $share
+ * @param IShare $share
* @throws \Exception
*/
- protected function linkCreateChecks(\OCP\Share\IShare $share) {
+ protected function linkCreateChecks(IShare $share) {
// Are link shares allowed?
if (!$this->shareApiAllowLinks()) {
throw new \Exception('Link sharing is not allowed');
@@ -638,9 +638,9 @@ class Manager implements IManager {
*
* FIXME: Remove once multiple link shares can be properly displayed
*
- * @param \OCP\Share\IShare $share
+ * @param IShare $share
*/
- protected function setLinkParent(\OCP\Share\IShare $share) {
+ protected function setLinkParent(IShare $share) {
// No sense in checking if the method is not there.
if (method_exists($share, 'setParent')) {
@@ -670,10 +670,10 @@ class Manager implements IManager {
/**
* Check if the user that is sharing can actually share
*
- * @param \OCP\Share\IShare $share
+ * @param IShare $share
* @throws \Exception
*/
- protected function canShare(\OCP\Share\IShare $share) {
+ protected function canShare(IShare $share) {
if (!$this->shareApiEnabled()) {
throw new \Exception('Sharing is disabled');
}
@@ -686,13 +686,13 @@ class Manager implements IManager {
/**
* Share a path
*
- * @param \OCP\Share\IShare $share
+ * @param IShare $share
* @return Share The share object
* @throws \Exception
*
* TODO: handle link share permissions or check them
*/
- public function createShare(\OCP\Share\IShare $share) {
+ public function createShare(IShare $share) {
$this->canShare($share);
$this->generalCreateChecks($share);
@@ -720,17 +720,17 @@ class Manager implements IManager {
}
//Verify share type
- if ($share->getShareType() === \OCP\Share::SHARE_TYPE_USER) {
+ if ($share->getShareType() === IShare::TYPE_USER) {
$this->userCreateChecks($share);
//Verify the expiration date
$share = $this->validateExpirationDateInternal($share);
- } elseif ($share->getShareType() === \OCP\Share::SHARE_TYPE_GROUP) {
+ } elseif ($share->getShareType() === IShare::TYPE_GROUP) {
$this->groupCreateChecks($share);
//Verify the expiration date
$share = $this->validateExpirationDateInternal($share);
- } elseif ($share->getShareType() === \OCP\Share::SHARE_TYPE_LINK) {
+ } elseif ($share->getShareType() === IShare::TYPE_LINK) {
$this->linkCreateChecks($share);
$this->setLinkParent($share);
@@ -754,7 +754,7 @@ class Manager implements IManager {
if ($share->getPassword() !== null) {
$share->setPassword($this->hasher->hash($share->getPassword()));
}
- } elseif ($share->getShareType() === \OCP\Share::SHARE_TYPE_EMAIL) {
+ } elseif ($share->getShareType() === IShare::TYPE_EMAIL) {
$share->setToken(
$this->secureRandom->generate(
\OC\Share\Constants::TOKEN_LENGTH,
@@ -764,7 +764,7 @@ class Manager implements IManager {
}
// Cannot share with the owner
- if ($share->getShareType() === \OCP\Share::SHARE_TYPE_USER &&
+ if ($share->getShareType() === IShare::TYPE_USER &&
$share->getSharedWith() === $share->getShareOwner()) {
throw new \InvalidArgumentException('Can’t share with the share owner');
}
@@ -798,7 +798,7 @@ class Manager implements IManager {
$this->dispatcher->dispatchTyped(new Share\Events\ShareCreatedEvent($share));
- if ($share->getShareType() === \OCP\Share::SHARE_TYPE_USER) {
+ if ($share->getShareType() === IShare::TYPE_USER) {
$mailSend = $share->getMailSend();
if ($mailSend === true) {
$user = $this->userManager->get($share->getSharedWith());
@@ -913,11 +913,11 @@ class Manager implements IManager {
/**
* Update a share
*
- * @param \OCP\Share\IShare $share
- * @return \OCP\Share\IShare The share object
+ * @param IShare $share
+ * @return IShare The share object
* @throws \InvalidArgumentException
*/
- public function updateShare(\OCP\Share\IShare $share) {
+ public function updateShare(IShare $share) {
$expirationDateUpdated = false;
$this->canShare($share);
@@ -935,19 +935,19 @@ class Manager implements IManager {
// We can only change the recipient on user shares
if ($share->getSharedWith() !== $originalShare->getSharedWith() &&
- $share->getShareType() !== \OCP\Share::SHARE_TYPE_USER) {
+ $share->getShareType() !== IShare::TYPE_USER) {
throw new \InvalidArgumentException('Can only update recipient on user shares');
}
// Cannot share with the owner
- if ($share->getShareType() === \OCP\Share::SHARE_TYPE_USER &&
+ if ($share->getShareType() === IShare::TYPE_USER &&
$share->getSharedWith() === $share->getShareOwner()) {
throw new \InvalidArgumentException('Can’t share with the share owner');
}
$this->generalCreateChecks($share);
- if ($share->getShareType() === \OCP\Share::SHARE_TYPE_USER) {
+ if ($share->getShareType() === IShare::TYPE_USER) {
$this->userCreateChecks($share);
if ($share->getExpirationDate() != $originalShare->getExpirationDate()) {
@@ -955,7 +955,7 @@ class Manager implements IManager {
$this->validateExpirationDate($share);
$expirationDateUpdated = true;
}
- } elseif ($share->getShareType() === \OCP\Share::SHARE_TYPE_GROUP) {
+ } elseif ($share->getShareType() === IShare::TYPE_GROUP) {
$this->groupCreateChecks($share);
if ($share->getExpirationDate() != $originalShare->getExpirationDate()) {
@@ -963,7 +963,7 @@ class Manager implements IManager {
$this->validateExpirationDate($share);
$expirationDateUpdated = true;
}
- } elseif ($share->getShareType() === \OCP\Share::SHARE_TYPE_LINK) {
+ } elseif ($share->getShareType() === IShare::TYPE_LINK) {
$this->linkCreateChecks($share);
$plainTextPassword = $share->getPassword();
@@ -979,7 +979,7 @@ class Manager implements IManager {
$this->validateExpirationDate($share);
$expirationDateUpdated = true;
}
- } elseif ($share->getShareType() === \OCP\Share::SHARE_TYPE_EMAIL) {
+ } elseif ($share->getShareType() === IShare::TYPE_EMAIL) {
// The new password is not set again if it is the same as the old
// one.
$plainTextPassword = $share->getPassword();
@@ -1000,7 +1000,7 @@ class Manager implements IManager {
// Now update the share!
$provider = $this->factory->getProviderForType($share->getShareType());
- if ($share->getShareType() === \OCP\Share::SHARE_TYPE_EMAIL) {
+ if ($share->getShareType() === IShare::TYPE_EMAIL) {
$share = $provider->update($share, $plainTextPassword);
} else {
$share = $provider->update($share);
@@ -1073,12 +1073,12 @@ class Manager implements IManager {
* Updates the password of the given share if it is not the same as the
* password of the original share.
*
- * @param \OCP\Share\IShare $share the share to update its password.
- * @param \OCP\Share\IShare $originalShare the original share to compare its
+ * @param IShare $share the share to update its password.
+ * @param IShare $originalShare the original share to compare its
* password with.
* @return boolean whether the password was updated or not.
*/
- private function updateSharePasswordIfNeeded(\OCP\Share\IShare $share, \OCP\Share\IShare $originalShare) {
+ private function updateSharePasswordIfNeeded(IShare $share, IShare $originalShare) {
$passwordsAreDifferent = ($share->getPassword() !== $originalShare->getPassword()) &&
(($share->getPassword() !== null && $originalShare->getPassword() === null) ||
($share->getPassword() === null && $originalShare->getPassword() !== null) ||
@@ -1109,10 +1109,10 @@ class Manager implements IManager {
* Delete all the children of this share
* FIXME: remove once https://github.com/owncloud/core/pull/21660 is in
*
- * @param \OCP\Share\IShare $share
- * @return \OCP\Share\IShare[] List of deleted shares
+ * @param IShare $share
+ * @return IShare[] List of deleted shares
*/
- protected function deleteChildren(\OCP\Share\IShare $share) {
+ protected function deleteChildren(IShare $share) {
$deletedShares = [];
$provider = $this->factory->getProviderForType($share->getShareType());
@@ -1131,11 +1131,11 @@ class Manager implements IManager {
/**
* Delete a share
*
- * @param \OCP\Share\IShare $share
+ * @param IShare $share
* @throws ShareNotFound
* @throws \InvalidArgumentException
*/
- public function deleteShare(\OCP\Share\IShare $share) {
+ public function deleteShare(IShare $share) {
try {
$share->getFullId();
} catch (\UnexpectedValueException $e) {
@@ -1167,10 +1167,10 @@ class Manager implements IManager {
* the users in a groups deletes that share. But the provider should
* handle this.
*
- * @param \OCP\Share\IShare $share
+ * @param IShare $share
* @param string $recipientId
*/
- public function deleteFromSelf(\OCP\Share\IShare $share, $recipientId) {
+ public function deleteFromSelf(IShare $share, $recipientId) {
list($providerId, ) = $this->splitFullId($share->getFullId());
$provider = $this->factory->getProvider($providerId);
@@ -1189,16 +1189,16 @@ class Manager implements IManager {
/**
* @inheritdoc
*/
- public function moveShare(\OCP\Share\IShare $share, $recipientId) {
- if ($share->getShareType() === \OCP\Share::SHARE_TYPE_LINK) {
+ public function moveShare(IShare $share, $recipientId) {
+ if ($share->getShareType() === IShare::TYPE_LINK) {
throw new \InvalidArgumentException('Can’t change target of link share');
}
- if ($share->getShareType() === \OCP\Share::SHARE_TYPE_USER && $share->getSharedWith() !== $recipientId) {
+ if ($share->getShareType() === IShare::TYPE_USER && $share->getSharedWith() !== $recipientId) {
throw new \InvalidArgumentException('Invalid recipient');
}
- if ($share->getShareType() === \OCP\Share::SHARE_TYPE_GROUP) {
+ if ($share->getShareType() === IShare::TYPE_GROUP) {
$sharedWith = $this->groupManager->get($share->getSharedWith());
if (is_null($sharedWith)) {
throw new \InvalidArgumentException('Group "' . $share->getSharedWith() . '" does not exist');
@@ -1399,7 +1399,7 @@ class Manager implements IManager {
$share = null;
try {
if ($this->shareApiAllowLinks()) {
- $provider = $this->factory->getProviderForType(\OCP\Share::SHARE_TYPE_LINK);
+ $provider = $this->factory->getProviderForType(IShare::TYPE_LINK);
$share = $provider->getShareByToken($token);
}
} catch (ProviderException $e) {
@@ -1410,7 +1410,7 @@ class Manager implements IManager {
// If it is not a link share try to fetch a federated share by token
if ($share === null) {
try {
- $provider = $this->factory->getProviderForType(\OCP\Share::SHARE_TYPE_REMOTE);
+ $provider = $this->factory->getProviderForType(IShare::TYPE_REMOTE);
$share = $provider->getShareByToken($token);
} catch (ProviderException $e) {
} catch (ShareNotFound $e) {
@@ -1418,27 +1418,27 @@ class Manager implements IManager {
}
// If it is not a link share try to fetch a mail share by token
- if ($share === null && $this->shareProviderExists(\OCP\Share::SHARE_TYPE_EMAIL)) {
+ if ($share === null && $this->shareProviderExists(IShare::TYPE_EMAIL)) {
try {
- $provider = $this->factory->getProviderForType(\OCP\Share::SHARE_TYPE_EMAIL);
+ $provider = $this->factory->getProviderForType(IShare::TYPE_EMAIL);
$share = $provider->getShareByToken($token);
} catch (ProviderException $e) {
} catch (ShareNotFound $e) {
}
}
- if ($share === null && $this->shareProviderExists(\OCP\Share::SHARE_TYPE_CIRCLE)) {
+ if ($share === null && $this->shareProviderExists(IShare::TYPE_CIRCLE)) {
try {
- $provider = $this->factory->getProviderForType(\OCP\Share::SHARE_TYPE_CIRCLE);
+ $provider = $this->factory->getProviderForType(IShare::TYPE_CIRCLE);
$share = $provider->getShareByToken($token);
} catch (ProviderException $e) {
} catch (ShareNotFound $e) {
}
}
- if ($share === null && $this->shareProviderExists(\OCP\Share::SHARE_TYPE_ROOM)) {
+ if ($share === null && $this->shareProviderExists(IShare::TYPE_ROOM)) {
try {
- $provider = $this->factory->getProviderForType(\OCP\Share::SHARE_TYPE_ROOM);
+ $provider = $this->factory->getProviderForType(IShare::TYPE_ROOM);
$share = $provider->getShareByToken($token);
} catch (ProviderException $e) {
} catch (ShareNotFound $e) {
@@ -1454,7 +1454,7 @@ class Manager implements IManager {
/*
* Reduce the permissions for link shares if public upload is not enabled
*/
- if ($share->getShareType() === \OCP\Share::SHARE_TYPE_LINK &&
+ if ($share->getShareType() === IShare::TYPE_LINK &&
!$this->shareApiLinkAllowPublicUpload()) {
$share->setPermissions($share->getPermissions() & ~(\OCP\Constants::PERMISSION_CREATE | \OCP\Constants::PERMISSION_UPDATE));
}
@@ -1472,11 +1472,11 @@ class Manager implements IManager {
/**
* Verify the password of a public share
*
- * @param \OCP\Share\IShare $share
+ * @param IShare $share
* @param string $password
* @return bool
*/
- public function checkPassword(\OCP\Share\IShare $share, $password) {
+ public function checkPassword(IShare $share, $password) {
$passwordProtected = $share->getShareType() !== IShare::TYPE_LINK
|| $share->getShareType() !== IShare::TYPE_EMAIL
|| $share->getShareType() !== IShare::TYPE_CIRCLE;
@@ -1507,7 +1507,7 @@ class Manager implements IManager {
* @inheritdoc
*/
public function userDeleted($uid) {
- $types = [\OCP\Share::SHARE_TYPE_USER, \OCP\Share::SHARE_TYPE_GROUP, \OCP\Share::SHARE_TYPE_LINK, \OCP\Share::SHARE_TYPE_REMOTE, \OCP\Share::SHARE_TYPE_EMAIL];
+ $types = [IShare::TYPE_USER, IShare::TYPE_GROUP, IShare::TYPE_LINK, IShare::TYPE_REMOTE, IShare::TYPE_EMAIL];
foreach ($types as $type) {
try {
@@ -1523,7 +1523,7 @@ class Manager implements IManager {
* @inheritdoc
*/
public function groupDeleted($gid) {
- $provider = $this->factory->getProviderForType(\OCP\Share::SHARE_TYPE_GROUP);
+ $provider = $this->factory->getProviderForType(IShare::TYPE_GROUP);
$provider->groupDeleted($gid);
$excludedGroups = $this->config->getAppValue('core', 'shareapi_exclude_groups_list', '');
@@ -1544,7 +1544,7 @@ class Manager implements IManager {
* @inheritdoc
*/
public function userDeletedFromGroup($uid, $gid) {
- $provider = $this->factory->getProviderForType(\OCP\Share::SHARE_TYPE_GROUP);
+ $provider = $this->factory->getProviderForType(IShare::TYPE_GROUP);
$provider->userDeletedFromGroup($uid, $gid);
}
@@ -1679,7 +1679,8 @@ class Manager implements IManager {
/**
* Create a new share
- * @return \OCP\Share\IShare
+ *
+ * @return IShare
*/
public function newShare() {
return new \OC\Share20\Share($this->rootFolder, $this->userManager);
diff --git a/lib/private/Share20/ProviderFactory.php b/lib/private/Share20/ProviderFactory.php
index 73a14dd4ac1..128033f6498 100644
--- a/lib/private/Share20/ProviderFactory.php
+++ b/lib/private/Share20/ProviderFactory.php
@@ -41,6 +41,7 @@ use OCA\ShareByMail\ShareByMailProvider;
use OCP\Defaults;
use OCP\IServerContainer;
use OCP\Share\IProviderFactory;
+use OCP\Share\IShare;
/**
* Class ProviderFactory
@@ -278,18 +279,18 @@ class ProviderFactory implements IProviderFactory {
public function getProviderForType($shareType) {
$provider = null;
- if ($shareType === \OCP\Share::SHARE_TYPE_USER ||
- $shareType === \OCP\Share::SHARE_TYPE_GROUP ||
- $shareType === \OCP\Share::SHARE_TYPE_LINK
+ if ($shareType === IShare::TYPE_USER ||
+ $shareType === IShare::TYPE_GROUP ||
+ $shareType === IShare::TYPE_LINK
) {
$provider = $this->defaultShareProvider();
- } elseif ($shareType === \OCP\Share::SHARE_TYPE_REMOTE || $shareType === \OCP\Share::SHARE_TYPE_REMOTE_GROUP) {
+ } elseif ($shareType === IShare::TYPE_REMOTE || $shareType === IShare::TYPE_REMOTE_GROUP) {
$provider = $this->federatedShareProvider();
- } elseif ($shareType === \OCP\Share::SHARE_TYPE_EMAIL) {
+ } elseif ($shareType === IShare::TYPE_EMAIL) {
$provider = $this->getShareByMailProvider();
- } elseif ($shareType === \OCP\Share::SHARE_TYPE_CIRCLE) {
+ } elseif ($shareType === IShare::TYPE_CIRCLE) {
$provider = $this->getShareByCircleProvider();
- } elseif ($shareType === \OCP\Share::SHARE_TYPE_ROOM) {
+ } elseif ($shareType === IShare::TYPE_ROOM) {
$provider = $this->getRoomShareProvider();
}