diff options
author | Jakob Sack <kde@jakobsack.de> | 2011-07-20 15:53:34 +0200 |
---|---|---|
committer | Jakob Sack <kde@jakobsack.de> | 2011-07-20 15:53:34 +0200 |
commit | bf1ca75710a99a96ba39790e9db79bb0a0f950b4 (patch) | |
tree | a1905c91590944e4558a6d2c5bd856be70a70f0e /3dparty/Sabre/DAVACL/Exception | |
parent | 6230001a3c80c081001c46197cc95403cc73622f (diff) | |
download | nextcloud-server-bf1ca75710a99a96ba39790e9db79bb0a0f950b4.tar.gz nextcloud-server-bf1ca75710a99a96ba39790e9db79bb0a0f950b4.zip |
Integration of SabreDAV
Diffstat (limited to '3dparty/Sabre/DAVACL/Exception')
-rw-r--r-- | 3dparty/Sabre/DAVACL/Exception/AceConflict.php | 34 | ||||
-rw-r--r-- | 3dparty/Sabre/DAVACL/Exception/NeedPrivileges.php | 84 | ||||
-rw-r--r-- | 3dparty/Sabre/DAVACL/Exception/NoAbstract.php | 34 | ||||
-rw-r--r-- | 3dparty/Sabre/DAVACL/Exception/NotRecognizedPrincipal.php | 34 | ||||
-rw-r--r-- | 3dparty/Sabre/DAVACL/Exception/NotSupportedPrivilege.php | 34 |
5 files changed, 220 insertions, 0 deletions
diff --git a/3dparty/Sabre/DAVACL/Exception/AceConflict.php b/3dparty/Sabre/DAVACL/Exception/AceConflict.php new file mode 100644 index 00000000000..d10aeb4345c --- /dev/null +++ b/3dparty/Sabre/DAVACL/Exception/AceConflict.php @@ -0,0 +1,34 @@ +<?php + +/** + * Sabre_DAVACL_Exception_AceConflict + * + * @package Sabre + * @subpackage DAVACL + * @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved. + * @author Evert Pot (http://www.rooftopsolutions.nl/) + * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License + */ +class Sabre_DAVACL_Exception_AceConflict extends Sabre_DAV_Exception_Conflict { + + /** + * Adds in extra information in the xml response. + * + * This method adds the {DAV:}no-ace-conflict element as defined in rfc3744 + * + * @param Sabre_DAV_Server $server + * @param DOMElement $errorNode + * @return void + */ + public function serialize(Sabre_DAV_Server $server,DOMElement $errorNode) { + + $doc = $errorNode->ownerDocument; + + $np = $doc->createElementNS('DAV:','d:no-ace-conflict'); + $errorNode->appendChild($np); + + } + +} + +?> diff --git a/3dparty/Sabre/DAVACL/Exception/NeedPrivileges.php b/3dparty/Sabre/DAVACL/Exception/NeedPrivileges.php new file mode 100644 index 00000000000..640ab8efff4 --- /dev/null +++ b/3dparty/Sabre/DAVACL/Exception/NeedPrivileges.php @@ -0,0 +1,84 @@ +<?php + +/** + * NeedPrivileges + * + * @package Sabre + * @subpackage DAVACL + * @version $Id$ + * @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved. + * @author Evert Pot (http://www.rooftopsolutions.nl/) + * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License + */ + +/** + * NeedPrivileges + * + * The 403-need privileges is thrown when a user didn't have the appropriate + * permissions to perform an operation + */ +class Sabre_DAVACL_Exception_NeedPrivileges extends Sabre_DAV_Exception_Forbidden { + + /** + * The relevant uri + * + * @var string + */ + protected $uri; + + /** + * The privileges the user didn't have. + * + * @var array + */ + protected $privileges; + + /** + * Constructor + * + * @param string $uri + * @param array $privileges + */ + public function __construct($uri,array $privileges) { + + $this->uri = $uri; + $this->privileges = $privileges; + + } + + /** + * Adds in extra information in the xml response. + * + * This method adds the {DAV:}need-privileges element as defined in rfc3744 + * + * @param Sabre_DAV_Server $server + * @param DOMElement $errorNode + * @return void + */ + public function serialize(Sabre_DAV_Server $server,DOMElement $errorNode) { + + $doc = $errorNode->ownerDocument; + + $np = $doc->createElementNS('DAV:','d:need-privileges'); + $errorNode->appendChild($np); + + foreach($this->privileges as $privilege) { + + $resource = $doc->createElementNS('DAV:','d:resource'); + $np->appendChild($resource); + + $resource->appendChild($doc->createElementNS('DAV:','d:href',$server->getBaseUri() . $this->uri)); + + $priv = $doc->createElementNS('DAV:','d:privilege'); + $resource->appendChild($priv); + + preg_match('/^{([^}]*)}(.*)$/',$privilege,$privilegeParts); + $priv->appendChild($doc->createElementNS($privilegeParts[1],'d:' . $privilegeParts[2])); + + + } + + } + +} + diff --git a/3dparty/Sabre/DAVACL/Exception/NoAbstract.php b/3dparty/Sabre/DAVACL/Exception/NoAbstract.php new file mode 100644 index 00000000000..60f49ebff4a --- /dev/null +++ b/3dparty/Sabre/DAVACL/Exception/NoAbstract.php @@ -0,0 +1,34 @@ +<?php + +/** + * Sabre_DAVACL_Exception_NoAbstract + * + * @package Sabre + * @subpackage DAVACL + * @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved. + * @author Evert Pot (http://www.rooftopsolutions.nl/) + * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License + */ +class Sabre_DAVACL_Exception_NoAbstract extends Sabre_DAV_Exception_PreconditionFailed { + + /** + * Adds in extra information in the xml response. + * + * This method adds the {DAV:}no-abstract element as defined in rfc3744 + * + * @param Sabre_DAV_Server $server + * @param DOMElement $errorNode + * @return void + */ + public function serialize(Sabre_DAV_Server $server,DOMElement $errorNode) { + + $doc = $errorNode->ownerDocument; + + $np = $doc->createElementNS('DAV:','d:no-abstract'); + $errorNode->appendChild($np); + + } + +} + +?> diff --git a/3dparty/Sabre/DAVACL/Exception/NotRecognizedPrincipal.php b/3dparty/Sabre/DAVACL/Exception/NotRecognizedPrincipal.php new file mode 100644 index 00000000000..e056dc9e4f7 --- /dev/null +++ b/3dparty/Sabre/DAVACL/Exception/NotRecognizedPrincipal.php @@ -0,0 +1,34 @@ +<?php + +/** + * Sabre_DAVACL_Exception_NotRecognizedPrincipal + * + * @package Sabre + * @subpackage DAVACL + * @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved. + * @author Evert Pot (http://www.rooftopsolutions.nl/) + * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License + */ +class Sabre_DAVACL_Exception_NotRecognizedPrincipal extends Sabre_DAV_Exception_PreconditionFailed { + + /** + * Adds in extra information in the xml response. + * + * This method adds the {DAV:}recognized-principal element as defined in rfc3744 + * + * @param Sabre_DAV_Server $server + * @param DOMElement $errorNode + * @return void + */ + public function serialize(Sabre_DAV_Server $server,DOMElement $errorNode) { + + $doc = $errorNode->ownerDocument; + + $np = $doc->createElementNS('DAV:','d:recognized-principal'); + $errorNode->appendChild($np); + + } + +} + +?> diff --git a/3dparty/Sabre/DAVACL/Exception/NotSupportedPrivilege.php b/3dparty/Sabre/DAVACL/Exception/NotSupportedPrivilege.php new file mode 100644 index 00000000000..27db7cdd7dd --- /dev/null +++ b/3dparty/Sabre/DAVACL/Exception/NotSupportedPrivilege.php @@ -0,0 +1,34 @@ +<?php + +/** + * Sabre_DAVACL_Exception_NotSupportedPrivilege + * + * @package Sabre + * @subpackage DAVACL + * @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved. + * @author Evert Pot (http://www.rooftopsolutions.nl/) + * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License + */ +class Sabre_DAVACL_Exception_NotSupportedPrivilege extends Sabre_DAV_Exception_PreconditionFailed { + + /** + * Adds in extra information in the xml response. + * + * This method adds the {DAV:}not-supported-privilege element as defined in rfc3744 + * + * @param Sabre_DAV_Server $server + * @param DOMElement $errorNode + * @return void + */ + public function serialize(Sabre_DAV_Server $server,DOMElement $errorNode) { + + $doc = $errorNode->ownerDocument; + + $np = $doc->createElementNS('DAV:','d:not-supported-privilege'); + $errorNode->appendChild($np); + + } + +} + +?> |