[Share 2.0] Add share owner information to OCS Share API
This commit is contained in:
parent
fcec704174
commit
d33e578665
|
@ -87,6 +87,8 @@ class Share20OCS {
|
||||||
'parent' => $share->getParent(),
|
'parent' => $share->getParent(),
|
||||||
'expiration' => null,
|
'expiration' => null,
|
||||||
'token' => null,
|
'token' => null,
|
||||||
|
'uid_file_owner' => $share->getShareOwner()->getUID(),
|
||||||
|
'displayname_file_owner' => $share->getShareOwner()->getDisplayName(),
|
||||||
];
|
];
|
||||||
|
|
||||||
$path = $share->getPath();
|
$path = $share->getPath();
|
||||||
|
|
|
@ -171,6 +171,10 @@ class Share20OCSTest extends \Test\TestCase {
|
||||||
public function dataGetShare() {
|
public function dataGetShare() {
|
||||||
$data = [];
|
$data = [];
|
||||||
|
|
||||||
|
$initiator = $this->getMock('OCP\IUser');
|
||||||
|
$initiator->method('getUID')->willReturn('initiatorId');
|
||||||
|
$initiator->method('getDisplayName')->willReturn('initiatorDisplay');
|
||||||
|
|
||||||
$owner = $this->getMock('OCP\IUser');
|
$owner = $this->getMock('OCP\IUser');
|
||||||
$owner->method('getUID')->willReturn('ownerId');
|
$owner->method('getUID')->willReturn('ownerId');
|
||||||
$owner->method('getDisplayName')->willReturn('ownerDisplay');
|
$owner->method('getDisplayName')->willReturn('ownerDisplay');
|
||||||
|
@ -193,8 +197,6 @@ class Share20OCSTest extends \Test\TestCase {
|
||||||
$storage->method('getId')->willReturn('STORAGE');
|
$storage->method('getId')->willReturn('STORAGE');
|
||||||
$storage->method('getCache')->willReturn($cache);
|
$storage->method('getCache')->willReturn($cache);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$parentFolder = $this->getMock('OCP\Files\Folder');
|
$parentFolder = $this->getMock('OCP\Files\Folder');
|
||||||
$parentFolder->method('getId')->willReturn(3);
|
$parentFolder->method('getId')->willReturn(3);
|
||||||
|
|
||||||
|
@ -215,7 +217,7 @@ class Share20OCSTest extends \Test\TestCase {
|
||||||
100,
|
100,
|
||||||
\OCP\Share::SHARE_TYPE_USER,
|
\OCP\Share::SHARE_TYPE_USER,
|
||||||
$user,
|
$user,
|
||||||
$owner,
|
$initiator,
|
||||||
$owner,
|
$owner,
|
||||||
$file,
|
$file,
|
||||||
4,
|
4,
|
||||||
|
@ -230,8 +232,8 @@ class Share20OCSTest extends \Test\TestCase {
|
||||||
'share_type' => \OCP\Share::SHARE_TYPE_USER,
|
'share_type' => \OCP\Share::SHARE_TYPE_USER,
|
||||||
'share_with' => 'userId',
|
'share_with' => 'userId',
|
||||||
'share_with_displayname' => 'userDisplay',
|
'share_with_displayname' => 'userDisplay',
|
||||||
'uid_owner' => 'ownerId',
|
'uid_owner' => 'initiatorId',
|
||||||
'displayname_owner' => 'ownerDisplay',
|
'displayname_owner' => 'initiatorDisplay',
|
||||||
'item_type' => 'file',
|
'item_type' => 'file',
|
||||||
'item_source' => 1,
|
'item_source' => 1,
|
||||||
'file_source' => 1,
|
'file_source' => 1,
|
||||||
|
@ -246,6 +248,8 @@ class Share20OCSTest extends \Test\TestCase {
|
||||||
'path' => 'file',
|
'path' => 'file',
|
||||||
'storage' => 101,
|
'storage' => 101,
|
||||||
'mail_send' => 0,
|
'mail_send' => 0,
|
||||||
|
'uid_file_owner' => 'ownerId',
|
||||||
|
'displayname_file_owner' => 'ownerDisplay'
|
||||||
];
|
];
|
||||||
$data[] = [$share, $expected];
|
$data[] = [$share, $expected];
|
||||||
|
|
||||||
|
@ -254,7 +258,7 @@ class Share20OCSTest extends \Test\TestCase {
|
||||||
101,
|
101,
|
||||||
\OCP\Share::SHARE_TYPE_GROUP,
|
\OCP\Share::SHARE_TYPE_GROUP,
|
||||||
$group,
|
$group,
|
||||||
$owner,
|
$initiator,
|
||||||
$owner,
|
$owner,
|
||||||
$folder,
|
$folder,
|
||||||
4,
|
4,
|
||||||
|
@ -269,8 +273,8 @@ class Share20OCSTest extends \Test\TestCase {
|
||||||
'share_type' => \OCP\Share::SHARE_TYPE_GROUP,
|
'share_type' => \OCP\Share::SHARE_TYPE_GROUP,
|
||||||
'share_with' => 'groupId',
|
'share_with' => 'groupId',
|
||||||
'share_with_displayname' => 'groupId',
|
'share_with_displayname' => 'groupId',
|
||||||
'uid_owner' => 'ownerId',
|
'uid_owner' => 'initiatorId',
|
||||||
'displayname_owner' => 'ownerDisplay',
|
'displayname_owner' => 'initiatorDisplay',
|
||||||
'item_type' => 'folder',
|
'item_type' => 'folder',
|
||||||
'item_source' => 2,
|
'item_source' => 2,
|
||||||
'file_source' => 2,
|
'file_source' => 2,
|
||||||
|
@ -285,6 +289,8 @@ class Share20OCSTest extends \Test\TestCase {
|
||||||
'path' => 'folder',
|
'path' => 'folder',
|
||||||
'storage' => 101,
|
'storage' => 101,
|
||||||
'mail_send' => 0,
|
'mail_send' => 0,
|
||||||
|
'uid_file_owner' => 'ownerId',
|
||||||
|
'displayname_file_owner' => 'ownerDisplay'
|
||||||
];
|
];
|
||||||
$data[] = [$share, $expected];
|
$data[] = [$share, $expected];
|
||||||
|
|
||||||
|
@ -294,7 +300,7 @@ class Share20OCSTest extends \Test\TestCase {
|
||||||
101,
|
101,
|
||||||
\OCP\Share::SHARE_TYPE_LINK,
|
\OCP\Share::SHARE_TYPE_LINK,
|
||||||
null,
|
null,
|
||||||
$owner,
|
$initiator,
|
||||||
$owner,
|
$owner,
|
||||||
$folder,
|
$folder,
|
||||||
4,
|
4,
|
||||||
|
@ -311,8 +317,8 @@ class Share20OCSTest extends \Test\TestCase {
|
||||||
'share_type' => \OCP\Share::SHARE_TYPE_LINK,
|
'share_type' => \OCP\Share::SHARE_TYPE_LINK,
|
||||||
'share_with' => 'password',
|
'share_with' => 'password',
|
||||||
'share_with_displayname' => 'password',
|
'share_with_displayname' => 'password',
|
||||||
'uid_owner' => 'ownerId',
|
'uid_owner' => 'initiatorId',
|
||||||
'displayname_owner' => 'ownerDisplay',
|
'displayname_owner' => 'initiatorDisplay',
|
||||||
'item_type' => 'folder',
|
'item_type' => 'folder',
|
||||||
'item_source' => 2,
|
'item_source' => 2,
|
||||||
'file_source' => 2,
|
'file_source' => 2,
|
||||||
|
@ -328,6 +334,8 @@ class Share20OCSTest extends \Test\TestCase {
|
||||||
'storage' => 101,
|
'storage' => 101,
|
||||||
'mail_send' => 0,
|
'mail_send' => 0,
|
||||||
'url' => 'url',
|
'url' => 'url',
|
||||||
|
'uid_file_owner' => 'ownerId',
|
||||||
|
'displayname_file_owner' => 'ownerDisplay'
|
||||||
];
|
];
|
||||||
$data[] = [$share, $expected];
|
$data[] = [$share, $expected];
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue