summaryrefslogtreecommitdiffstats
path: root/lib/public
diff options
context:
space:
mode:
Diffstat (limited to 'lib/public')
-rw-r--r--lib/public/activity/iconsumer.php16
-rw-r--r--lib/public/activity/ievent.php200
-rw-r--r--lib/public/activity/iextension.php9
-rw-r--r--lib/public/activity/imanager.php86
-rw-r--r--lib/public/appframework/http/contentsecuritypolicy.php1
-rw-r--r--lib/public/appframework/http/ocsresponse.php30
-rw-r--r--lib/public/appframework/iappcontainer.php7
-rw-r--r--lib/public/appframework/ocscontroller.php11
-rw-r--r--lib/public/capabilities/icapability.php46
-rw-r--r--lib/public/db/querybuilder/iquerybuilder.php9
-rw-r--r--lib/public/files/storage.php20
-rw-r--r--lib/public/http/client/iclient.php5
-rw-r--r--lib/public/iservercontainer.php10
13 files changed, 382 insertions, 68 deletions
diff --git a/lib/public/activity/iconsumer.php b/lib/public/activity/iconsumer.php
index a55110ababc..e74884d76c5 100644
--- a/lib/public/activity/iconsumer.php
+++ b/lib/public/activity/iconsumer.php
@@ -37,19 +37,11 @@ namespace OCP\Activity;
*/
interface IConsumer {
/**
- * @param $app
- * @param $subject
- * @param $subjectParams
- * @param $message
- * @param $messageParams
- * @param $file
- * @param $link
- * @param $affectedUser
- * @param $type
- * @param $priority
- * @return mixed
+ * @param IEvent $event
+ * @return null
* @since 6.0.0
+ * @since 8.2.0 Replaced the parameters with an IEvent object
*/
- function receive($app, $subject, $subjectParams, $message, $messageParams, $file, $link, $affectedUser, $type, $priority );
+ public function receive(IEvent $event);
}
diff --git a/lib/public/activity/ievent.php b/lib/public/activity/ievent.php
new file mode 100644
index 00000000000..184c7ae503f
--- /dev/null
+++ b/lib/public/activity/ievent.php
@@ -0,0 +1,200 @@
+<?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/>
+ *
+ */
+
+/**
+ * Public interface of ownCloud for apps to use.
+ * Activity/IEvent interface
+ */
+
+// use OCP namespace for all classes that are considered public.
+// This means that they should be used by apps instead of the internal ownCloud classes
+namespace OCP\Activity;
+
+/**
+ * Interface IEvent
+ *
+ * @package OCP\Activity
+ * @since 8.2.0
+ */
+interface IEvent {
+ /**
+ * Set the app of the activity
+ *
+ * @param string $app
+ * @return IEvent
+ * @since 8.2.0
+ */
+ public function setApp($app);
+
+ /**
+ * Set the type of the activity
+ *
+ * @param string $type
+ * @return IEvent
+ * @since 8.2.0
+ */
+ public function setType($type);
+
+ /**
+ * Set the affected user of the activity
+ *
+ * @param string $user
+ * @return IEvent
+ * @since 8.2.0
+ */
+ public function setAffectedUser($user);
+
+ /**
+ * Set the author of the activity
+ *
+ * @param string $author
+ * @return IEvent
+ * @since 8.2.0
+ */
+ public function setAuthor($author);
+
+ /**
+ * Set the author of the activity
+ *
+ * @param int $timestamp
+ * @return IEvent
+ * @since 8.2.0
+ */
+ public function setTimestamp($timestamp);
+
+ /**
+ * Set the subject of the activity
+ *
+ * @param string $subject
+ * @param array $parameters
+ * @return IEvent
+ * @since 8.2.0
+ */
+ public function setSubject($subject, array $parameters = []);
+
+ /**
+ * Set the message of the activity
+ *
+ * @param string $message
+ * @param array $parameters
+ * @return IEvent
+ * @since 8.2.0
+ */
+ public function setMessage($message, array $parameters = []);
+
+ /**
+ * Set the object of the activity
+ *
+ * @param string $objectType
+ * @param int $objectId
+ * @param string $objectName
+ * @return IEvent
+ * @since 8.2.0
+ */
+ public function setObject($objectType, $objectId, $objectName = '');
+
+ /**
+ * Set the link of the activity
+ *
+ * @param string $link
+ * @return IEvent
+ * @since 8.2.0
+ */
+ public function setLink($link);
+
+ /**
+ * @return string
+ * @since 8.2.0
+ */
+ public function getApp();
+
+ /**
+ * @return string
+ * @since 8.2.0
+ */
+ public function getType();
+
+ /**
+ * @return string
+ * @since 8.2.0
+ */
+ public function getAffectedUser();
+
+ /**
+ * @return string
+ * @since 8.2.0
+ */
+ public function getAuthor();
+
+ /**
+ * @return int
+ * @since 8.2.0
+ */
+ public function getTimestamp();
+
+ /**
+ * @return string
+ * @since 8.2.0
+ */
+ public function getSubject();
+
+ /**
+ * @return array
+ * @since 8.2.0
+ */
+ public function getSubjectParameters();
+
+ /**
+ * @return string
+ * @since 8.2.0
+ */
+ public function getMessage();
+
+ /**
+ * @return array
+ * @since 8.2.0
+ */
+ public function getMessageParameters();
+
+ /**
+ * @return string
+ * @since 8.2.0
+ */
+ public function getObjectType();
+
+ /**
+ * @return string
+ * @since 8.2.0
+ */
+ public function getObjectId();
+
+ /**
+ * @return string
+ * @since 8.2.0
+ */
+ public function getObjectName();
+
+ /**
+ * @return string
+ * @since 8.2.0
+ */
+ public function getLink();
+}
diff --git a/lib/public/activity/iextension.php b/lib/public/activity/iextension.php
index 19d1d2e83a0..5d9fe3329ef 100644
--- a/lib/public/activity/iextension.php
+++ b/lib/public/activity/iextension.php
@@ -38,6 +38,8 @@ namespace OCP\Activity;
* @since 8.0.0
*/
interface IExtension {
+ const METHOD_STREAM = 'stream';
+ const METHOD_MAIL = 'email';
const PRIORITY_VERYLOW = 10;
const PRIORITY_LOW = 20;
@@ -50,8 +52,13 @@ interface IExtension {
* If no additional types are to be added false is to be returned
*
* @param string $languageCode
- * @return array|false
+ * @return array|false Array "stringID of the type" => "translated string description for the setting"
+ * or Array "stringID of the type" => [
+ * 'desc' => "translated string description for the setting"
+ * 'methods' => [self::METHOD_*],
+ * ]
* @since 8.0.0
+ * @changed 8.2.0 - Added support to allow limiting notifications to certain methods
*/
public function getNotificationTypes($languageCode);
diff --git a/lib/public/activity/imanager.php b/lib/public/activity/imanager.php
index cadb37da03b..b3a4969fb06 100644
--- a/lib/public/activity/imanager.php
+++ b/lib/public/activity/imanager.php
@@ -38,22 +38,52 @@ namespace OCP\Activity;
* @since 6.0.0
*/
interface IManager {
+ /**
+ * Generates a new IEvent object
+ *
+ * Make sure to call at least the following methods before sending it to the
+ * app with via the publish() method:
+ * - setApp()
+ * - setType()
+ * - setAffectedUser()
+ * - setSubject()
+ *
+ * @return IEvent
+ * @since 8.2.0
+ */
+ public function generateEvent();
/**
- * @param $app
- * @param $subject
- * @param $subjectParams
- * @param $message
- * @param $messageParams
- * @param $file
- * @param $link
- * @param $affectedUser
- * @param $type
- * @param $priority
- * @return mixed
+ * Publish an event to the activity consumers
+ *
+ * Make sure to call at least the following methods before sending an Event:
+ * - setApp()
+ * - setType()
+ * - setAffectedUser()
+ * - setSubject()
+ *
+ * @param IEvent $event
+ * @return null
+ * @since 8.2.0
+ */
+ public function publish(IEvent $event);
+
+ /**
+ * @param string $app The app where this event is associated with
+ * @param string $subject A short description of the event
+ * @param array $subjectParams Array with parameters that are filled in the subject
+ * @param string $message A longer description of the event
+ * @param array $messageParams Array with parameters that are filled in the message
+ * @param string $file The file including path where this event is associated with
+ * @param string $link A link where this event is associated with
+ * @param string $affectedUser Recipient of the activity
+ * @param string $type Type of the notification
+ * @param int $priority Priority of the notification
+ * @return null
* @since 6.0.0
+ * @deprecated 8.2.0 Grab an IEvent from generateEvent() instead and use the publish() method
*/
- function publishActivity($app, $subject, $subjectParams, $message, $messageParams, $file, $link, $affectedUser, $type, $priority);
+ public function publishActivity($app, $subject, $subjectParams, $message, $messageParams, $file, $link, $affectedUser, $type, $priority);
/**
* In order to improve lazy loading a closure can be registered which will be called in case
@@ -65,7 +95,7 @@ interface IManager {
* @return void
* @since 6.0.0
*/
- function registerConsumer(\Closure $callable);
+ public function registerConsumer(\Closure $callable);
/**
* In order to improve lazy loading a closure can be registered which will be called in case
@@ -77,29 +107,35 @@ interface IManager {
* @return void
* @since 8.0.0
*/
- function registerExtension(\Closure $callable);
+ public function registerExtension(\Closure $callable);
/**
* Will return additional notification types as specified by other apps
+ *
* @param string $languageCode
- * @return array
+ * @return array Array "stringID of the type" => "translated string description for the setting"
+ * or Array "stringID of the type" => [
+ * 'desc' => "translated string description for the setting"
+ * 'methods' => [\OCP\Activity\IExtension::METHOD_*],
+ * ]
* @since 8.0.0
+ * @changed 8.2.0 - Added support to allow limiting notifications to certain methods
*/
- function getNotificationTypes($languageCode);
+ public function getNotificationTypes($languageCode);
/**
* @param string $method
* @return array
* @since 8.0.0
*/
- function getDefaultTypes($method);
+ public function getDefaultTypes($method);
/**
* @param string $type
* @return string
* @since 8.0.0
*/
- function getTypeIcon($type);
+ public function getTypeIcon($type);
/**
* @param string $app
@@ -111,7 +147,7 @@ interface IManager {
* @return string|false
* @since 8.0.0
*/
- function translate($app, $text, $params, $stripPath, $highlightParams, $languageCode);
+ public function translate($app, $text, $params, $stripPath, $highlightParams, $languageCode);
/**
* @param string $app
@@ -119,27 +155,27 @@ interface IManager {
* @return array|false
* @since 8.0.0
*/
- function getSpecialParameterList($app, $text);
+ public function getSpecialParameterList($app, $text);
/**
* @param array $activity
* @return integer|false
* @since 8.0.0
*/
- function getGroupParameter($activity);
+ public function getGroupParameter($activity);
/**
* @return array
* @since 8.0.0
*/
- function getNavigation();
+ public function getNavigation();
/**
* @param string $filterValue
* @return boolean
* @since 8.0.0
*/
- function isFilterValid($filterValue);
+ public function isFilterValid($filterValue);
/**
* @param array $types
@@ -147,14 +183,14 @@ interface IManager {
* @return array
* @since 8.0.0
*/
- function filterNotificationTypes($types, $filter);
+ public function filterNotificationTypes($types, $filter);
/**
* @param string $filter
* @return array
* @since 8.0.0
*/
- function getQueryForFilter($filter);
+ public function getQueryForFilter($filter);
/**
* Get the user we need to use
diff --git a/lib/public/appframework/http/contentsecuritypolicy.php b/lib/public/appframework/http/contentsecuritypolicy.php
index 9c7218dc8ba..ee36f7aac17 100644
--- a/lib/public/appframework/http/contentsecuritypolicy.php
+++ b/lib/public/appframework/http/contentsecuritypolicy.php
@@ -63,6 +63,7 @@ class ContentSecurityPolicy {
/** @var array Domains from which images can get loaded */
private $allowedImageDomains = [
'\'self\'',
+ 'data:',
];
/** @var array Domains to which connections can be done */
private $allowedConnectDomains = [
diff --git a/lib/public/appframework/http/ocsresponse.php b/lib/public/appframework/http/ocsresponse.php
index 52d3c2fa665..37af07b70c8 100644
--- a/lib/public/appframework/http/ocsresponse.php
+++ b/lib/public/appframework/http/ocsresponse.php
@@ -29,8 +29,6 @@ namespace OCP\AppFramework\Http;
use OCP\AppFramework\Http;
-use OC_OCS;
-
/**
* A renderer for OCS responses
* @since 8.1.0
@@ -41,38 +39,26 @@ class OCSResponse extends Response {
private $format;
private $statuscode;
private $message;
- private $tag;
- private $tagattribute;
- private $dimension;
private $itemscount;
private $itemsperpage;
/**
* generates the xml or json response for the API call from an multidimenional data array.
* @param string $format
- * @param string $status
- * @param string $statuscode
+ * @param int $statuscode
* @param string $message
* @param array $data
- * @param string $tag
- * @param string $tagattribute
- * @param int $dimension
* @param int|string $itemscount
* @param int|string $itemsperpage
* @since 8.1.0
*/
- public function __construct($format, $status, $statuscode, $message,
- $data=[], $tag='', $tagattribute='',
- $dimension=-1, $itemscount='',
+ public function __construct($format, $statuscode, $message,
+ $data=[], $itemscount='',
$itemsperpage='') {
$this->format = $format;
- $this->setStatus($status);
$this->statuscode = $statuscode;
$this->message = $message;
$this->data = $data;
- $this->tag = $tag;
- $this->tagattribute = $tagattribute;
- $this->dimension = $dimension;
$this->itemscount = $itemscount;
$this->itemsperpage = $itemsperpage;
@@ -93,11 +79,11 @@ class OCSResponse extends Response {
* @since 8.1.0
*/
public function render() {
- return OC_OCS::generateXml(
- $this->format, $this->getStatus(), $this->statuscode, $this->message,
- $this->data, $this->tag, $this->tagattribute, $this->dimension,
- $this->itemscount, $this->itemsperpage
- );
+ $r = new \OC_OCS_Result($this->data, $this->statuscode, $this->message);
+ $r->setTotalItems($this->itemscount);
+ $r->setItemsPerPage($this->itemsperpage);
+
+ return \OC_API::renderResult($this->format, $r->getMeta(), $r->getData());
}
diff --git a/lib/public/appframework/iappcontainer.php b/lib/public/appframework/iappcontainer.php
index 64b1082aa97..7338dbd858d 100644
--- a/lib/public/appframework/iappcontainer.php
+++ b/lib/public/appframework/iappcontainer.php
@@ -86,4 +86,11 @@ interface IAppContainer extends IContainer {
*/
function log($message, $level);
+ /**
+ * Register a capability
+ *
+ * @param string $serviceName e.g. 'OCA\Files\Capabilities'
+ * @since 8.2.0
+ */
+ public function registerCapability($serviceName);
}
diff --git a/lib/public/appframework/ocscontroller.php b/lib/public/appframework/ocscontroller.php
index 602731fe761..55ba518020a 100644
--- a/lib/public/appframework/ocscontroller.php
+++ b/lib/public/appframework/ocscontroller.php
@@ -42,7 +42,7 @@ abstract class OCSController extends ApiController {
* constructor of the controller
* @param string $appName the name of the app
* @param IRequest $request an instance of the request
- * @param string $corsMethods comma seperated string of HTTP verbs which
+ * @param string $corsMethods comma separated string of HTTP verbs which
* should be allowed for websites or webapps when calling your API, defaults to
* 'PUT, POST, GET, DELETE, PATCH'
* @param string $corsAllowedHeaders comma seperated string of HTTP headers
@@ -80,13 +80,9 @@ abstract class OCSController extends ApiController {
}
$params = [
- 'status' => 'OK',
'statuscode' => 100,
'message' => 'OK',
'data' => [],
- 'tag' => '',
- 'tagattribute' => '',
- 'dimension' => 'dynamic',
'itemscount' => '',
'itemsperpage' => ''
];
@@ -96,9 +92,8 @@ abstract class OCSController extends ApiController {
}
return new OCSResponse(
- $format, $params['status'], $params['statuscode'],
- $params['message'], $params['data'], $params['tag'],
- $params['tagattribute'], $params['dimension'],
+ $format, $params['statuscode'],
+ $params['message'], $params['data'],
$params['itemscount'], $params['itemsperpage']
);
}
diff --git a/lib/public/capabilities/icapability.php b/lib/public/capabilities/icapability.php
new file mode 100644
index 00000000000..71a56128d26
--- /dev/null
+++ b/lib/public/capabilities/icapability.php
@@ -0,0 +1,46 @@
+<?php
+/**
+ * @author Roeland Jago Douma <roeland@famdouma.nl>
+ *
+ * @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 OCP\Capabilities;
+
+/**
+ * Minimal interface that has to be implemented for a class to be considered
+ * a capability.
+ *
+ * In an application use:
+ * $this->getContainer()->registerCapability('OCA\MY_APP\Capabilities');
+ * To register capabilities.
+ *
+ * The class 'OCA\MY_APP\Capabilities' must then implement ICapability
+ *
+ * @since 8.2.0
+ */
+interface ICapability {
+
+ /**
+ * Function an app uses to return the capabilities
+ *
+ * @return array Array containing the apps capabilities
+ * @since 8.2.0
+ */
+ public function getCapabilities();
+}
+
diff --git a/lib/public/db/querybuilder/iquerybuilder.php b/lib/public/db/querybuilder/iquerybuilder.php
index 09d5d199bef..3fc07af1a47 100644
--- a/lib/public/db/querybuilder/iquerybuilder.php
+++ b/lib/public/db/querybuilder/iquerybuilder.php
@@ -27,6 +27,15 @@ namespace OCP\DB\QueryBuilder;
*/
interface IQueryBuilder {
/**
+ * Enable/disable automatic prefixing of table names with the oc_ prefix
+ *
+ * @param bool $enabled If set to true table names will be prefixed with the
+ * owncloud database prefix automatically.
+ * @since 8.2.0
+ */
+ public function automaticTablePrefix($enabled);
+
+ /**
* Gets an ExpressionBuilder used for object-oriented construction of query expressions.
* This producer method is intended for convenient inline usage. Example:
*
diff --git a/lib/public/files/storage.php b/lib/public/files/storage.php
index 41218996382..ac3603e48d4 100644
--- a/lib/public/files/storage.php
+++ b/lib/public/files/storage.php
@@ -439,4 +439,24 @@ interface Storage {
* @since 8.1.0
*/
public function changeLock($path, $type, ILockingProvider $provider);
+
+ /**
+ * Test a storage for availability
+ *
+ * @since 8.2.0
+ * @return bool
+ */
+ public function test();
+
+ /**
+ * @since 8.2.0
+ * @return array [ available, last_checked ]
+ */
+ public function getAvailability();
+
+ /**
+ * @since 8.2.0
+ * @param bool $isAvailable
+ */
+ public function setAvailability($isAvailable);
}
diff --git a/lib/public/http/client/iclient.php b/lib/public/http/client/iclient.php
index aadb9efd1bb..494ca7d419e 100644
--- a/lib/public/http/client/iclient.php
+++ b/lib/public/http/client/iclient.php
@@ -80,6 +80,7 @@ interface IClient {
* 'verify' => true, // bool or string to CA file
* 'debug' => true,
* @return IResponse
+ * @throws \Exception If the request could not get completed
* @since 8.1.0
*/
public function head($uri, $options = []);
@@ -109,6 +110,7 @@ interface IClient {
* 'verify' => true, // bool or string to CA file
* 'debug' => true,
* @return IResponse
+ * @throws \Exception If the request could not get completed
* @since 8.1.0
*/
public function post($uri, array $options = []);
@@ -138,6 +140,7 @@ interface IClient {
* 'verify' => true, // bool or string to CA file
* 'debug' => true,
* @return IResponse
+ * @throws \Exception If the request could not get completed
* @since 8.1.0
*/
public function put($uri, array $options = []);
@@ -167,6 +170,7 @@ interface IClient {
* 'verify' => true, // bool or string to CA file
* 'debug' => true,
* @return IResponse
+ * @throws \Exception If the request could not get completed
* @since 8.1.0
*/
public function delete($uri, array $options = []);
@@ -196,6 +200,7 @@ interface IClient {
* 'verify' => true, // bool or string to CA file
* 'debug' => true,
* @return IResponse
+ * @throws \Exception If the request could not get completed
* @since 8.1.0
*/
public function options($uri, array $options = []);
diff --git a/lib/public/iservercontainer.php b/lib/public/iservercontainer.php
index f3165db33da..a6d83156de3 100644
--- a/lib/public/iservercontainer.php
+++ b/lib/public/iservercontainer.php
@@ -39,6 +39,7 @@
// use OCP namespace for all classes that are considered public.
// This means that they should be used by apps instead of the internal ownCloud classes
namespace OCP;
+use Symfony\Component\EventDispatcher\EventDispatcherInterface;
/**
@@ -438,4 +439,13 @@ interface IServerContainer {
* @since 8.2.0
*/
public function getMimeTypeDetector();
+
+
+ /**
+ * Get the EventDispatcher
+ *
+ * @return EventDispatcherInterface
+ * @since 8.2.0
+ */
+ public function getEventDispatcher();
}