summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/dav/appinfo/info.xml5
-rw-r--r--apps/encryption/appinfo/info.xml3
-rw-r--r--apps/encryption/settings/settings-admin.php2
-rw-r--r--apps/federation/appinfo/info.xml6
-rw-r--r--apps/files/appinfo/info.xml3
-rw-r--r--apps/files_external/appinfo/info.xml3
-rw-r--r--apps/files_external/lib/smb.php6
-rw-r--r--apps/files_sharing/api/ocssharewrapper.php13
-rw-r--r--apps/files_sharing/api/share20ocs.php153
-rw-r--r--apps/files_sharing/appinfo/info.xml3
-rw-r--r--apps/files_sharing/tests/api/share20ocstest.php295
-rw-r--r--apps/files_trashbin/appinfo/info.xml3
-rw-r--r--apps/files_versions/appinfo/info.xml3
-rw-r--r--apps/provisioning_api/appinfo/info.xml3
-rw-r--r--apps/testing/appinfo/info.xml12
-rw-r--r--apps/testing/appinfo/routes.php46
-rw-r--r--apps/testing/config.php70
-rw-r--r--apps/user_ldap/appinfo/info.xml3
18 files changed, 598 insertions, 34 deletions
diff --git a/apps/dav/appinfo/info.xml b/apps/dav/appinfo/info.xml
index 5f681e784fc..d9eefaefcf1 100644
--- a/apps/dav/appinfo/info.xml
+++ b/apps/dav/appinfo/info.xml
@@ -6,8 +6,6 @@
<licence>AGPL</licence>
<author>owncloud.org</author>
<version>0.1.3</version>
- <requiremin>9.0</requiremin>
- <shipped>true</shipped>
<standalone/>
<default_enable/>
<types>
@@ -21,4 +19,7 @@
<public>
<webdav>appinfo/v1/publicwebdav.php</webdav>
</public>
+ <dependencies>
+ <owncloud min-version="9.0" max-version="9.0" />
+ </dependencies>
</info>
diff --git a/apps/encryption/appinfo/info.xml b/apps/encryption/appinfo/info.xml
index 2224f026e4d..1fb4e93c508 100644
--- a/apps/encryption/appinfo/info.xml
+++ b/apps/encryption/appinfo/info.xml
@@ -14,7 +14,6 @@
<name>Default encryption module</name>
<license>AGPL</license>
<author>Bjoern Schiessle, Clark Tomlinson</author>
- <shipped>true</shipped>
<documentation>
<user>user-encryption</user>
<admin>admin-encryption</admin>
@@ -26,7 +25,7 @@
</types>
<dependencies>
<lib>openssl</lib>
- <owncloud min-version="9.0" />
+ <owncloud min-version="9.0" max-version="9.0" />
</dependencies>
</info>
diff --git a/apps/encryption/settings/settings-admin.php b/apps/encryption/settings/settings-admin.php
index 8d55d587fed..32640ef0661 100644
--- a/apps/encryption/settings/settings-admin.php
+++ b/apps/encryption/settings/settings-admin.php
@@ -42,7 +42,7 @@ $util = new \OCA\Encryption\Util(
$recoveryAdminEnabled = \OC::$server->getConfig()->getAppValue('encryption', 'recoveryAdminEnabled', '0');
$session = new \OCA\Encryption\Session(\OC::$server->getSession());
-$encryptHomeStorage = $util->shouldEncryptHomeStorage($user);
+$encryptHomeStorage = $util->shouldEncryptHomeStorage();
$tmpl->assign('recoveryEnabled', $recoveryAdminEnabled);
$tmpl->assign('initStatus', $session->getStatus());
diff --git a/apps/federation/appinfo/info.xml b/apps/federation/appinfo/info.xml
index 53b2926ba53..92afc995366 100644
--- a/apps/federation/appinfo/info.xml
+++ b/apps/federation/appinfo/info.xml
@@ -8,7 +8,7 @@
<version>0.0.1</version>
<namespace>Federation</namespace>
<category>other</category>
- <dependencies>
- <owncloud min-version="9.0" />
- </dependencies>
+ <dependencies>
+ <owncloud min-version="9.0" max-version="9.0" />
+ </dependencies>
</info>
diff --git a/apps/files/appinfo/info.xml b/apps/files/appinfo/info.xml
index df12b87397d..37ee564057a 100644
--- a/apps/files/appinfo/info.xml
+++ b/apps/files/appinfo/info.xml
@@ -5,7 +5,6 @@
<description>File Management</description>
<licence>AGPL</licence>
<author>Robin Appelman, Vincent Petry</author>
- <shipped>true</shipped>
<standalone/>
<default_enable/>
<version>1.4.1</version>
@@ -13,7 +12,7 @@
<filesystem/>
</types>
<dependencies>
- <owncloud min-version="9.0" />
+ <owncloud min-version="9.0" max-version="9.0" />
</dependencies>
<documentation>
<user>user-files</user>
diff --git a/apps/files_external/appinfo/info.xml b/apps/files_external/appinfo/info.xml
index 355d9feb4b9..1a9fa73de3f 100644
--- a/apps/files_external/appinfo/info.xml
+++ b/apps/files_external/appinfo/info.xml
@@ -9,7 +9,6 @@
</description>
<licence>AGPL</licence>
<author>Robin Appelman, Michael Gapczynski, Vincent Petry</author>
- <shipped>true</shipped>
<documentation>
<admin>admin-external-storage</admin>
</documentation>
@@ -21,6 +20,6 @@
<ocsid>166048</ocsid>
<dependencies>
- <owncloud min-version="9.0" />
+ <owncloud min-version="9.0" max-version="9.0" />
</dependencies>
</info>
diff --git a/apps/files_external/lib/smb.php b/apps/files_external/lib/smb.php
index 80b44a4cbdf..125e0a6dd2c 100644
--- a/apps/files_external/lib/smb.php
+++ b/apps/files_external/lib/smb.php
@@ -302,7 +302,9 @@ class SMB extends Common {
* check if smbclient is installed
*/
public static function checkDependencies() {
- $smbClientExists = (bool)\OC_Helper::findBinaryPath('smbclient');
- return $smbClientExists ? true : array('smbclient');
+ return (
+ (bool)\OC_Helper::findBinaryPath('smbclient')
+ || Server::NativeAvailable()
+ ) ? true : ['smbclient'];
}
}
diff --git a/apps/files_sharing/api/ocssharewrapper.php b/apps/files_sharing/api/ocssharewrapper.php
index ca04c656c28..4640f4ea185 100644
--- a/apps/files_sharing/api/ocssharewrapper.php
+++ b/apps/files_sharing/api/ocssharewrapper.php
@@ -29,13 +29,18 @@ class OCSShareWrapper {
return new Share20OCS(
new \OC\Share20\Manager(
\OC::$server->getLogger(),
- \OC::$server->getAppConfig(),
+ \OC::$server->getConfig(),
new \OC\Share20\DefaultShareProvider(
\OC::$server->getDatabaseConnection(),
\OC::$server->getUserManager(),
\OC::$server->getGroupManager(),
\OC::$server->getRootFolder()
- )
+ ),
+ \OC::$server->getSecureRandom(),
+ \OC::$server->getHasher(),
+ \OC::$server->getMountManager(),
+ \OC::$server->getGroupManager(),
+ \OC::$server->getL10N('core')
),
\OC::$server->getGroupManager(),
\OC::$server->getUserManager(),
@@ -49,8 +54,8 @@ class OCSShareWrapper {
return \OCA\Files_Sharing\API\Local::getAllShares($params);
}
- public function createShare($params) {
- return \OCA\Files_Sharing\API\Local::createShare($params);
+ public function createShare() {
+ return $this->getShare20OCS()->createShare();
}
public function getShare($params) {
diff --git a/apps/files_sharing/api/share20ocs.php b/apps/files_sharing/api/share20ocs.php
index 6c25b4a4426..003c028bf97 100644
--- a/apps/files_sharing/api/share20ocs.php
+++ b/apps/files_sharing/api/share20ocs.php
@@ -25,7 +25,6 @@ use OC\Share20\IShare;
use OCP\IGroupManager;
use OCP\IUserManager;
use OCP\IRequest;
-use OCP\Files\Folder;
use OCP\IURLGenerator;
use OCP\IUser;
use OCP\Files\IRootFolder;
@@ -98,7 +97,7 @@ class Share20OCS {
$result['item_type'] = 'file';
}
$result['storage_id'] = $path->getStorage()->getId();
- $result['storage'] = \OC\Files\Cache\Storage::getNumericStorageId($path->getStorage()->getId());
+ $result['storage'] = $path->getStorage()->getCache()->getNumericStorageId();
$result['item_source'] = $path->getId();
$result['file_source'] = $path->getId();
$result['file_parent'] = $path->getParent()->getId();
@@ -192,6 +191,130 @@ class Share20OCS {
}
/**
+ * @return \OC_OCS_Result
+ */
+ public function createShare() {
+ $share = $this->shareManager->newShare();
+
+ // Verify path
+ $path = $this->request->getParam('path', null);
+ if ($path === null) {
+ return new \OC_OCS_Result(null, 404, 'please specify a file or folder path');
+ }
+
+ $userFolder = $this->rootFolder->getUserFolder($this->currentUser->getUID());
+ try {
+ $path = $userFolder->get($path);
+ } catch (\OCP\Files\NotFoundException $e) {
+ return new \OC_OCS_Result(null, 404, 'wrong path, file/folder doesn\'t exist');
+ }
+
+ $share->setPath($path);
+
+ // Parse permissions (if available)
+ $permissions = $this->request->getParam('permissions', null);
+ if ($permissions === null) {
+ $permissions = \OCP\Constants::PERMISSION_ALL;
+ } else {
+ $permissions = (int)$permissions;
+ }
+
+ if ($permissions < 0 || $permissions > \OCP\Constants::PERMISSION_ALL) {
+ return new \OC_OCS_Result(null, 404, 'invalid permissions');
+ }
+
+ // Shares always require read permissions
+ $permissions |= \OCP\Constants::PERMISSION_READ;
+
+ if ($path instanceof \OCP\Files\File) {
+ // Single file shares should never have delete or create permissions
+ $permissions &= ~\OCP\Constants::PERMISSION_DELETE;
+ $permissions &= ~\OCP\Constants::PERMISSION_CREATE;
+ }
+
+ $shareWith = $this->request->getParam('shareWith', null);
+ $shareType = (int)$this->request->getParam('shareType', '-1');
+
+ if ($shareType === \OCP\Share::SHARE_TYPE_USER) {
+ // Valid user is required to share
+ if ($shareWith === null || !$this->userManager->userExists($shareWith)) {
+ return new \OC_OCS_Result(null, 404, 'please specify a valid user');
+ }
+ $share->setSharedWith($this->userManager->get($shareWith));
+ $share->setPermissions($permissions);
+ } else if ($shareType === \OCP\Share::SHARE_TYPE_GROUP) {
+ // Valid group is required to share
+ if ($shareWith === null || !$this->groupManager->groupExists($shareWith)) {
+ return new \OC_OCS_Result(null, 404, 'please specify a valid group');
+ }
+ $share->setSharedWith($this->groupManager->get($shareWith));
+ $share->setPermissions($permissions);
+ } else if ($shareType === \OCP\Share::SHARE_TYPE_LINK) {
+ //Can we even share links?
+ if (!$this->shareManager->shareApiAllowLinks()) {
+ return new \OC_OCS_Result(null, 404, 'public link sharing is disabled by the administrator');
+ }
+
+ $publicUpload = $this->request->getParam('publicUpload', null);
+ if ($publicUpload === 'true') {
+ // Check if public upload is allowed
+ if (!$this->shareManager->shareApiLinkAllowPublicUpload()) {
+ return new \OC_OCS_Result(null, 403, '"public upload disabled by the administrator');
+ }
+
+ // Public upload can only be set for folders
+ if ($path instanceof \OCP\Files\File) {
+ return new \OC_OCS_Result(null, 404, '"public upload is only possible for public shared folders');
+ }
+
+ $share->setPermissions(
+ \OCP\Constants::PERMISSION_READ |
+ \OCP\Constants::PERMISSION_CREATE |
+ \OCP\Constants::PERMISSION_UPDATE
+ );
+ } else {
+ $share->setPermissions(\OCP\Constants::PERMISSION_READ);
+ }
+
+ // Set password
+ $share->setPassword($this->request->getParam('password', null));
+
+ //Expire date
+ $expireDate = $this->request->getParam('expireDate', null);
+
+ if ($expireDate !== null) {
+ try {
+ $expireDate = $this->parseDate($expireDate);
+ $share->setExpirationDate($expireDate);
+ } catch (\Exception $e) {
+ return new \OC_OCS_Result(null, 404, 'Invalid Date. Format must be YYYY-MM-DD.');
+ }
+ }
+
+ } else if ($shareType === \OCP\Share::SHARE_TYPE_REMOTE) {
+ //fixme Remote shares are handled by old code path for now
+ return \OCA\Files_Sharing\API\Local::createShare([]);
+ } else {
+ return new \OC_OCS_Result(null, 400, "unknown share type");
+ }
+
+ $share->setShareType($shareType);
+ $share->setSharedBy($this->currentUser);
+
+ try {
+ $share = $this->shareManager->createShare($share);
+ } catch (\OC\HintException $e) {
+ $code = $e->getCode() === 0 ? 403 : $e->getCode();
+ return new \OC_OCS_Result(null, $code, $e->getHint());
+ }catch (\Exception $e) {
+ return new \OC_OCS_Result(null, 403, $e->getMessage());
+ }
+
+ $share = $this->formatShare($share);
+ return new \OC_OCS_Result($share);
+ }
+
+ /**
* @param IShare $share
* @return bool
*/
@@ -216,4 +339,30 @@ class Share20OCS {
return false;
}
+
+ /**
+ * Make sure that the passed date is valid ISO 8601
+ * So YYYY-MM-DD
+ * If not throw an exception
+ *
+ * @param string $expireDate
+ *
+ * @throws \Exception
+ * @return \DateTime
+ */
+ private function parseDate($expireDate) {
+ try {
+ $date = new \DateTime($expireDate);
+ } catch (\Exception $e) {
+ throw new \Exception('Invalid date. Format must be YYYY-MM-DD');
+ }
+
+ if ($date === false) {
+ throw new \Exception('Invalid date. Format must be YYYY-MM-DD');
+ }
+
+ $date->setTime(0,0,0);
+
+ return $date;
+ }
}
diff --git a/apps/files_sharing/appinfo/info.xml b/apps/files_sharing/appinfo/info.xml
index 72e56456961..bb16345f101 100644
--- a/apps/files_sharing/appinfo/info.xml
+++ b/apps/files_sharing/appinfo/info.xml
@@ -9,14 +9,13 @@ Turning the feature off removes shared files and folders on the server for all s
</description>
<licence>AGPL</licence>
<author>Michael Gapczynski, Bjoern Schiessle</author>
- <shipped>true</shipped>
<default_enable/>
<version>0.8.1</version>
<types>
<filesystem/>
</types>
<dependencies>
- <owncloud min-version="9.0" />
+ <owncloud min-version="9.0" max-version="9.0" />
</dependencies>
<public>
<files>public.php</files>
diff --git a/apps/files_sharing/tests/api/share20ocstest.php b/apps/files_sharing/tests/api/share20ocstest.php
index b7c56fe17f6..74a5d0752a4 100644
--- a/apps/files_sharing/tests/api/share20ocstest.php
+++ b/apps/files_sharing/tests/api/share20ocstest.php
@@ -65,6 +65,7 @@ class Share20OCSTest extends \Test\TestCase {
$this->rootFolder = $this->getMock('OCP\Files\IRootFolder');
$this->urlGenerator = $this->getMock('OCP\IURLGenerator');
$this->currentUser = $this->getMock('OCP\IUser');
+ $this->currentUser->method('getUID')->willReturn('currentUser');
$this->ocs = new Share20OCS(
$this->shareManager,
@@ -171,8 +172,18 @@ class Share20OCSTest extends \Test\TestCase {
$group = $this->getMock('OCP\IGroup');
$group->method('getGID')->willReturn('groupId');
- $storage = $this->getMock('OCP\Files\Storage');
+ $cache = $this->getMockBuilder('OC\Files\Cache\Cache')
+ ->disableOriginalConstructor()
+ ->getMock();
+ $cache->method('getNumericStorageId')->willReturn(101);
+
+ $storage = $this->getMockBuilder('OC\Files\Storage\Storage')
+ ->disableOriginalConstructor()
+ ->getMock();
$storage->method('getId')->willReturn('STORAGE');
+ $storage->method('getCache')->willReturn($cache);
+
+
$parentFolder = $this->getMock('OCP\Files\Folder');
$parentFolder->method('getId')->willReturn(3);
@@ -223,7 +234,7 @@ class Share20OCSTest extends \Test\TestCase {
'parent' => 6,
'storage_id' => 'STORAGE',
'path' => 'file',
- 'storage' => null, // HACK around static function
+ 'storage' => 101,
'mail_send' => 0,
];
$data[] = [$share, $expected];
@@ -262,7 +273,7 @@ class Share20OCSTest extends \Test\TestCase {
'parent' => 6,
'storage_id' => 'STORAGE',
'path' => 'folder',
- 'storage' => null, // HACK around static function
+ 'storage' => 101,
'mail_send' => 0,
];
$data[] = [$share, $expected];
@@ -304,7 +315,7 @@ class Share20OCSTest extends \Test\TestCase {
'parent' => 6,
'storage_id' => 'STORAGE',
'path' => 'folder',
- 'storage' => null, // HACK around static function
+ 'storage' => 101,
'mail_send' => 0,
'url' => 'url',
];
@@ -391,4 +402,280 @@ class Share20OCSTest extends \Test\TestCase {
$share->method('getShareType')->willReturn(\OCP\Share::SHARE_TYPE_LINK);
$this->assertFalse($this->invokePrivate($this->ocs, 'canAccessShare', [$share]));
}
+
+ public function testCreateShareNoPath() {
+ $expected = new \OC_OCS_Result(null, 404, 'please specify a file or folder path');
+
+ $result = $this->ocs->createShare();
+
+ $this->assertEquals($expected->getMeta(), $result->getMeta());
+ $this->assertEquals($expected->getData(), $result->getData());
+ }
+
+ public function testCreateShareInvalidPath() {
+ $this->request
+ ->method('getParam')
+ ->will($this->returnValueMap([
+ ['path', null, 'invalid-path'],
+ ]));
+
+ $userFolder = $this->getMock('\OCP\Files\Folder');
+ $this->rootFolder->expects($this->once())
+ ->method('getUserFolder')
+ ->with('currentUser')
+ ->willReturn($userFolder);
+
+ $userFolder->expects($this->once())
+ ->method('get')
+ ->with('invalid-path')
+ ->will($this->throwException(new \OCP\Files\NotFoundException()));
+
+ $expected = new \OC_OCS_Result(null, 404, 'wrong path, file/folder doesn\'t exist');
+
+ $result = $this->ocs->createShare();
+
+ $this->assertEquals($expected->getMeta(), $result->getMeta());
+ $this->assertEquals($expected->getData(), $result->getData());
+ }
+
+ public function testCreateShareInvalidPermissions() {
+ $share = $this->getMock('\OC\Share20\IShare');
+ $this->shareManager->method('newShare')->willReturn($share);
+
+ $this->request
+ ->method('getParam')
+ ->will($this->returnValueMap([
+ ['path', null, 'valid-path'],
+ ['permissions', null, 32],
+ ]));
+
+ $userFolder = $this->getMock('\OCP\Files\Folder');
+ $this->rootFolder->expects($this->once())
+ ->method('getUserFolder')
+ ->with('currentUser')
+ ->willReturn($userFolder);
+
+ $path = $this->getMock('\OCP\Files\File');
+ $userFolder->expects($this->once())
+ ->method('get')
+ ->with('valid-path')
+ ->willReturn($path);
+
+ $expected = new \OC_OCS_Result(null, 404, 'invalid permissions');
+
+ $result = $this->ocs->createShare();
+
+ $this->assertEquals($expected->getMeta(), $result->getMeta());
+ $this->assertEquals($expected->getData(), $result->getData());
+ }
+
+ public function testCreateShareUserNoShareWith() {
+ $share = $this->getMock('\OC\Share20\IShare');
+ $this->shareManager->method('newShare')->willReturn($share);
+
+ $this->request
+ ->method('getParam')
+ ->will($this->returnValueMap([
+ ['path', null, 'valid-path'],
+ ['permissions', null, \OCP\Constants::PERMISSION_ALL],
+ ['shareType', $this->any(), \OCP\Share::SHARE_TYPE_USER],
+ ]));
+
+ $userFolder = $this->getMock('\OCP\Files\Folder');
+ $this->rootFolder->expects($this->once())
+ ->method('getUserFolder')
+ ->with('currentUser')
+ ->willReturn($userFolder);
+
+ $path = $this->getMock('\OCP\Files\File');
+ $userFolder->expects($this->once())
+ ->method('get')
+ ->with('valid-path')
+ ->willReturn($path);
+
+ $expected = new \OC_OCS_Result(null, 404, 'please specify a valid user');
+
+ $result = $this->ocs->createShare();
+
+ $this->assertEquals($expected->getMeta(), $result->getMeta());
+ $this->assertEquals($expected->getData(), $result->getData());
+ }
+
+ public function testCreateShareUserNoValidShareWith() {
+ $share = $this->getMock('\OC\Share20\IShare');
+ $this->shareManager->method('newShare')->willReturn($share);
+
+ $this->request
+ ->method('getParam')
+ ->will($this->returnValueMap([
+ ['path', null, 'valid-path'],
+ ['permissions', null, \OCP\Constants::PERMISSION_ALL],
+ ['shareType', $this->any(), \OCP\Share::SHARE_TYPE_USER],
+ ['shareWith', $this->any(), 'invalidUser'],
+ ]));
+
+ $userFolder = $this->getMock('\OCP\Files\Folder');
+ $this->rootFolder->expects($this->once())
+ ->method('getUserFolder')
+ ->with('currentUser')
+ ->willReturn($userFolder);
+
+ $path = $this->getMock('\OCP\Files\File');
+ $userFolder->expects($this->once())
+ ->method('get')
+ ->with('valid-path')
+ ->willReturn($path);
+
+ $expected = new \OC_OCS_Result(null, 404, 'please specify a valid user');
+
+ $result = $this->ocs->createShare();
+
+ $this->assertEquals($expected->getMeta(), $result->getMeta());
+ $this->assertEquals($expected->getData(), $result->getData());
+ }
+
+ public function testCreateShareUser() {
+ $share = $this->getMock('\OC\Share20\IShare');
+ $this->shareManager->method('newShare')->willReturn($share);
+
+ $ocs = $this->getMockBuilder('OCA\Files_Sharing\API\Share20OCS')
+ ->setConstructorArgs([
+ $this->shareManager,
+ $this->groupManager,
+ $this->userManager,
+ $this->request,
+ $this->rootFolder,
+ $this->urlGenerator,
+ $this->currentUser
+ ])->setMethods(['formatShare'])
+ ->getMock();
+
+ $this->request
+ ->method('getParam')
+ ->will($this->returnValueMap([
+ ['path', null, 'valid-path'],
+ ['permissions', null, \OCP\Constants::PERMISSION_ALL],
+ ['shareType', $this->any(), \OCP\Share::SHARE_TYPE_USER],
+ ['shareWith', null, 'validUser'],
+ ]));
+
+ $userFolder = $this->getMock('\OCP\Files\Folder');
+ $this->rootFolder->expects($this->once())
+ ->method('getUserFolder')
+ ->with('currentUser')
+ ->willReturn($userFolder);
+
+ $path = $this->getMock('\OCP\Files\File');
+ $userFolder->expects($this->once())
+ ->method('get')
+ ->with('valid-path')
+ ->willReturn($path);
+
+ $user = $this->getMock('\OCP\IUser');
+ $this->userManager->method('userExists')->with('validUser')->willReturn(true);
+ $this->userManager->method('get')->with('validUser')->willReturn($user);
+
+ $share->method('setPath')->with($path);
+ $share->method('setPermissions')
+ ->with(
+ \OCP\Constants::PERMISSION_ALL &
+ ~\OCP\Constants::PERMISSION_DELETE &
+ ~\OCP\Constants::PERMISSION_CREATE);
+ $share->method('setShareType')->with(\OCP\Share::SHARE_TYPE_USER);
+ $share->method('setSharedWith')->with($user);
+ $share->method('setSharedBy')->with($this->currentUser);
+
+ $expected = new \OC_OCS_Result();
+ $result = $ocs->createShare();
+
+ $this->assertEquals($expected->getMeta(), $result->getMeta());
+ $this->assertEquals($expected->getData(), $result->getData());
+ }
+
+ public function testCreateShareGroupNoValidShareWith() {
+ $share = $this->getMock('\OC\Share20\IShare');
+ $this->shareManager->method('newShare')->willReturn($share);
+
+ $this->request
+ ->method('getParam')
+ ->will($this->returnValueMap([
+ ['path', null, 'valid-path'],
+ ['permissions', null, \OCP\Constants::PERMISSION_ALL],
+ ['shareType', $this->any(), \OCP\Share::SHARE_TYPE_GROUP],
+ ['shareWith', $this->any(), 'invalidGroup'],
+ ]));
+
+ $userFolder = $this->getMock('\OCP\Files\Folder');
+ $this->rootFolder->expects($this->once())
+ ->method('getUserFolder')
+ ->with('currentUser')
+ ->willReturn($userFolder);
+
+ $path = $this->getMock('\OCP\Files\File');
+ $userFolder->expects($this->once())
+ ->method('get')
+ ->with('valid-path')
+ ->willReturn($path);
+
+ $expected = new \OC_OCS_Result(null, 404, 'please specify a valid user');
+
+ $result = $this->ocs->createShare();
+
+ $this->assertEquals($expected->getMeta(), $result->getMeta());
+ $this->assertEquals($expected->getData(), $result->getData());
+ }
+
+ public function testCreateShareGroup() {
+ $share = $this->getMock('\OC\Share20\IShare');
+ $this->shareManager->method('newShare')->willReturn($share);
+
+ $ocs = $this->getMockBuilder('OCA\Files_Sharing\API\Share20OCS')
+ ->setConstructorArgs([
+ $this->shareManager,
+ $this->groupManager,
+ $this->userManager,
+ $this->request,
+ $this->rootFolder,
+ $this->urlGenerator,
+ $this->currentUser
+ ])->setMethods(['formatShare'])
+ ->getMock();
+
+ $this->request
+ ->method('getParam')
+ ->will($this->returnValueMap([
+ ['path', null, 'valid-path'],
+ ['permissions', null, \OCP\Constants::PERMISSION_ALL],
+ ['shareType', '-1', \OCP\Share::SHARE_TYPE_GROUP],
+ ['shareWith', null, 'validGroup'],
+ ]));
+
+ $userFolder = $this->getMock('\OCP\Files\Folder');
+ $this->rootFolder->expects($this->once())
+ ->method('getUserFolder')
+ ->with('currentUser')
+ ->willReturn($userFolder);
+
+ $path = $this->getMock('\OCP\Files\Folder');
+ $userFolder->expects($this->once())
+ ->method('get')
+ ->with('valid-path')
+ ->willReturn($path);
+
+ $group = $this->getMock('\OCP\IGroup');
+ $this->groupManager->method('groupExists')->with('validGroup')->willReturn(true);
+ $this->groupManager->method('get')->with('validGroup')->willReturn($group);
+
+ $share->method('setPath')->with($path);
+ $share->method('setPermissions')->with(\OCP\Constants::PERMISSION_ALL);
+ $share->method('setShareType')->with(\OCP\Share::SHARE_TYPE_GROUP);
+ $share->method('setSharedWith')->with($group);
+ $share->method('setSharedBy')->with($this->currentUser);
+
+ $expected = new \OC_OCS_Result();
+ $result = $ocs->createShare();
+
+ $this->assertEquals($expected->getMeta(), $result->getMeta());
+ $this->assertEquals($expected->getData(), $result->getData());
+ }
}
diff --git a/apps/files_trashbin/appinfo/info.xml b/apps/files_trashbin/appinfo/info.xml
index c4bade081b3..8fcb9956c7d 100644
--- a/apps/files_trashbin/appinfo/info.xml
+++ b/apps/files_trashbin/appinfo/info.xml
@@ -9,14 +9,13 @@ To prevent a user from running out of disk space, the ownCloud Deleted files app
</description>
<licence>AGPL</licence>
<author>Bjoern Schiessle</author>
- <shipped>true</shipped>
<default_enable/>
<version>0.8.0</version>
<types>
<filesystem/>
</types>
<dependencies>
- <owncloud min-version="9.0" />
+ <owncloud min-version="9.0" max-version="9.0" />
</dependencies>
<documentation>
<user>user-trashbin</user>
diff --git a/apps/files_versions/appinfo/info.xml b/apps/files_versions/appinfo/info.xml
index 8fe6372279a..0098ea9e20f 100644
--- a/apps/files_versions/appinfo/info.xml
+++ b/apps/files_versions/appinfo/info.xml
@@ -4,7 +4,6 @@
<name>Versions</name>
<licence>AGPL</licence>
<author>Frank Karlitschek, Bjoern Schiessle</author>
- <shipped>true</shipped>
<description>
This application enables ownCloud to automatically maintain older versions of files that are changed. When enabled, a hidden versions folder is provisioned in every user’s directory and is used to store old file versions. A user can revert to an older version through the web interface at any time, with the replaced file becoming a version. ownCloud then automatically manages the versions folder to ensure the user doesn’t run out of Quota because of versions.
In addition to the expiry of versions, ownCloud’s versions app makes certain never to use more than 50% of the user’s currently available free space. If stored versions exceed this limit, ownCloud will delete the oldest versions first until it meets this limit. More information is available in the Versions documentation.
@@ -15,7 +14,7 @@ In addition to the expiry of versions, ownCloud’s versions app makes certain n
<filesystem/>
</types>
<dependencies>
- <owncloud min-version="9.0" />
+ <owncloud min-version="9.0" max-version="9.0" />
</dependencies>
<documentation>
<user>user-versions</user>
diff --git a/apps/provisioning_api/appinfo/info.xml b/apps/provisioning_api/appinfo/info.xml
index a77b1f67e21..a8702aaf1ef 100644
--- a/apps/provisioning_api/appinfo/info.xml
+++ b/apps/provisioning_api/appinfo/info.xml
@@ -13,7 +13,6 @@
</description>
<licence>AGPL</licence>
<author>Tom Needham</author>
- <shipped>true</shipped>
<default_enable/>
<documentation>
<admin>admin-provisioning-api</admin>
@@ -24,6 +23,6 @@
<filesystem/>
</types>
<dependencies>
- <owncloud min-version="9.0" />
+ <owncloud min-version="9.0" max-version="9.0" />
</dependencies>
</info>
diff --git a/apps/testing/appinfo/info.xml b/apps/testing/appinfo/info.xml
new file mode 100644
index 00000000000..b11ec2f88e6
--- /dev/null
+++ b/apps/testing/appinfo/info.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0"?>
+<info>
+ <id>testing</id>
+ <name>QA Testing</name>
+ <description>This app is only for testing! It is dangerous to have it enabled in a live instance</description>
+ <licence>AGPL</licence>
+ <author>Joas Schilling</author>
+ <version>0.1.0</version>
+ <dependencies>
+ <owncloud min-version="9.0" />
+ </dependencies>
+</info>
diff --git a/apps/testing/appinfo/routes.php b/apps/testing/appinfo/routes.php
new file mode 100644
index 00000000000..b6f20d04ef2
--- /dev/null
+++ b/apps/testing/appinfo/routes.php
@@ -0,0 +1,46 @@
+<?php
+/**
+ * @author Joas Schilling <nickvergessen@owncloud.com>
+ *
+ * @copyright Copyright (c) 2015, ownCloud, Inc.
+ * @license AGPL-3.0
+ *
+ * This code is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License, version 3,
+ * along with this program. If not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+namespace OCA\Testing\AppInfo;
+
+use OCA\Testing\Config;
+use OCP\API;
+
+$config = new Config(
+ \OC::$server->getConfig(),
+ \OC::$server->getRequest()
+);
+
+API::register(
+ 'post',
+ '/apps/testing/api/v1/app/{appid}/{configkey}',
+ [$config, 'setAppValue'],
+ 'testing',
+ API::ADMIN_AUTH
+);
+
+API::register(
+ 'delete',
+ '/apps/testing/api/v1/app/{appid}/{configkey}',
+ [$config, 'deleteAppValue'],
+ 'testing',
+ API::ADMIN_AUTH
+);
diff --git a/apps/testing/config.php b/apps/testing/config.php
new file mode 100644
index 00000000000..068cb28e04b
--- /dev/null
+++ b/apps/testing/config.php
@@ -0,0 +1,70 @@
+<?php
+/**
+ * @author Joas Schilling <nickvergessen@owncloud.com>
+ *
+ * @copyright Copyright (c) 2015, ownCloud, Inc.
+ * @license AGPL-3.0
+ *
+ * This code is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License, version 3,
+ * along with this program. If not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+namespace OCA\Testing;
+
+use OCP\IConfig;
+use OCP\IRequest;
+
+class Config {
+
+ /** @var IConfig */
+ private $config;
+
+ /** @var IRequest */
+ private $request;
+
+ /**
+ * @param IConfig $config
+ * @param IRequest $request
+ */
+ public function __construct(IConfig $config, IRequest $request) {
+ $this->config = $config;
+ $this->request = $request;
+ }
+
+ /**
+ * @param array $parameters
+ * @return \OC_OCS_Result
+ */
+ public function setAppValue($parameters) {
+ $app = $parameters['appid'];
+ $configKey = $parameters['configkey'];
+
+ $value = $this->request->getParam('value');
+ $this->config->setAppValue($app, $configKey, $value);
+
+ return new \OC_OCS_Result();
+ }
+
+ /**
+ * @param array $parameters
+ * @return \OC_OCS_Result
+ */
+ public function deleteAppValue($parameters) {
+ $app = $parameters['appid'];
+ $configKey = $parameters['configkey'];
+
+ $this->config->deleteAppValue($app, $configKey);
+
+ return new \OC_OCS_Result();
+ }
+}
diff --git a/apps/user_ldap/appinfo/info.xml b/apps/user_ldap/appinfo/info.xml
index 7dbce1da5fa..864eaebe4d0 100644
--- a/apps/user_ldap/appinfo/info.xml
+++ b/apps/user_ldap/appinfo/info.xml
@@ -9,7 +9,6 @@ A user logs into ownCloud with their LDAP or AD credentials, and is granted acce
</description>
<licence>AGPL</licence>
<author>Dominik Schmidt and Arthur Schiwon</author>
- <shipped>true</shipped>
<version>0.8.0</version>
<types>
<authentication/>
@@ -19,6 +18,6 @@ A user logs into ownCloud with their LDAP or AD credentials, and is granted acce
</documentation>
<dependencies>
<lib>ldap</lib>
- <owncloud min-version="9.0" />
+ <owncloud min-version="9.0" max-version="9.0" />
</dependencies>
</info>