namespace OC\Share20;
-use OCP\Files\Node;
+use OCP\IUserManager;
use OCP\Share\IManager;
use OCP\Share\IProviderFactory;
use OC\Share20\Exception\BackendError;
use OCP\IGroupManager;
use OCP\Files\File;
use OCP\Files\Folder;
-use OCP\IUser;
use OCP\Share\Exceptions\ShareNotFound;
use OCP\Share\Exceptions\GenericShareException;
/** @var IL10N */
private $l;
+ /** @var IUserManager */
+ private $userManager;
+
/**
* Manager constructor.
*
* @param IGroupManager $groupManager
* @param IL10N $l
* @param IProviderFactory $factory
+ * @param IUserManager $userManager
*/
public function __construct(
ILogger $logger,
IMountManager $mountManager,
IGroupManager $groupManager,
IL10N $l,
- IProviderFactory $factory
+ IProviderFactory $factory,
+ IUserManager $userManager
) {
$this->logger = $logger;
$this->config = $config;
$this->groupManager = $groupManager;
$this->l = $l;
$this->factory = $factory;
+ $this->userManager = $userManager;
}
/**
protected function generalCreateChecks(\OCP\Share\IShare $share) {
if ($share->getShareType() === \OCP\Share::SHARE_TYPE_USER) {
// We expect a valid user as sharedWith for user shares
- if (!($share->getSharedWith() instanceof \OCP\IUser)) {
- throw new \InvalidArgumentException('SharedWith should be an IUser');
+ if (!$this->userManager->userExists($share->getSharedWith())) {
+ throw new \InvalidArgumentException('SharedWith is not a valid user');
}
} else if ($share->getShareType() === \OCP\Share::SHARE_TYPE_GROUP) {
// We expect a valid group as sharedWith for group shares
- if (!($share->getSharedWith() instanceof \OCP\IGroup)) {
- throw new \InvalidArgumentException('SharedWith should be an IGroup');
+ if (!$this->groupManager->groupExists($share->getSharedWith())) {
+ throw new \InvalidArgumentException('SharedWith is not a valid group');
}
} else if ($share->getShareType() === \OCP\Share::SHARE_TYPE_LINK) {
if ($share->getSharedWith() !== null) {
}
// Cannot share with yourself
- if ($share->getSharedWith() === $share->getSharedBy()) {
+ if ($share->getShareType() === \OCP\Share::SHARE_TYPE_USER &&
+ $share->getSharedWith() === $share->getSharedBy()) {
throw new \InvalidArgumentException('Can\'t share with yourself');
}
* Validate if the expiration date fits the system settings
*
* @param \OCP\Share\IShare $share The share to validate the expiration date of
- * @return \DateTime|null The expiration date or null if $expireDate was null and it is not required
+ * @return \OCP\Share\IShare The expiration date or null if $expireDate was null and it is not required
* @throws GenericShareException
* @throws \InvalidArgumentException
* @throws \Exception
protected function userCreateChecks(\OCP\Share\IShare $share) {
// Check if we can share with group members only
if ($this->shareWithGroupMembersOnly()) {
+ $sharedBy = $this->userManager->get($share->getSharedBy());
+ $sharedWith = $this->userManager->get($share->getSharedWith());
// Verify we can share with this user
$groups = array_intersect(
- $this->groupManager->getUserGroupIds($share->getSharedBy()),
- $this->groupManager->getUserGroupIds($share->getSharedWith())
+ $this->groupManager->getUserGroupIds($sharedBy),
+ $this->groupManager->getUserGroupIds($sharedWith)
);
if (empty($groups)) {
throw new \Exception('Only sharing with group members is allowed');
}
// The share is already shared with this user via a group share
- if ($existingShare->getShareType() === \OCP\Share::SHARE_TYPE_GROUP &&
- $existingShare->getSharedWith()->inGroup($share->getSharedWith()) &&
- $existingShare->getShareOwner() !== $share->getShareOwner()) {
- throw new \Exception('Path already shared with this user');
+ if ($existingShare->getShareType() === \OCP\Share::SHARE_TYPE_GROUP) {
+ $group = $this->groupManager->get($existingShare->getSharedWith());
+ $user = $this->userManager->get($share->getSharedWith());
+
+ if ($group->inGroup($user) && $existingShare->getShareOwner() !== $share->getShareOwner()) {
+ throw new \Exception('Path already shared with this user');
+ }
}
}
}
protected function groupCreateChecks(\OCP\Share\IShare $share) {
// Verify if the user can share with this group
if ($this->shareWithGroupMembersOnly()) {
- if (!$share->getSharedWith()->inGroup($share->getSharedBy())) {
+ $sharedBy = $this->userManager->get($share->getSharedBy());
+ $sharedWith = $this->groupManager->get($share->getSharedWith());
+ if (!$sharedWith->inGroup($sharedBy)) {
throw new \Exception('Only sharing within your own groups is allowed');
}
}
$this->pathCreateChecks($share->getNode());
// On creation of a share the owner is always the owner of the path
- $share->setShareOwner($share->getNode()->getOwner());
+ $share->setShareOwner($share->getNode()->getOwner()->getUID());
// Cannot share with the owner
- if ($share->getSharedWith() === $share->getShareOwner()) {
+ if ($share->getShareType() === \OCP\Share::SHARE_TYPE_USER &&
+ $share->getSharedWith() === $share->getShareOwner()) {
throw new \InvalidArgumentException('Can\'t share with the share owner');
}
$target = \OC\Files\Filesystem::normalizePath($target);
$share->setTarget($target);
- //Get sharewith for hooks
- $sharedWith = null;
- if ($share->getShareType() === \OCP\Share::SHARE_TYPE_USER) {
- $sharedWith = $share->getSharedWith()->getUID();
- } else if ($share->getShareType() === \OCP\Share::SHARE_TYPE_GROUP) {
- $sharedWith = $share->getSharedWith()->getGID();
- } else {
- $sharedWith = $share->getSharedWith();
- }
-
// Pre share hook
$run = true;
$error = '';
'itemType' => $share->getNode() instanceof \OCP\Files\File ? 'file' : 'folder',
'itemSource' => $share->getNode()->getId(),
'shareType' => $share->getShareType(),
- 'uidOwner' => $share->getSharedBy()->getUID(),
+ 'uidOwner' => $share->getSharedBy(),
'permissions' => $share->getPermissions(),
'fileSource' => $share->getNode()->getId(),
'expiration' => $share->getExpirationDate(),
'token' => $share->getToken(),
'itemTarget' => $share->getTarget(),
- 'shareWith' => $sharedWith,
+ 'shareWith' => $share->getSharedWith(),
'run' => &$run,
'error' => &$error,
];
'itemType' => $share->getNode() instanceof \OCP\Files\File ? 'file' : 'folder',
'itemSource' => $share->getNode()->getId(),
'shareType' => $share->getShareType(),
- 'uidOwner' => $share->getSharedBy()->getUID(),
+ 'uidOwner' => $share->getSharedBy(),
'permissions' => $share->getPermissions(),
'fileSource' => $share->getNode()->getId(),
'expiration' => $share->getExpirationDate(),
'token' => $share->getToken(),
'id' => $share->getId(),
- 'shareWith' => $sharedWith,
+ 'shareWith' => $share->getSharedWith(),
'itemTarget' => $share->getTarget(),
'fileTarget' => $share->getTarget(),
];
*
* @param \OCP\Share\IShare $share
* @return \OCP\Share\IShare The share object
+ * @throws \InvalidArgumentException
*/
public function updateShare(\OCP\Share\IShare $share) {
$expirationDateUpdated = false;
}
// Cannot share with the owner
- if ($share->getSharedWith() === $share->getShareOwner()) {
+ if ($share->getShareType() === \OCP\Share::SHARE_TYPE_USER &&
+ $share->getSharedWith() === $share->getShareOwner()) {
throw new \InvalidArgumentException('Can\'t share with the share owner');
}
'itemType' => $share->getNode() instanceof \OCP\Files\File ? 'file' : 'folder',
'itemSource' => $share->getNode()->getId(),
'date' => $share->getExpirationDate(),
- 'uidOwner' => $share->getSharedBy()->getUID(),
+ 'uidOwner' => $share->getSharedBy(),
]);
}
$shareType = $share->getShareType();
$sharedWith = '';
if ($shareType === \OCP\Share::SHARE_TYPE_USER) {
- $sharedWith = $share->getSharedWith()->getUID();
+ $sharedWith = $share->getSharedWith();
} else if ($shareType === \OCP\Share::SHARE_TYPE_GROUP) {
- $sharedWith = $share->getSharedWith()->getGID();
+ $sharedWith = $share->getSharedWith();
} else if ($shareType === \OCP\Share::SHARE_TYPE_REMOTE) {
$sharedWith = $share->getSharedWith();
}
'shareType' => $shareType,
'shareWith' => $sharedWith,
'itemparent' => $share->getParent(),
- 'uidOwner' => $share->getSharedBy()->getUID(),
+ 'uidOwner' => $share->getSharedBy(),
'fileSource' => $share->getNode()->getId(),
'fileTarget' => $share->getTarget()
];
* handle this.
*
* @param \OCP\Share\IShare $share
- * @param IUser $recipient
+ * @param string $recipientId
*/
- public function deleteFromSelf(\OCP\Share\IShare $share, IUser $recipient) {
- list($providerId, $id) = $this->splitFullId($share->getId());
+ public function deleteFromSelf(\OCP\Share\IShare $share, $recipientId) {
+ list($providerId, ) = $this->splitFullId($share->getId());
$provider = $this->factory->getProvider($providerId);
- $provider->deleteFromSelf($share, $recipient);
+ $provider->deleteFromSelf($share, $recipientId);
}
/**
* @inheritdoc
*/
- public function moveShare(\OCP\Share\IShare $share, IUser $recipient) {
+ public function moveShare(\OCP\Share\IShare $share, $recipientId) {
if ($share->getShareType() === \OCP\Share::SHARE_TYPE_LINK) {
throw new \InvalidArgumentException('Can\'t change target of link share');
}
- if (($share->getShareType() === \OCP\Share::SHARE_TYPE_USER && $share->getSharedWith() !== $recipient) ||
- ($share->getShareType() === \OCP\Share::SHARE_TYPE_GROUP && !$share->getSharedWith()->inGroup($recipient))) {
+ if ($share->getShareType() === \OCP\Share::SHARE_TYPE_USER && $share->getSharedWith() !== $recipientId) {
throw new \InvalidArgumentException('Invalid recipient');
}
+ if ($share->getShareType() === \OCP\Share::SHARE_TYPE_GROUP) {
+ $sharedWith = $this->groupManager->get($share->getSharedWith());
+ $recipient = $this->userManager->get($recipientId);
+ if (!$sharedWith->inGroup($recipient)) {
+ throw new \InvalidArgumentException('Invalid recipient');
+ }
+ }
+
list($providerId, ) = $this->splitFullId($share->getId());
$provider = $this->factory->getProvider($providerId);
- $provider->move($share, $recipient);
+ $provider->move($share, $recipientId);
}
/**
* Get shares shared by (initiated) by the provided user.
*
- * @param IUser $user
+ * @param string $userId
* @param int $shareType
* @param \OCP\Files\File|\OCP\Files\Folder $path
* @param bool $reshares
* @param int $offset
* @return \OCP\Share\IShare[]
*/
- public function getSharesBy(IUser $user, $shareType, $path = null, $reshares = false, $limit = 50, $offset = 0) {
+ public function getSharesBy($userId, $shareType, $path = null, $reshares = false, $limit = 50, $offset = 0) {
if ($path !== null &&
!($path instanceof \OCP\Files\File) &&
!($path instanceof \OCP\Files\Folder)) {
$provider = $this->factory->getProviderForType($shareType);
- return $provider->getSharesBy($user, $shareType, $path, $reshares, $limit, $offset);
+ return $provider->getSharesBy($userId, $shareType, $path, $reshares, $limit, $offset);
}
/**
* @inheritdoc
*/
- public function getSharedWith(IUser $user, $shareType, $node = null, $limit = 50, $offset = 0) {
+ public function getSharedWith($userId, $shareType, $node = null, $limit = 50, $offset = 0) {
$provider = $this->factory->getProviderForType($shareType);
- return $provider->getSharedWith($user, $shareType, $node, $limit, $offset);
+ return $provider->getSharedWith($userId, $shareType, $node, $limit, $offset);
}
/**
*
* TODO: Deprecate fuction from OC_Util
*
- * @param IUser $user
+ * @param string $userId
* @return bool
*/
- public function sharingDisabledForUser(IUser $user) {
+ public function sharingDisabledForUser($userId) {
if ($this->config->getAppValue('core', 'shareapi_exclude_groups', 'no') === 'yes') {
$groupsList = $this->config->getAppValue('core', 'shareapi_exclude_groups_list', '');
$excludedGroups = json_decode($groupsList);
$newValue = json_encode($excludedGroups);
$this->config->setAppValue('core', 'shareapi_exclude_groups_list', $newValue);
}
+ $user = $this->userManager->get($userId);
$usersGroups = $this->groupManager->getUserGroupIds($user);
if (!empty($usersGroups)) {
$remainingGroups = array_diff($usersGroups, $excludedGroups);
*/
namespace Test\Share20;
+use OCP\IUserManager;
use OCP\Share\IProviderFactory;
use OCP\Share\IShare;
use OC\Share20\Manager;
/** @var DummyFactory */
protected $factory;
+ /** @var IUserManager */
+ protected $userManager;
+
public function setUp() {
$this->logger = $this->getMock('\OCP\ILogger');
$this->hasher = $this->getMock('\OCP\Security\IHasher');
$this->mountManager = $this->getMock('\OCP\Files\Mount\IMountManager');
$this->groupManager = $this->getMock('\OCP\IGroupManager');
+ $this->userManager = $this->getMock('\OCP\IUserManager');
$this->l = $this->getMock('\OCP\IL10N');
$this->l->method('t')
$this->mountManager,
$this->groupManager,
$this->l,
- $this->factory
+ $this->factory,
+ $this->userManager
);
$this->defaultProvider = $this->getMockBuilder('\OC\Share20\DefaultShareProvider')
$this->mountManager,
$this->groupManager,
$this->l,
- $this->factory
+ $this->factory,
+ $this->userManager
]);
}
$group->method('getGID')->willReturn('sharedWithGroup');
return [
- [\OCP\Share::SHARE_TYPE_USER, $user, 'sharedWithUser'],
- [\OCP\Share::SHARE_TYPE_GROUP, $group, 'sharedWithGroup'],
- [\OCP\Share::SHARE_TYPE_LINK, '', ''],
- [\OCP\Share::SHARE_TYPE_REMOTE, 'foo@bar.com', 'foo@bar.com'],
+ [\OCP\Share::SHARE_TYPE_USER, 'sharedWithUser'],
+ [\OCP\Share::SHARE_TYPE_GROUP, 'sharedWithGroup'],
+ [\OCP\Share::SHARE_TYPE_LINK, ''],
+ [\OCP\Share::SHARE_TYPE_REMOTE, 'foo@bar.com'],
];
}
/**
* @dataProvider dataTestDelete
*/
- public function testDelete($shareType, $sharedWith, $sharedWith_string) {
+ public function testDelete($shareType, $sharedWith) {
$manager = $this->createManagerMock()
->setMethods(['getShareById', 'deleteChildren'])
->getMock();
- $sharedBy = $this->getMock('\OCP\IUser');
- $sharedBy->method('getUID')->willReturn('sharedBy');
-
$path = $this->getMock('\OCP\Files\File');
$path->method('getId')->willReturn(1);
->setProviderId('prov')
->setShareType($shareType)
->setSharedWith($sharedWith)
- ->setSharedBy($sharedBy)
+ ->setSharedBy('sharedBy')
->setNode($path)
->setTarget('myTarget');
'itemType' => 'file',
'itemSource' => 1,
'shareType' => $shareType,
- 'shareWith' => $sharedWith_string,
+ 'shareWith' => $sharedWith,
'itemparent' => null,
'uidOwner' => 'sharedBy',
'fileSource' => 1,
'itemType' => 'file',
'itemSource' => 1,
'shareType' => $shareType,
- 'shareWith' => $sharedWith_string,
+ 'shareWith' => $sharedWith,
'itemparent' => null,
'uidOwner' => 'sharedBy',
'fileSource' => 1,
'itemType' => 'file',
'itemSource' => 1,
'shareType' => $shareType,
- 'shareWith' => $sharedWith_string,
+ 'shareWith' => $sharedWith,
'itemparent' => null,
'uidOwner' => 'sharedBy',
'fileSource' => 1,
->setMethods(['getShareById'])
->getMock();
- $sharedBy1 = $this->getMock('\OCP\IUser');
- $sharedBy1->method('getUID')->willReturn('sharedBy1');
- $sharedBy2 = $this->getMock('\OCP\IUser');
- $sharedBy2->method('getUID')->willReturn('sharedBy2');
- $sharedBy3 = $this->getMock('\OCP\IUser');
- $sharedBy3->method('getUID')->willReturn('sharedBy3');
-
- $sharedWith1 = $this->getMock('\OCP\IUser');
- $sharedWith1->method('getUID')->willReturn('sharedWith1');
- $sharedWith2 = $this->getMock('\OCP\IGroup');
- $sharedWith2->method('getGID')->willReturn('sharedWith2');
-
$path = $this->getMock('\OCP\Files\File');
$path->method('getId')->willReturn(1);
$share1->setId(42)
->setProviderId('prov')
->setShareType(\OCP\Share::SHARE_TYPE_USER)
- ->setSharedWith($sharedWith1)
- ->setSharedBy($sharedBy1)
+ ->setSharedWith('sharedWith1')
+ ->setSharedBy('sharedBy1')
->setNode($path)
->setTarget('myTarget1');
$share2->setId(43)
->setProviderId('prov')
->setShareType(\OCP\Share::SHARE_TYPE_GROUP)
- ->setSharedWith($sharedWith2)
- ->setSharedBy($sharedBy2)
+ ->setSharedWith('sharedWith2')
+ ->setSharedBy('sharedBy2')
->setNode($path)
->setTarget('myTarget2')
->setParent(42);
$share3->setId(44)
->setProviderId('prov')
->setShareType(\OCP\Share::SHARE_TYPE_LINK)
- ->setSharedBy($sharedBy3)
+ ->setSharedBy('sharedBy3')
->setNode($path)
->setTarget('myTarget3')
->setParent(43);
}
public function dataGeneralChecks() {
- $user = $this->getMock('\OCP\IUser');
- $user2 = $this->getMock('\OCP\IUser');
- $group = $this->getMock('\OCP\IGroup');
+ $user0 = 'user0';
+ $user2 = 'user1';
+ $group0 = 'group0';
$file = $this->getMock('\OCP\Files\File');
$node = $this->getMock('\OCP\Files\Node');
$data = [
- [$this->createShare(null, \OCP\Share::SHARE_TYPE_USER, $file, null, $user, $user, 31, null, null), 'SharedWith should be an IUser', true],
- [$this->createShare(null, \OCP\Share::SHARE_TYPE_USER, $file, $group, $user, $user, 31, null, null), 'SharedWith should be an IUser', true],
- [$this->createShare(null, \OCP\Share::SHARE_TYPE_USER, $file, 'foo@bar.com', $user, $user, 31, null, null), 'SharedWith should be an IUser', true],
- [$this->createShare(null, \OCP\Share::SHARE_TYPE_GROUP, $file, null, $user, $user, 31, null, null), 'SharedWith should be an IGroup', true],
- [$this->createShare(null, \OCP\Share::SHARE_TYPE_GROUP, $file, $user2, $user, $user, 31, null, null), 'SharedWith should be an IGroup', true],
- [$this->createShare(null, \OCP\Share::SHARE_TYPE_GROUP, $file, 'foo@bar.com', $user, $user, 31, null, null), 'SharedWith should be an IGroup', true],
- [$this->createShare(null, \OCP\Share::SHARE_TYPE_LINK, $file, $user2, $user, $user, 31, null, null), 'SharedWith should be empty', true],
- [$this->createShare(null, \OCP\Share::SHARE_TYPE_LINK, $file, $group, $user, $user, 31, null, null), 'SharedWith should be empty', true],
- [$this->createShare(null, \OCP\Share::SHARE_TYPE_LINK, $file, 'foo@bar.com', $user, $user, 31, null, null), 'SharedWith should be empty', true],
- [$this->createShare(null, -1, $file, null, $user, $user, 31, null, null), 'unkown share type', true],
-
- [$this->createShare(null, \OCP\Share::SHARE_TYPE_USER, $file, $user2, null, $user, 31, null, null), 'SharedBy should be set', true],
- [$this->createShare(null, \OCP\Share::SHARE_TYPE_GROUP, $file, $group, null, $user, 31, null, null), 'SharedBy should be set', true],
- [$this->createShare(null, \OCP\Share::SHARE_TYPE_LINK, $file, null, null, $user, 31, null, null), 'SharedBy should be set', true],
-
- [$this->createShare(null, \OCP\Share::SHARE_TYPE_USER, $file, $user, $user, $user, 31, null, null), 'Can\'t share with yourself', true],
-
- [$this->createShare(null, \OCP\Share::SHARE_TYPE_USER, null, $user2, $user, $user, 31, null, null), 'Path should be set', true],
- [$this->createShare(null, \OCP\Share::SHARE_TYPE_GROUP, null, $group, $user, $user, 31, null, null), 'Path should be set', true],
- [$this->createShare(null, \OCP\Share::SHARE_TYPE_LINK, null, null, $user, $user, 31, null, null), 'Path should be set', true],
-
- [$this->createShare(null, \OCP\Share::SHARE_TYPE_USER, $node, $user2, $user, $user, 31, null, null), 'Path should be either a file or a folder', true],
- [$this->createShare(null, \OCP\Share::SHARE_TYPE_GROUP, $node, $group, $user, $user, 31, null, null), 'Path should be either a file or a folder', true],
- [$this->createShare(null, \OCP\Share::SHARE_TYPE_LINK, $node, null, $user, $user, 31, null, null), 'Path should be either a file or a folder', true],
+ [$this->createShare(null, \OCP\Share::SHARE_TYPE_USER, $file, null, $user0, $user0, 31, null, null), 'SharedWith is not a valid user', true],
+ [$this->createShare(null, \OCP\Share::SHARE_TYPE_USER, $file, $group0, $user0, $user0, 31, null, null), 'SharedWith is not a valid user', true],
+ [$this->createShare(null, \OCP\Share::SHARE_TYPE_USER, $file, 'foo@bar.com', $user0, $user0, 31, null, null), 'SharedWith is not a valid user', true],
+ [$this->createShare(null, \OCP\Share::SHARE_TYPE_GROUP, $file, null, $user0, $user0, 31, null, null), 'SharedWith is not a valid group', true],
+ [$this->createShare(null, \OCP\Share::SHARE_TYPE_GROUP, $file, $user2, $user0, $user0, 31, null, null), 'SharedWith is not a valid group', true],
+ [$this->createShare(null, \OCP\Share::SHARE_TYPE_GROUP, $file, 'foo@bar.com', $user0, $user0, 31, null, null), 'SharedWith is not a valid group', true],
+ [$this->createShare(null, \OCP\Share::SHARE_TYPE_LINK, $file, $user2, $user0, $user0, 31, null, null), 'SharedWith should be empty', true],
+ [$this->createShare(null, \OCP\Share::SHARE_TYPE_LINK, $file, $group0, $user0, $user0, 31, null, null), 'SharedWith should be empty', true],
+ [$this->createShare(null, \OCP\Share::SHARE_TYPE_LINK, $file, 'foo@bar.com', $user0, $user0, 31, null, null), 'SharedWith should be empty', true],
+ [$this->createShare(null, -1, $file, null, $user0, $user0, 31, null, null), 'unkown share type', true],
+
+ [$this->createShare(null, \OCP\Share::SHARE_TYPE_USER, $file, $user2, null, $user0, 31, null, null), 'SharedBy should be set', true],
+ [$this->createShare(null, \OCP\Share::SHARE_TYPE_GROUP, $file, $group0, null, $user0, 31, null, null), 'SharedBy should be set', true],
+ [$this->createShare(null, \OCP\Share::SHARE_TYPE_LINK, $file, null, null, $user0, 31, null, null), 'SharedBy should be set', true],
+
+ [$this->createShare(null, \OCP\Share::SHARE_TYPE_USER, $file, $user0, $user0, $user0, 31, null, null), 'Can\'t share with yourself', true],
+
+ [$this->createShare(null, \OCP\Share::SHARE_TYPE_USER, null, $user2, $user0, $user0, 31, null, null), 'Path should be set', true],
+ [$this->createShare(null, \OCP\Share::SHARE_TYPE_GROUP, null, $group0, $user0, $user0, 31, null, null), 'Path should be set', true],
+ [$this->createShare(null, \OCP\Share::SHARE_TYPE_LINK, null, null, $user0, $user0, 31, null, null), 'Path should be set', true],
+
+ [$this->createShare(null, \OCP\Share::SHARE_TYPE_USER, $node, $user2, $user0, $user0, 31, null, null), 'Path should be either a file or a folder', true],
+ [$this->createShare(null, \OCP\Share::SHARE_TYPE_GROUP, $node, $group0, $user0, $user0, 31, null, null), 'Path should be either a file or a folder', true],
+ [$this->createShare(null, \OCP\Share::SHARE_TYPE_LINK, $node, null, $user0, $user0, 31, null, null), 'Path should be either a file or a folder', true],
];
$nonShareAble = $this->getMock('\OCP\Files\Folder');
$nonShareAble->method('isShareable')->willReturn(false);
$nonShareAble->method('getPath')->willReturn('path');
- $data[] = [$this->createShare(null, \OCP\Share::SHARE_TYPE_USER, $nonShareAble, $user2, $user, $user, 31, null, null), 'You are not allowed to share path', true];
- $data[] = [$this->createShare(null, \OCP\Share::SHARE_TYPE_GROUP, $nonShareAble, $group, $user, $user, 31, null, null), 'You are not allowed to share path', true];
- $data[] = [$this->createShare(null, \OCP\Share::SHARE_TYPE_LINK, $nonShareAble, null, $user, $user, 31, null, null), 'You are not allowed to share path', true];
+ $data[] = [$this->createShare(null, \OCP\Share::SHARE_TYPE_USER, $nonShareAble, $user2, $user0, $user0, 31, null, null), 'You are not allowed to share path', true];
+ $data[] = [$this->createShare(null, \OCP\Share::SHARE_TYPE_GROUP, $nonShareAble, $group0, $user0, $user0, 31, null, null), 'You are not allowed to share path', true];
+ $data[] = [$this->createShare(null, \OCP\Share::SHARE_TYPE_LINK, $nonShareAble, null, $user0, $user0, 31, null, null), 'You are not allowed to share path', true];
$limitedPermssions = $this->getMock('\OCP\Files\File');
$limitedPermssions->method('isShareable')->willReturn(true);
$limitedPermssions->method('getPermissions')->willReturn(\OCP\Constants::PERMISSION_READ);
$limitedPermssions->method('getPath')->willReturn('path');
- $data[] = [$this->createShare(null, \OCP\Share::SHARE_TYPE_USER, $limitedPermssions, $user2, $user, $user, null, null, null), 'A share requires permissions', true];
- $data[] = [$this->createShare(null, \OCP\Share::SHARE_TYPE_GROUP, $limitedPermssions, $group, $user, $user, null, null, null), 'A share requires permissions', true];
- $data[] = [$this->createShare(null, \OCP\Share::SHARE_TYPE_LINK, $limitedPermssions, null, $user, $user, null, null, null), 'A share requires permissions', true];
+ $data[] = [$this->createShare(null, \OCP\Share::SHARE_TYPE_USER, $limitedPermssions, $user2, $user0, $user0, null, null, null), 'A share requires permissions', true];
+ $data[] = [$this->createShare(null, \OCP\Share::SHARE_TYPE_GROUP, $limitedPermssions, $group0, $user0, $user0, null, null, null), 'A share requires permissions', true];
+ $data[] = [$this->createShare(null, \OCP\Share::SHARE_TYPE_LINK, $limitedPermssions, null, $user0, $user0, null, null, null), 'A share requires permissions', true];
- $data[] = [$this->createShare(null, \OCP\Share::SHARE_TYPE_USER, $limitedPermssions, $user2, $user, $user, 31, null, null), 'Cannot increase permissions of path', true];
- $data[] = [$this->createShare(null, \OCP\Share::SHARE_TYPE_GROUP, $limitedPermssions, $group, $user, $user, 17, null, null), 'Cannot increase permissions of path', true];
- $data[] = [$this->createShare(null, \OCP\Share::SHARE_TYPE_LINK, $limitedPermssions, null, $user, $user, 3, null, null), 'Cannot increase permissions of path', true];
+ $data[] = [$this->createShare(null, \OCP\Share::SHARE_TYPE_USER, $limitedPermssions, $user2, $user0, $user0, 31, null, null), 'Cannot increase permissions of path', true];
+ $data[] = [$this->createShare(null, \OCP\Share::SHARE_TYPE_GROUP, $limitedPermssions, $group0, $user0, $user0, 17, null, null), 'Cannot increase permissions of path', true];
+ $data[] = [$this->createShare(null, \OCP\Share::SHARE_TYPE_LINK, $limitedPermssions, null, $user0, $user0, 3, null, null), 'Cannot increase permissions of path', true];
$allPermssions = $this->getMock('\OCP\Files\Folder');
$allPermssions->method('isShareable')->willReturn(true);
$allPermssions->method('getPermissions')->willReturn(\OCP\Constants::PERMISSION_ALL);
- $data[] = [$this->createShare(null, \OCP\Share::SHARE_TYPE_USER, $allPermssions, $user2, $user, $user, 30, null, null), 'Shares need at least read permissions', true];
- $data[] = [$this->createShare(null, \OCP\Share::SHARE_TYPE_GROUP, $allPermssions, $group, $user, $user, 2, null, null), 'Shares need at least read permissions', true];
- $data[] = [$this->createShare(null, \OCP\Share::SHARE_TYPE_LINK, $allPermssions, null, $user, $user, 16, null, null), 'Shares need at least read permissions', true];
+ $data[] = [$this->createShare(null, \OCP\Share::SHARE_TYPE_USER, $allPermssions, $user2, $user0, $user0, 30, null, null), 'Shares need at least read permissions', true];
+ $data[] = [$this->createShare(null, \OCP\Share::SHARE_TYPE_GROUP, $allPermssions, $group0, $user0, $user0, 2, null, null), 'Shares need at least read permissions', true];
+ $data[] = [$this->createShare(null, \OCP\Share::SHARE_TYPE_LINK, $allPermssions, null, $user0, $user0, 16, null, null), 'Shares need at least read permissions', true];
- $data[] = [$this->createShare(null, \OCP\Share::SHARE_TYPE_USER, $allPermssions, $user2, $user, $user, 31, null, null), null, false];
- $data[] = [$this->createShare(null, \OCP\Share::SHARE_TYPE_GROUP, $allPermssions, $group, $user, $user, 3, null, null), null, false];
- $data[] = [$this->createShare(null, \OCP\Share::SHARE_TYPE_LINK, $allPermssions, null, $user, $user, 17, null, null), null, false];
+ $data[] = [$this->createShare(null, \OCP\Share::SHARE_TYPE_USER, $allPermssions, $user2, $user0, $user0, 31, null, null), null, false];
+ $data[] = [$this->createShare(null, \OCP\Share::SHARE_TYPE_GROUP, $allPermssions, $group0, $user0, $user0, 3, null, null), null, false];
+ $data[] = [$this->createShare(null, \OCP\Share::SHARE_TYPE_LINK, $allPermssions, null, $user0, $user0, 17, null, null), null, false];
return $data;
}
public function testGeneralChecks($share, $exceptionMessage, $exception) {
$thrown = null;
+ $this->userManager->method('userExists')->will($this->returnValueMap([
+ ['user0', true],
+ ['user1', true],
+ ]));
+
+ $this->groupManager->method('groupExists')->will($this->returnValueMap([
+ ['group0', true],
+ ]));
+
try {
$this->invokePrivate($this->manager, 'generalCreateChecks', [$share]);
$thrown = false;
$sharedBy = $this->getMock('\OCP\IUser');
$sharedWith = $this->getMock('\OCP\IUser');
- $share->setSharedBy($sharedBy)->setSharedWith($sharedWith);
+ $share->setSharedBy('sharedBy')->setSharedWith('sharedWith');
$this->groupManager
->method('getUserGroupIds')
])
);
+ $this->userManager->method('get')->will($this->returnValueMap([
+ ['sharedBy', $sharedBy],
+ ['sharedWith', $sharedWith],
+ ]));
+
$this->config
->method('getAppValue')
->will($this->returnValueMap([
$sharedBy = $this->getMock('\OCP\IUser');
$sharedWith = $this->getMock('\OCP\IUser');
- $share->setSharedBy($sharedBy)->setSharedWith($sharedWith);
+ $share->setSharedBy('sharedBy')->setSharedWith('sharedWith');
$path = $this->getMock('\OCP\Files\Node');
$share->setNode($path);
])
);
+ $this->userManager->method('get')->will($this->returnValueMap([
+ ['sharedBy', $sharedBy],
+ ['sharedWith', $sharedWith],
+ ]));
+
$this->config
->method('getAppValue')
->will($this->returnValueMap([
$sharedWith = $this->getMock('\OCP\IUser');
$path = $this->getMock('\OCP\Files\Node');
- $share->setSharedWith($sharedWith)->setNode($path)
+ $share->setSharedWith('sharedWith')->setNode($path)
->setProviderId('foo')->setId('bar');
- $share2->setSharedWith($sharedWith)->setNode($path)
+ $share2->setSharedWith('sharedWith')->setNode($path)
->setProviderId('foo')->setId('baz');
$this->defaultProvider
$share = $this->manager->newShare();
$sharedWith = $this->getMock('\OCP\IUser');
- $owner = $this->getMock('\OCP\IUser');
+ $sharedWith->method('getUID')->willReturn('sharedWith');
+
+ $this->userManager->method('get')->with('sharedWith')->willReturn($sharedWith);
+
$path = $this->getMock('\OCP\Files\Node');
- $share->setSharedWith($sharedWith)
+ $share->setSharedWith('sharedWith')
->setNode($path)
- ->setShareOwner($owner)
+ ->setShareOwner('shareOwner')
->setProviderId('foo')
->setId('bar');
$share2 = new \OC\Share20\Share();
$owner2 = $this->getMock('\OCP\IUser');
$share2->setShareType(\OCP\Share::SHARE_TYPE_GROUP)
- ->setShareOwner($owner2)
+ ->setShareOwner('shareOwner2')
->setProviderId('foo')
- ->setId('baz');
+ ->setId('baz')
+ ->setSharedWith('group');
$group = $this->getMock('\OCP\IGroup');
$group->method('inGroup')
->with($sharedWith)
->willReturn(true);
- $share2->setSharedWith($group);
+ $this->groupManager->method('get')->with('group')->willReturn($group);
$this->defaultProvider
->method('getSharesByPath')
public function testUserCreateChecksIdenticalPathNotSharedWithUser() {
$share = new \OC\Share20\Share();
$sharedWith = $this->getMock('\OCP\IUser');
- $owner = $this->getMock('\OCP\IUser');
$path = $this->getMock('\OCP\Files\Node');
- $share->setSharedWith($sharedWith)
+ $share->setSharedWith('sharedWith')
->setNode($path)
- ->setShareOwner($owner)
+ ->setShareOwner('shareOwner')
->setProviderId('foo')
->setId('bar');
+ $this->userManager->method('get')->with('sharedWith')->willReturn($sharedWith);
+
$share2 = new \OC\Share20\Share();
- $owner2 = $this->getMock('\OCP\IUser');
$share2->setShareType(\OCP\Share::SHARE_TYPE_GROUP)
- ->setShareOwner($owner2)
+ ->setShareOwner('shareOwner2')
->setProviderId('foo')
->setId('baz');
->with($sharedWith)
->willReturn(false);
- $share2->setSharedWith($group);
+ $this->groupManager->method('get')->with('group')->willReturn($group);
+
+ $share2->setSharedWith('group');
$this->defaultProvider
->method('getSharesByPath')
public function testGroupCreateChecksShareWithGroupMembersOnlyNotInGroup() {
$share = new \OC\Share20\Share();
- $sharedBy = $this->getMock('\OCP\IUser');
- $sharedWith = $this->getMock('\OCP\IGroup');
- $share->setSharedBy($sharedBy)->setSharedWith($sharedWith);
+ $user = $this->getMock('\OCP\IUser');
+ $group = $this->getMock('\OCP\IGroup');
+ $share->setSharedBy('user')->setSharedWith('group');
- $sharedWith->method('inGroup')->with($sharedBy)->willReturn(false);
+ $group->method('inGroup')->with($user)->willReturn(false);
+
+ $this->groupManager->method('get')->with('group')->willReturn($group);
+ $this->userManager->method('get')->with('user')->willReturn($user);
$this->config
->method('getAppValue')
public function testGroupCreateChecksShareWithGroupMembersOnlyInGroup() {
$share = new \OC\Share20\Share();
- $sharedBy = $this->getMock('\OCP\IUser');
- $sharedWith = $this->getMock('\OCP\IGroup');
- $share->setSharedBy($sharedBy)->setSharedWith($sharedWith);
+ $user = $this->getMock('\OCP\IUser');
+ $group = $this->getMock('\OCP\IGroup');
+ $share->setSharedBy('user')->setSharedWith('group');
- $sharedWith->method('inGroup')->with($sharedBy)->willReturn(true);
+ $this->userManager->method('get')->with('user')->willReturn($user);
+ $this->groupManager->method('get')->with('group')->willReturn($group);
+
+ $group->method('inGroup')->with($user)->willReturn(true);
$path = $this->getMock('\OCP\Files\Node');
$share->setNode($path);
public function testGroupCreateChecksPathAlreadySharedWithSameGroup() {
$share = $this->manager->newShare();
- $sharedWith = $this->getMock('\OCP\IGroup');
$path = $this->getMock('\OCP\Files\Node');
- $share->setSharedWith($sharedWith)
+ $share->setSharedWith('sharedWith')
->setNode($path)
->setProviderId('foo')
->setId('bar');
$share2 = new \OC\Share20\Share();
- $share2->setSharedWith($sharedWith)
+ $share2->setSharedWith('sharedWith')
->setProviderId('foo')
->setId('baz');
public function testGroupCreateChecksPathAlreadySharedWithDifferentGroup() {
$share = new \OC\Share20\Share();
- $sharedWith = $this->getMock('\OCP\IGroup');
- $share->setSharedWith($sharedWith);
+ $share->setSharedWith('sharedWith');
$path = $this->getMock('\OCP\Files\Node');
$share->setNode($path);
$share2 = new \OC\Share20\Share();
- $sharedWith2 = $this->getMock('\OCP\IGroup');
- $share2->setSharedWith($sharedWith2);
+ $share2->setSharedWith('sharedWith2');
$this->defaultProvider->method('getSharesByPath')
->with($path)
->with($user)
->willReturn($groupIds);
- $res = $this->manager->sharingDisabledForUser($user);
+ $this->userManager->method('get')->with('user')->willReturn($user);
+
+ $res = $this->manager->sharingDisabledForUser('user');
$this->assertEquals($expected, $res);
}
$user = $this->getMock('\OCP\IUser');
$share = $this->manager->newShare();
- $share->setSharedBy($user);
+ $share->setSharedBy('user');
$res = $this->invokePrivate($manager, 'canShare', [$share]);
$this->assertEquals($expected, $res);
->setMethods(['canShare', 'generalCreateChecks', 'userCreateChecks', 'pathCreateChecks'])
->getMock();
- $sharedWith = $this->getMock('\OCP\IUser');
- $sharedBy = $this->getMock('\OCP\IUser');
$shareOwner = $this->getMock('\OCP\IUser');
+ $shareOwner->method('getUID')->willReturn('shareOwner');
$path = $this->getMock('\OCP\Files\File');
$path->method('getOwner')->willReturn($shareOwner);
null,
\OCP\Share::SHARE_TYPE_USER,
$path,
- $sharedWith,
- $sharedBy,
+ 'sharedWith',
+ 'sharedBy',
null,
\OCP\Constants::PERMISSION_ALL);
$share->expects($this->once())
->method('setShareOwner')
- ->with($shareOwner);
+ ->with('shareOwner');
$share->expects($this->once())
->method('setTarget')
->with('/target');
->setMethods(['canShare', 'generalCreateChecks', 'groupCreateChecks', 'pathCreateChecks'])
->getMock();
- $sharedWith = $this->getMock('\OCP\IGroup');
- $sharedBy = $this->getMock('\OCP\IUser');
$shareOwner = $this->getMock('\OCP\IUser');
+ $shareOwner->method('getUID')->willReturn('shareOwner');
$path = $this->getMock('\OCP\Files\File');
$path->method('getOwner')->willReturn($shareOwner);
null,
\OCP\Share::SHARE_TYPE_GROUP,
$path,
- $sharedWith,
- $sharedBy,
+ 'sharedWith',
+ 'sharedBy',
null,
\OCP\Constants::PERMISSION_ALL);
$share->expects($this->once())
->method('setShareOwner')
- ->with($shareOwner);
+ ->with('shareOwner');
$share->expects($this->once())
->method('setTarget')
->with('/target');
])
->getMock();
- $sharedBy = $this->getMock('\OCP\IUser');
- $sharedBy->method('getUID')->willReturn('sharedBy');
$shareOwner = $this->getMock('\OCP\IUser');
+ $shareOwner->method('getUID')->willReturn('shareOwner');
$path = $this->getMock('\OCP\Files\File');
$path->method('getOwner')->willReturn($shareOwner);
$share = $this->manager->newShare();
$share->setShareType(\OCP\Share::SHARE_TYPE_LINK)
->setNode($path)
- ->setSharedBy($sharedBy)
+ ->setSharedBy('sharedBy')
->setPermissions(\OCP\Constants::PERMISSION_ALL)
->setExpirationDate($date)
->setPassword('password');
/** @var IShare $share */
$share = $manager->createShare($share);
- $this->assertSame($shareOwner, $share->getShareOwner());
+ $this->assertSame('shareOwner', $share->getShareOwner());
$this->assertEquals('/target', $share->getTarget());
$this->assertSame($date, $share->getExpirationDate());
$this->assertEquals('token', $share->getToken());
])
->getMock();
- $sharedWith = $this->getMock('\OCP\IUser');
- $sharedBy = $this->getMock('\OCP\IUser');
$shareOwner = $this->getMock('\OCP\IUser');
+ $shareOwner->method('getUID')->willReturn('shareOwner');
$path = $this->getMock('\OCP\Files\File');
$path->method('getOwner')->willReturn($shareOwner);
null,
\OCP\Share::SHARE_TYPE_USER,
$path,
- $sharedWith,
- $sharedBy,
+ 'sharedWith',
+ 'sharedBy',
null,
\OCP\Constants::PERMISSION_ALL);
$share->expects($this->once())
->method('setShareOwner')
- ->with($shareOwner);
+ ->with('shareOwner');
$share->expects($this->once())
->method('setTarget')
->with('/target');
$this->mountManager,
$this->groupManager,
$this->l,
- $factory
+ $factory,
+ $this->userManager
);
$share = $this->getMock('\OCP\Share\IShare');
])
->getMock();
- $origGroup = $this->getMock('\OCP\IGroup');
- $newGroup = $this->getMock('\OCP\IGroup');
-
$originalShare = new \OC\Share20\Share();
$originalShare->setShareType(\OCP\Share::SHARE_TYPE_GROUP)
- ->setSharedWith($origGroup);
+ ->setSharedWith('origGroup');
$manager->expects($this->once())->method('canShare')->willReturn(true);
$manager->expects($this->once())->method('getShareById')->with('foo:42')->willReturn($originalShare);
$share->setProviderId('foo')
->setId('42')
->setShareType(\OCP\Share::SHARE_TYPE_GROUP)
- ->setSharedWith($newGroup);
+ ->setSharedWith('newGroup');
$manager->updateShare($share);
}
])
->getMock();
- $origUser = $this->getMock('\OCP\IUser');
- $newUser = $this->getMock('\OCP\IUser');
-
$originalShare = new \OC\Share20\Share();
$originalShare->setShareType(\OCP\Share::SHARE_TYPE_USER)
- ->setSharedWith($origUser);
+ ->setSharedWith('sharedWith');
$manager->expects($this->once())->method('canShare')->willReturn(true);
$manager->expects($this->once())->method('getShareById')->with('foo:42')->willReturn($originalShare);
$share->setProviderId('foo')
->setId('42')
->setShareType(\OCP\Share::SHARE_TYPE_USER)
- ->setSharedWith($newUser)
- ->setShareOwner($newUser);
+ ->setSharedWith('newUser')
+ ->setShareOwner('newUser');
$manager->updateShare($share);
}
])
->getMock();
- $origUser = $this->getMock('\OCP\IUser');
- $newUser = $this->getMock('\OCP\IUser');
-
$originalShare = new \OC\Share20\Share();
$originalShare->setShareType(\OCP\Share::SHARE_TYPE_USER)
- ->setSharedWith($origUser);
+ ->setSharedWith('origUser');
$manager->expects($this->once())->method('canShare')->willReturn(true);
$manager->expects($this->once())->method('getShareById')->with('foo:42')->willReturn($originalShare);
$share->setProviderId('foo')
->setId('42')
->setShareType(\OCP\Share::SHARE_TYPE_USER)
- ->setSharedWith($origUser)
- ->setShareOwner($newUser);
+ ->setSharedWith('origUser')
+ ->setShareOwner('newUser');
$this->defaultProvider->expects($this->once())
->method('update')
])
->getMock();
- $origGroup = $this->getMock('\OCP\IGroup');
- $user = $this->getMock('\OCP\IUser');
-
$originalShare = new \OC\Share20\Share();
$originalShare->setShareType(\OCP\Share::SHARE_TYPE_GROUP)
- ->setSharedWith($origGroup);
+ ->setSharedWith('origUser');
$manager->expects($this->once())->method('canShare')->willReturn(true);
$manager->expects($this->once())->method('getShareById')->with('foo:42')->willReturn($originalShare);
$share->setProviderId('foo')
->setId('42')
->setShareType(\OCP\Share::SHARE_TYPE_GROUP)
- ->setSharedWith($origGroup)
- ->setShareOwner($user);
+ ->setSharedWith('origUser')
+ ->setShareOwner('owner');
$this->defaultProvider->expects($this->once())
->method('update')
])
->getMock();
- $user = $this->getMock('\OCP\IUser');
- $user->method('getUID')->willReturn('owner');
-
$originalShare = new \OC\Share20\Share();
$originalShare->setShareType(\OCP\Share::SHARE_TYPE_LINK);
$share->setProviderId('foo')
->setId('42')
->setShareType(\OCP\Share::SHARE_TYPE_LINK)
- ->setSharedBy($user)
- ->setShareOwner($user)
+ ->setSharedBy('owner')
+ ->setShareOwner('owner')
->setPassword('password')
->setExpirationDate($tomorrow)
->setNode($file);
$share = $this->manager->newShare();
$share->setShareType(\OCP\Share::SHARE_TYPE_USER);
- $sharedWith = $this->getMock('\OCP\IUser');
- $share->setSharedWith($sharedWith);
-
- $recipient = $this->getMock('\OCP\IUser');
+ $share->setSharedWith('sharedWith');
- $this->manager->moveShare($share, $recipient);
+ $this->manager->moveShare($share, 'recipient');
}
public function testMoveShareUser() {
$share = $this->manager->newShare();
$share->setShareType(\OCP\Share::SHARE_TYPE_USER);
- $recipient = $this->getMock('\OCP\IUser');
- $share->setSharedWith($recipient);
+ $share->setSharedWith('recipient');
- $this->defaultProvider->method('move')->with($share, $recipient)->will($this->returnArgument(0));
+ $this->defaultProvider->method('move')->with($share, 'recipient')->will($this->returnArgument(0));
- $this->manager->moveShare($share, $recipient);
+ $this->manager->moveShare($share, 'recipient');
}
/**
$share->setShareType(\OCP\Share::SHARE_TYPE_GROUP);
$sharedWith = $this->getMock('\OCP\IGroup');
- $share->setSharedWith($sharedWith);
+ $share->setSharedWith('shareWith');
$recipient = $this->getMock('\OCP\IUser');
$sharedWith->method('inGroup')->with($recipient)->willReturn(false);
- $this->manager->moveShare($share, $recipient);
+ $this->groupManager->method('get')->with('shareWith')->willReturn($sharedWith);
+ $this->userManager->method('get')->with('recipient')->willReturn($recipient);
+
+ $this->manager->moveShare($share, 'recipient');
}
public function testMoveShareGroup() {
$share = $this->manager->newShare();
$share->setShareType(\OCP\Share::SHARE_TYPE_GROUP);
- $sharedWith = $this->getMock('\OCP\IGroup');
- $share->setSharedWith($sharedWith);
+ $group = $this->getMock('\OCP\IGroup');
+ $share->setSharedWith('group');
$recipient = $this->getMock('\OCP\IUser');
- $sharedWith->method('inGroup')->with($recipient)->willReturn(true);
+ $group->method('inGroup')->with($recipient)->willReturn(true);
- $this->defaultProvider->method('move')->with($share, $recipient)->will($this->returnArgument(0));
+ $this->groupManager->method('get')->with('group')->willReturn($group);
+ $this->userManager->method('get')->with('recipient')->willReturn($recipient);
- $this->manager->moveShare($share, $recipient);
+ $this->defaultProvider->method('move')->with($share, 'recipient')->will($this->returnArgument(0));
+
+ $this->manager->moveShare($share, 'recipient');
}
}