diff options
author | Joas Schilling <nickvergessen@owncloud.com> | 2015-09-22 11:43:40 +0200 |
---|---|---|
committer | Joas Schilling <nickvergessen@owncloud.com> | 2015-09-23 15:15:07 +0200 |
commit | 1493e86deafb19f3f98ecee35389119daf2911a4 (patch) | |
tree | a45301d5fc0f57942c16da4ea53ca334993515ef /lib/private/connector/sabre | |
parent | d54d9a573fac498c4aaeea0df832a204cf525b58 (diff) | |
download | nextcloud-server-1493e86deafb19f3f98ecee35389119daf2911a4.tar.gz nextcloud-server-1493e86deafb19f3f98ecee35389119daf2911a4.zip |
Allow listeners to set status code and message
Diffstat (limited to 'lib/private/connector/sabre')
-rw-r--r-- | lib/private/connector/sabre/listenerplugin.php | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/private/connector/sabre/listenerplugin.php b/lib/private/connector/sabre/listenerplugin.php index d0d40f4dc86..ec628add28b 100644 --- a/lib/private/connector/sabre/listenerplugin.php +++ b/lib/private/connector/sabre/listenerplugin.php @@ -21,6 +21,9 @@ namespace OC\Connector\Sabre; +use OCP\AppFramework\Http; +use OCP\SabrePluginEvent; +use OCP\SabrePluginException; use Sabre\DAV\ServerPlugin; use Symfony\Component\EventDispatcher\EventDispatcherInterface; @@ -49,9 +52,16 @@ class ListenerPlugin extends ServerPlugin { * in case the system is in maintenance mode. * * @return bool + * @throws \Exception */ public function emitListener() { - $this->dispatcher->dispatch('OC\Connector\Sabre::beforeMethod'); + $event = new SabrePluginEvent(); + + $this->dispatcher->dispatch('OC\Connector\Sabre::beforeMethod', $event); + + if ($event->getStatusCode() !== Http::STATUS_OK) { + throw new SabrePluginException($event->getMessage(), $event->getStatusCode()); + } return true; } |