summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/private/Collaboration/Collaborators/GroupPlugin.php8
-rw-r--r--lib/private/Collaboration/Collaborators/LookupPlugin.php4
-rw-r--r--lib/private/Collaboration/Collaborators/MailPlugin.php12
-rw-r--r--lib/private/Collaboration/Collaborators/RemoteGroupPlugin.php3
-rw-r--r--lib/private/Collaboration/Collaborators/RemotePlugin.php10
-rw-r--r--lib/private/Collaboration/Collaborators/UserPlugin.php4
-rw-r--r--lib/private/Federation/CloudFederationShare.php3
-rw-r--r--lib/private/Repair/OldGroupMembershipShares.php4
-rw-r--r--lib/private/Share/Helper.php7
-rw-r--r--lib/private/Share/Share.php45
-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
14 files changed, 208 insertions, 202 deletions
diff --git a/lib/private/Collaboration/Collaborators/GroupPlugin.php b/lib/private/Collaboration/Collaborators/GroupPlugin.php
index 4816fdd7c04..d4051cab36f 100644
--- a/lib/private/Collaboration/Collaborators/GroupPlugin.php
+++ b/lib/private/Collaboration/Collaborators/GroupPlugin.php
@@ -34,7 +34,7 @@ use OCP\IConfig;
use OCP\IGroup;
use OCP\IGroupManager;
use OCP\IUserSession;
-use OCP\Share;
+use OCP\Share\IShare;
class GroupPlugin implements ISearchPlugin {
protected $shareeEnumeration;
@@ -95,7 +95,7 @@ class GroupPlugin implements ISearchPlugin {
$result['exact'][] = [
'label' => $group->getDisplayName(),
'value' => [
- 'shareType' => Share::SHARE_TYPE_GROUP,
+ 'shareType' => IShare::TYPE_GROUP,
'shareWith' => $gid,
],
];
@@ -106,7 +106,7 @@ class GroupPlugin implements ISearchPlugin {
$result['wide'][] = [
'label' => $group->getDisplayName(),
'value' => [
- 'shareType' => Share::SHARE_TYPE_GROUP,
+ 'shareType' => IShare::TYPE_GROUP,
'shareWith' => $gid,
],
];
@@ -121,7 +121,7 @@ class GroupPlugin implements ISearchPlugin {
$result['exact'][] = [
'label' => $group->getDisplayName(),
'value' => [
- 'shareType' => Share::SHARE_TYPE_GROUP,
+ 'shareType' => IShare::TYPE_GROUP,
'shareWith' => $group->getGID(),
],
];
diff --git a/lib/private/Collaboration/Collaborators/LookupPlugin.php b/lib/private/Collaboration/Collaborators/LookupPlugin.php
index f0d5b92f18a..ab36d712d2a 100644
--- a/lib/private/Collaboration/Collaborators/LookupPlugin.php
+++ b/lib/private/Collaboration/Collaborators/LookupPlugin.php
@@ -34,7 +34,7 @@ use OCP\Http\Client\IClientService;
use OCP\IConfig;
use OCP\ILogger;
use OCP\IUserSession;
-use OCP\Share;
+use OCP\Share\IShare;
class LookupPlugin implements ISearchPlugin {
@@ -107,7 +107,7 @@ class LookupPlugin implements ISearchPlugin {
$result[] = [
'label' => $label,
'value' => [
- 'shareType' => Share::SHARE_TYPE_REMOTE,
+ 'shareType' => IShare::TYPE_REMOTE,
'shareWith' => $lookup['federationId'],
],
'extra' => $lookup,
diff --git a/lib/private/Collaboration/Collaborators/MailPlugin.php b/lib/private/Collaboration/Collaborators/MailPlugin.php
index f912690cb72..90dc5919176 100644
--- a/lib/private/Collaboration/Collaborators/MailPlugin.php
+++ b/lib/private/Collaboration/Collaborators/MailPlugin.php
@@ -37,7 +37,7 @@ use OCP\IConfig;
use OCP\IGroupManager;
use OCP\IUser;
use OCP\IUserSession;
-use OCP\Share;
+use OCP\Share\IShare;
class MailPlugin implements ISearchPlugin {
protected $shareeEnumeration;
@@ -133,7 +133,7 @@ class MailPlugin implements ISearchPlugin {
'uuid' => $contact['UID'],
'name' => $contact['FN'],
'value' => [
- 'shareType' => Share::SHARE_TYPE_USER,
+ 'shareType' => IShare::TYPE_USER,
'shareWith' => $cloud->getUser(),
],
]];
@@ -167,7 +167,7 @@ class MailPlugin implements ISearchPlugin {
'uuid' => $contact['UID'],
'name' => $contact['FN'],
'value' => [
- 'shareType' => Share::SHARE_TYPE_USER,
+ 'shareType' => IShare::TYPE_USER,
'shareWith' => $cloud->getUser(),
],
];
@@ -188,7 +188,7 @@ class MailPlugin implements ISearchPlugin {
'name' => $contact['FN'],
'type' => $emailAddressType ?? '',
'value' => [
- 'shareType' => Share::SHARE_TYPE_EMAIL,
+ 'shareType' => IShare::TYPE_EMAIL,
'shareWith' => $emailAddress,
],
];
@@ -199,7 +199,7 @@ class MailPlugin implements ISearchPlugin {
'name' => $contact['FN'],
'type' => $emailAddressType ?? '',
'value' => [
- 'shareType' => Share::SHARE_TYPE_EMAIL,
+ 'shareType' => IShare::TYPE_EMAIL,
'shareWith' => $emailAddress,
],
];
@@ -226,7 +226,7 @@ class MailPlugin implements ISearchPlugin {
'label' => $search,
'uuid' => $search,
'value' => [
- 'shareType' => Share::SHARE_TYPE_EMAIL,
+ 'shareType' => IShare::TYPE_EMAIL,
'shareWith' => $search,
],
];
diff --git a/lib/private/Collaboration/Collaborators/RemoteGroupPlugin.php b/lib/private/Collaboration/Collaborators/RemoteGroupPlugin.php
index 777af6093db..17e7793a685 100644
--- a/lib/private/Collaboration/Collaborators/RemoteGroupPlugin.php
+++ b/lib/private/Collaboration/Collaborators/RemoteGroupPlugin.php
@@ -30,6 +30,7 @@ use OCP\Collaboration\Collaborators\SearchResultType;
use OCP\Federation\ICloudFederationProviderManager;
use OCP\Federation\ICloudIdManager;
use OCP\Share;
+use OCP\Share\IShare;
class RemoteGroupPlugin implements ISearchPlugin {
protected $shareeEnumeration;
@@ -63,7 +64,7 @@ class RemoteGroupPlugin implements ISearchPlugin {
'guid' => $remoteGroup,
'name' => $remoteGroup,
'value' => [
- 'shareType' => Share::SHARE_TYPE_REMOTE_GROUP,
+ 'shareType' => IShare::TYPE_REMOTE_GROUP,
'shareWith' => $search,
'server' => $serverUrl,
],
diff --git a/lib/private/Collaboration/Collaborators/RemotePlugin.php b/lib/private/Collaboration/Collaborators/RemotePlugin.php
index 81e05050d2e..af94027fbe9 100644
--- a/lib/private/Collaboration/Collaborators/RemotePlugin.php
+++ b/lib/private/Collaboration/Collaborators/RemotePlugin.php
@@ -35,7 +35,7 @@ use OCP\Federation\ICloudIdManager;
use OCP\IConfig;
use OCP\IUserManager;
use OCP\IUserSession;
-use OCP\Share;
+use OCP\Share\IShare;
class RemotePlugin implements ISearchPlugin {
protected $shareeEnumeration;
@@ -101,7 +101,7 @@ class RemotePlugin implements ISearchPlugin {
'label' => $contact['FN'],
'uuid' => $contact['UID'],
'value' => [
- 'shareType' => Share::SHARE_TYPE_USER,
+ 'shareType' => IShare::TYPE_USER,
'shareWith' => $remoteUser
]
];
@@ -117,7 +117,7 @@ class RemotePlugin implements ISearchPlugin {
'name' => $contact['FN'],
'type' => $cloudIdType,
'value' => [
- 'shareType' => Share::SHARE_TYPE_REMOTE,
+ 'shareType' => IShare::TYPE_REMOTE,
'shareWith' => $cloudId,
'server' => $serverUrl,
],
@@ -129,7 +129,7 @@ class RemotePlugin implements ISearchPlugin {
'name' => $contact['FN'],
'type' => $cloudIdType,
'value' => [
- 'shareType' => Share::SHARE_TYPE_REMOTE,
+ 'shareType' => IShare::TYPE_REMOTE,
'shareWith' => $cloudId,
'server' => $serverUrl,
],
@@ -158,7 +158,7 @@ class RemotePlugin implements ISearchPlugin {
'uuid' => $remoteUser,
'name' => $remoteUser,
'value' => [
- 'shareType' => Share::SHARE_TYPE_REMOTE,
+ 'shareType' => IShare::TYPE_REMOTE,
'shareWith' => $search,
'server' => $serverUrl,
],
diff --git a/lib/private/Collaboration/Collaborators/UserPlugin.php b/lib/private/Collaboration/Collaborators/UserPlugin.php
index 123fa731445..c5600fce070 100644
--- a/lib/private/Collaboration/Collaborators/UserPlugin.php
+++ b/lib/private/Collaboration/Collaborators/UserPlugin.php
@@ -115,7 +115,7 @@ class UserPlugin implements ISearchPlugin {
$result['exact'][] = [
'label' => $userDisplayName,
'value' => [
- 'shareType' => Share::SHARE_TYPE_USER,
+ 'shareType' => IShare::TYPE_USER,
'shareWith' => $uid,
],
];
@@ -161,7 +161,7 @@ class UserPlugin implements ISearchPlugin {
$result['exact'][] = [
'label' => $user->getDisplayName(),
'value' => [
- 'shareType' => Share::SHARE_TYPE_USER,
+ 'shareType' => IShare::TYPE_USER,
'shareWith' => $user->getUID(),
],
];
diff --git a/lib/private/Federation/CloudFederationShare.php b/lib/private/Federation/CloudFederationShare.php
index 16f4216d65e..507a3cd061a 100644
--- a/lib/private/Federation/CloudFederationShare.php
+++ b/lib/private/Federation/CloudFederationShare.php
@@ -24,6 +24,7 @@
namespace OC\Federation;
use OCP\Federation\ICloudFederationShare;
+use OCP\Share\IShare;
class CloudFederationShare implements ICloudFederationShare {
private $share = [
@@ -204,7 +205,7 @@ class CloudFederationShare implements ICloudFederationShare {
* @since 14.0.0
*/
public function setShareType($shareType) {
- if ($shareType === 'group' || $shareType === \OCP\Share::SHARE_TYPE_REMOTE_GROUP) {
+ if ($shareType === 'group' || $shareType === IShare::TYPE_REMOTE_GROUP) {
$this->share['shareType'] = 'group';
} else {
$this->share['shareType'] = 'user';
diff --git a/lib/private/Repair/OldGroupMembershipShares.php b/lib/private/Repair/OldGroupMembershipShares.php
index ae4c501d251..2b2fd9cd470 100644
--- a/lib/private/Repair/OldGroupMembershipShares.php
+++ b/lib/private/Repair/OldGroupMembershipShares.php
@@ -28,7 +28,7 @@ use OCP\IDBConnection;
use OCP\IGroupManager;
use OCP\Migration\IOutput;
use OCP\Migration\IRepairStep;
-use OCP\Share;
+use OCP\Share\IShare;
class OldGroupMembershipShares implements IRepairStep {
@@ -78,7 +78,7 @@ class OldGroupMembershipShares implements IRepairStep {
// \OC\Share\Constant::$shareTypeGroupUserUnique === 2
->andWhere($query->expr()->eq('s1.share_type', $query->expr()->literal(2)))
->andWhere($query->expr()->isNotNull('s2.id'))
- ->andWhere($query->expr()->eq('s2.share_type', $query->expr()->literal(Share::SHARE_TYPE_GROUP)))
+ ->andWhere($query->expr()->eq('s2.share_type', $query->expr()->literal(IShare::TYPE_GROUP)))
->leftJoin('s1', 'share', 's2', $query->expr()->eq('s1.parent', 's2.id'));
$deleteQuery = $this->connection->getQueryBuilder();
diff --git a/lib/private/Share/Helper.php b/lib/private/Share/Helper.php
index ec5136040e8..90dc3e957e9 100644
--- a/lib/private/Share/Helper.php
+++ b/lib/private/Share/Helper.php
@@ -31,6 +31,7 @@
namespace OC\Share;
use OC\HintException;
+use OCP\Share\IShare;
class Helper extends \OC\Share\Constants {
@@ -49,13 +50,13 @@ class Helper extends \OC\Share\Constants {
public static function generateTarget($itemType, $itemSource, $shareType, $shareWith, $uidOwner, $suggestedTarget = null, $groupParent = null) {
// FIXME: $uidOwner and $groupParent seems to be unused
$backend = \OC\Share\Share::getBackend($itemType);
- if ($shareType === self::SHARE_TYPE_LINK || $shareType === self::SHARE_TYPE_REMOTE) {
+ if ($shareType === IShare::TYPE_LINK || $shareType === IShare::TYPE_REMOTE) {
if (isset($suggestedTarget)) {
return $suggestedTarget;
}
return $backend->generateTarget($itemSource, false);
} else {
- if ($shareType == self::SHARE_TYPE_USER) {
+ if ($shareType == IShare::TYPE_USER) {
// Share with is a user, so set share type to user and groups
$shareType = self::$shareTypeUserAndGroups;
}
@@ -64,7 +65,7 @@ class Helper extends \OC\Share\Constants {
if (!isset($suggestedTarget)) {
$suggestedTarget = $itemSource;
}
- if ($shareType == self::SHARE_TYPE_GROUP) {
+ if ($shareType == IShare::TYPE_GROUP) {
$target = $backend->generateTarget($suggestedTarget, false);
} else {
$target = $backend->generateTarget($suggestedTarget, $shareWith);
diff --git a/lib/private/Share/Share.php b/lib/private/Share/Share.php
index 8ea97cd69a7..c624f243123 100644
--- a/lib/private/Share/Share.php
+++ b/lib/private/Share/Share.php
@@ -39,6 +39,7 @@ namespace OC\Share;
use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\ILogger;
+use OCP\Share\IShare;
/**
* This class provides the ability for apps to share their content between users.
@@ -278,7 +279,7 @@ class Share extends Constants {
* @since 5.0.0 - parameter $itemSourceName was added in 6.0.0, parameter $expirationDate was added in 7.0.0, parameter $passwordChanged added in 9.0.0
* @deprecated 14.0.0 TESTS ONLY - this methods is as of 2018-06 only used by tests
* called like this:
- * \OC\Share\Share::shareItem('test', 1, \OCP\Share::SHARE_TYPE_USER, $otherUserId, \OCP\Constants::PERMISSION_READ);
+ * \OC\Share\Share::shareItem('test', 1, IShare::TYPE_USER, $otherUserId, \OCP\Constants::PERMISSION_READ);
*/
public static function shareItem($itemType, $itemSource, $shareType, $shareWith, $permissions) {
$backend = self::getBackend($itemType);
@@ -291,7 +292,7 @@ class Share extends Constants {
$uidOwner = \OC_User::getUser();
// Verify share type and sharing conditions are met
- if ($shareType === self::SHARE_TYPE_USER) {
+ if ($shareType === IShare::TYPE_USER) {
if ($shareWith == $uidOwner) {
$message = 'Sharing failed, because you can not share with yourself';
throw new \Exception($message);
@@ -311,7 +312,7 @@ class Share extends Constants {
throw new \Exception(sprintf($message, $shareWith));
}
}
- if ($checkExists = self::getItems($itemType, $itemSource, self::SHARE_TYPE_USER,
+ if ($checkExists = self::getItems($itemType, $itemSource, IShare::TYPE_USER,
$shareWith, null, self::FORMAT_NONE, null, 1, true, true)) {
// Only allow the same share to occur again if it is the same
// owner and is not a user share, this use case is for increasing
@@ -324,7 +325,7 @@ class Share extends Constants {
}
// Put the item into the database
- $result = self::put('test', $itemSource, self::SHARE_TYPE_USER, $shareWith, $uidOwner, $permissions);
+ $result = self::put('test', $itemSource, IShare::TYPE_USER, $shareWith, $uidOwner, $permissions);
return $result ? true : false;
}
@@ -378,7 +379,7 @@ class Share extends Constants {
$result = false;
// only use default expiration date for link shares
- if ((int) $item['share_type'] === self::SHARE_TYPE_LINK) {
+ if ((int) $item['share_type'] === IShare::TYPE_LINK) {
// calculate expiration date
if (!empty($item['expiration'])) {
@@ -414,7 +415,7 @@ class Share extends Constants {
protected static function unshareItem(array $item, $newParent = null) {
$shareType = (int)$item['share_type'];
$shareWith = null;
- if ($shareType !== \OCP\Share::SHARE_TYPE_LINK) {
+ if ($shareType !== IShare::TYPE_LINK) {
$shareWith = $item['share_with'];
}
@@ -438,7 +439,7 @@ class Share extends Constants {
$deletedShares[] = $hookParams;
$hookParams['deletedShares'] = $deletedShares;
\OC_Hook::emit(\OCP\Share::class, 'post_unshare', $hookParams);
- if ((int)$item['share_type'] === \OCP\Share::SHARE_TYPE_REMOTE && \OC::$server->getUserSession()->getUser()) {
+ if ((int)$item['share_type'] === IShare::TYPE_REMOTE && \OC::$server->getUserSession()->getUser()) {
list(, $remote) = Helper::splitUserRemote($item['share_with']);
self::sendRemoteUnshare($remote, $item['id'], $item['token']);
}
@@ -635,13 +636,13 @@ class Share extends Constants {
}
if (\OC::$server->getConfig()->getAppValue('core', 'shareapi_allow_links', 'yes') !== 'yes') {
$where .= ' AND `share_type` != ?';
- $queryArgs[] = self::SHARE_TYPE_LINK;
+ $queryArgs[] = IShare::TYPE_LINK;
}
if (isset($shareType)) {
// Include all user and group items
if ($shareType == self::$shareTypeUserAndGroups && isset($shareWith)) {
$where .= ' AND ((`share_type` in (?, ?) AND `share_with` = ?) ';
- $queryArgs[] = self::SHARE_TYPE_USER;
+ $queryArgs[] = IShare::TYPE_USER;
$queryArgs[] = self::$shareTypeGroupUserUnique;
$queryArgs[] = $shareWith;
@@ -653,7 +654,7 @@ class Share extends Constants {
if (!empty($groups)) {
$placeholders = implode(',', array_fill(0, count($groups), '?'));
$where .= ' OR (`share_type` = ? AND `share_with` IN ('.$placeholders.')) ';
- $queryArgs[] = self::SHARE_TYPE_GROUP;
+ $queryArgs[] = IShare::TYPE_GROUP;
$queryArgs = array_merge($queryArgs, $groups);
}
$where .= ')';
@@ -761,7 +762,7 @@ class Share extends Constants {
continue;
}
if ($row['share_type'] == self::$shareTypeGroupUserUnique && isset($items[$row['parent']])) {
- $row['share_type'] = self::SHARE_TYPE_GROUP;
+ $row['share_type'] = IShare::TYPE_GROUP;
$row['unique_name'] = true; // remember that we use a unique name for this user
$row['share_with'] = $items[$row['parent']]['share_with'];
// if the group share was unshared from the user we keep the permission, otherwise
@@ -783,8 +784,8 @@ class Share extends Constants {
$id = $targets[$row['id']];
if (isset($items[$id]) && $items[$id]['uid_owner'] == $row['uid_owner']) {
// Switch to group share type to ensure resharing conditions aren't bypassed
- if ($items[$id]['share_type'] != self::SHARE_TYPE_GROUP) {
- $items[$id]['share_type'] = self::SHARE_TYPE_GROUP;
+ if ($items[$id]['share_type'] != IShare::TYPE_GROUP) {
+ $items[$id]['share_type'] = IShare::TYPE_GROUP;
$items[$id]['share_with'] = $row['share_with'];
}
// Switch ids if sharing permission is granted on only
@@ -851,11 +852,11 @@ class Share extends Constants {
// Add display names to result
$row['share_with_displayname'] = $row['share_with'];
if (isset($row['share_with']) && $row['share_with'] != '' &&
- $row['share_type'] === self::SHARE_TYPE_USER) {
+ $row['share_type'] === IShare::TYPE_USER) {
$shareWithUser = \OC::$server->getUserManager()->get($row['share_with']);
$row['share_with_displayname'] = $shareWithUser === null ? $row['share_with'] : $shareWithUser->getDisplayName();
} elseif (isset($row['share_with']) && $row['share_with'] != '' &&
- $row['share_type'] === self::SHARE_TYPE_REMOTE) {
+ $row['share_type'] === IShare::TYPE_REMOTE) {
$addressBookEntries = \OC::$server->getContactsManager()->search($row['share_with'], ['CLOUD']);
foreach ($addressBookEntries as $entry) {
foreach ($entry['CLOUD'] as $cloudID) {
@@ -1045,7 +1046,7 @@ class Share extends Constants {
* @return mixed id of the new share or false
* @deprecated TESTS ONLY - this methods is only used by tests
* called like this:
- * self::put('test', $itemSource, self::SHARE_TYPE_USER, $shareWith, $uidOwner, $permissions);
+ * self::put('test', $itemSource, IShare::TYPE_USER, $shareWith, $uidOwner, $permissions);
*/
private static function put($itemType, $itemSource, $shareType, $shareWith, $uidOwner,
$permissions) {
@@ -1054,7 +1055,7 @@ class Share extends Constants {
$groupFileTarget = $fileTarget = $suggestedFileTarget = $filePath = '';
$groupItemTarget = $itemTarget = $fileSource = $parent = 0;
- $result = self::checkReshare('test', $itemSource, self::SHARE_TYPE_USER, $shareWith, $uidOwner, $permissions, null, null);
+ $result = self::checkReshare('test', $itemSource, IShare::TYPE_USER, $shareWith, $uidOwner, $permissions, null, null);
if (!empty($result)) {
$parent = $result['parent'];
$itemSource = $result['itemSource'];
@@ -1115,12 +1116,12 @@ class Share extends Constants {
// group share which doesn't exists until now, check if we need a unique target for this user
- $itemTarget = Helper::generateTarget($itemType, $itemSource, self::SHARE_TYPE_USER, $user,
+ $itemTarget = Helper::generateTarget($itemType, $itemSource, IShare::TYPE_USER, $user,
$uidOwner, $suggestedItemTarget, $parent);
// do we also need a file target
if (isset($fileSource)) {
- $fileTarget = Helper::generateTarget('file', $filePath, self::SHARE_TYPE_USER, $user,
+ $fileTarget = Helper::generateTarget('file', $filePath, IShare::TYPE_USER, $user,
$uidOwner, $suggestedFileTarget, $parent);
} else {
$fileTarget = null;
@@ -1190,7 +1191,7 @@ class Share extends Constants {
* @param null|\DateTime $expirationDate
* @deprecated TESTS ONLY - this methods is only used by tests
* called like this:
- * self::checkReshare('test', $itemSource, self::SHARE_TYPE_USER, $shareWith, $uidOwner, $permissions, null, null);
+ * self::checkReshare('test', $itemSource, IShare::TYPE_USER, $shareWith, $uidOwner, $permissions, null, null);
*/
private static function checkReshare($itemType, $itemSource, $shareType, $shareWith, $uidOwner, $permissions, $itemSourceName, $expirationDate) {
$backend = self::getBackend($itemType);
@@ -1384,7 +1385,7 @@ class Share extends Constants {
if (isset($row['stime'])) {
$row['stime'] = (int) $row['stime'];
}
- if (isset($row['expiration']) && $row['share_type'] !== self::SHARE_TYPE_LINK) {
+ if (isset($row['expiration']) && $row['share_type'] !== IShare::TYPE_LINK) {
// discard expiration date for non-link shares, which might have been
// set by ancient bugs
$row['expiration'] = null;
@@ -1406,7 +1407,7 @@ class Share extends Constants {
} elseif ($format === self::FORMAT_STATUSES) {
$statuses = [];
foreach ($items as $item) {
- if ($item['share_type'] === self::SHARE_TYPE_LINK) {
+ if ($item['share_type'] === IShare::TYPE_LINK) {
if ($item['uid_initiator'] !== \OC::$server->getUserSession()->getUser()->getUID()) {
continue;
}
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();
}