aboutsummaryrefslogtreecommitdiffstats
path: root/3rdparty/Sabre/DAVACL
diff options
context:
space:
mode:
authorLukas Reschke <lukas@statuscode.ch>2012-10-13 22:03:44 +0200
committerLukas Reschke <lukas@statuscode.ch>2012-10-13 22:04:22 +0200
commit183cc22501b75ab8819971f70b88dbc010026ac1 (patch)
tree878db72be46fe5394f8615c2bcf579d9e943d76b /3rdparty/Sabre/DAVACL
parent5713dcfd11f6d0f57b6302bedeb22c18df5d73bb (diff)
downloadnextcloud-server-183cc22501b75ab8819971f70b88dbc010026ac1.tar.gz
nextcloud-server-183cc22501b75ab8819971f70b88dbc010026ac1.zip
Update SabreDAV to 1.7.1
Diffstat (limited to '3rdparty/Sabre/DAVACL')
-rwxr-xr-x3rdparty/Sabre/DAVACL/AbstractPrincipalCollection.php2
-rwxr-xr-x3rdparty/Sabre/DAVACL/IACL.php2
-rwxr-xr-x3rdparty/Sabre/DAVACL/Plugin.php54
-rwxr-xr-x3rdparty/Sabre/DAVACL/Property/Acl.php10
-rwxr-xr-x3rdparty/Sabre/DAVACL/Property/Principal.php4
-rwxr-xr-x3rdparty/Sabre/DAVACL/Version.php2
6 files changed, 54 insertions, 20 deletions
diff --git a/3rdparty/Sabre/DAVACL/AbstractPrincipalCollection.php b/3rdparty/Sabre/DAVACL/AbstractPrincipalCollection.php
index e05b7749805..f67eadad6e9 100755
--- a/3rdparty/Sabre/DAVACL/AbstractPrincipalCollection.php
+++ b/3rdparty/Sabre/DAVACL/AbstractPrincipalCollection.php
@@ -107,7 +107,7 @@ abstract class Sabre_DAVACL_AbstractPrincipalCollection extends Sabre_DAV_Collec
*
* @param string $name
* @throws Sabre_DAV_Exception_NotFound
- * @return Sabre_DAV_IPrincipal
+ * @return Sabre_DAVACL_IPrincipal
*/
public function getChild($name) {
diff --git a/3rdparty/Sabre/DAVACL/IACL.php b/3rdparty/Sabre/DAVACL/IACL.php
index 003e6993483..356bb481d55 100755
--- a/3rdparty/Sabre/DAVACL/IACL.php
+++ b/3rdparty/Sabre/DAVACL/IACL.php
@@ -48,7 +48,7 @@ interface Sabre_DAVACL_IACL extends Sabre_DAV_INode {
/**
* Updates the ACL
*
- * This method will receive a list of new ACE's.
+ * This method will receive a list of new ACE's as an array argument.
*
* @param array $acl
* @return void
diff --git a/3rdparty/Sabre/DAVACL/Plugin.php b/3rdparty/Sabre/DAVACL/Plugin.php
index 5c828c6d97b..5b17c838475 100755
--- a/3rdparty/Sabre/DAVACL/Plugin.php
+++ b/3rdparty/Sabre/DAVACL/Plugin.php
@@ -3,7 +3,7 @@
/**
* SabreDAV ACL Plugin
*
- * This plugin provides funcitonality to enforce ACL permissions.
+ * This plugin provides functionality to enforce ACL permissions.
* ACL is defined in RFC3744.
*
* In addition it also provides support for the {DAV:}current-user-principal
@@ -102,11 +102,11 @@ class Sabre_DAVACL_Plugin extends Sabre_DAV_ServerPlugin {
);
/**
- * Any principal uri's added here, will automatically be added to the list
- * of ACL's. They will effectively receive {DAV:}all privileges, as a
+ * Any principal uri's added here, will automatically be added to the list
+ * of ACL's. They will effectively receive {DAV:}all privileges, as a
* protected privilege.
- *
- * @var array
+ *
+ * @var array
*/
public $adminPrincipals = array();
@@ -233,6 +233,7 @@ class Sabre_DAVACL_Plugin extends Sabre_DAV_ServerPlugin {
$authPlugin = $this->server->getPlugin('auth');
if (is_null($authPlugin)) return null;
+ /** @var $authPlugin Sabre_DAV_Auth_Plugin */
$userName = $authPlugin->getCurrentUser();
if (!$userName) return null;
@@ -242,6 +243,14 @@ class Sabre_DAVACL_Plugin extends Sabre_DAV_ServerPlugin {
}
/**
+ * This array holds a cache for all the principals that are associated with
+ * a single principal.
+ *
+ * @var array
+ */
+ protected $currentUserPrincipalsCache = array();
+
+ /**
* Returns a list of principals that's associated to the current
* user, either directly or through group membership.
*
@@ -253,6 +262,11 @@ class Sabre_DAVACL_Plugin extends Sabre_DAV_ServerPlugin {
if (is_null($currentUser)) return array();
+ // First check our cache
+ if (isset($this->currentUserPrincipalsCache[$currentUser])) {
+ return $this->currentUserPrincipalsCache[$currentUser];
+ }
+
$check = array($currentUser);
$principals = array($currentUser);
@@ -277,6 +291,9 @@ class Sabre_DAVACL_Plugin extends Sabre_DAV_ServerPlugin {
}
+ // Store the result in the cache
+ $this->currentUserPrincipalsCache[$currentUser] = $principals;
+
return $principals;
}
@@ -771,7 +788,7 @@ class Sabre_DAVACL_Plugin extends Sabre_DAV_ServerPlugin {
* @param array $requestedProperties
* @param array $returnedProperties
* @TODO really should be broken into multiple methods, or even a class.
- * @return void
+ * @return bool
*/
public function beforeGetProperties($uri, Sabre_DAV_INode $node, &$requestedProperties, &$returnedProperties) {
@@ -895,6 +912,18 @@ class Sabre_DAVACL_Plugin extends Sabre_DAV_ServerPlugin {
$returnedProperties[200]['{DAV:}acl-restrictions'] = new Sabre_DAVACL_Property_AclRestrictions();
}
+ /* Adding ACL properties */
+ if ($node instanceof Sabre_DAVACL_IACL) {
+
+ if (false !== ($index = array_search('{DAV:}owner', $requestedProperties))) {
+
+ unset($requestedProperties[$index]);
+ $returnedProperties[200]['{DAV:}owner'] = new Sabre_DAV_Property_Href($node->getOwner() . '/');
+
+ }
+
+ }
+
}
/**
@@ -928,6 +957,9 @@ class Sabre_DAVACL_Plugin extends Sabre_DAV_ServerPlugin {
}
$node->setGroupMemberSet($memberSet);
+ // We must also clear our cache, just in case
+
+ $this->currentUserPrincipalsCache = array();
$result[200]['{DAV:}group-member-set'] = null;
unset($propertyDelta['{DAV:}group-member-set']);
@@ -935,7 +967,7 @@ class Sabre_DAVACL_Plugin extends Sabre_DAV_ServerPlugin {
}
/**
- * This method handels HTTP REPORT requests
+ * This method handles HTTP REPORT requests
*
* @param string $reportName
* @param DOMNode $dom
@@ -1268,10 +1300,12 @@ class Sabre_DAVACL_Plugin extends Sabre_DAV_ServerPlugin {
}
$result = $this->principalSearch($searchProperties, $requestedProperties, $uri);
- $xml = $this->server->generateMultiStatus($result);
- $this->server->httpResponse->setHeader('Content-Type','application/xml; charset=utf-8');
+ $prefer = $this->server->getHTTPPRefer();
+
$this->server->httpResponse->sendStatus(207);
- $this->server->httpResponse->sendBody($xml);
+ $this->server->httpResponse->setHeader('Content-Type','application/xml; charset=utf-8');
+ $this->server->httpResponse->setHeader('Vary','Brief,Prefer');
+ $this->server->httpResponse->sendBody($this->server->generateMultiStatus($result, $prefer['return-minimal']));
}
diff --git a/3rdparty/Sabre/DAVACL/Property/Acl.php b/3rdparty/Sabre/DAVACL/Property/Acl.php
index 05e1a690b3c..3f79a8d532e 100755
--- a/3rdparty/Sabre/DAVACL/Property/Acl.php
+++ b/3rdparty/Sabre/DAVACL/Property/Acl.php
@@ -88,11 +88,11 @@ class Sabre_DAVACL_Property_Acl extends Sabre_DAV_Property {
static public function unserialize(DOMElement $dom) {
$privileges = array();
- $xaces = $dom->getElementsByTagNameNS('urn:DAV','ace');
+ $xaces = $dom->getElementsByTagNameNS('DAV:','ace');
for($ii=0; $ii < $xaces->length; $ii++) {
$xace = $xaces->item($ii);
- $principal = $xace->getElementsByTagNameNS('urn:DAV','principal');
+ $principal = $xace->getElementsByTagNameNS('DAV:','principal');
if ($principal->length !== 1) {
throw new Sabre_DAV_Exception_BadRequest('Each {DAV:}ace element must have one {DAV:}principal element');
}
@@ -116,17 +116,17 @@ class Sabre_DAVACL_Property_Acl extends Sabre_DAV_Property {
$protected = false;
- if ($xace->getElementsByTagNameNS('urn:DAV','protected')->length > 0) {
+ if ($xace->getElementsByTagNameNS('DAV:','protected')->length > 0) {
$protected = true;
}
- $grants = $xace->getElementsByTagNameNS('urn:DAV','grant');
+ $grants = $xace->getElementsByTagNameNS('DAV:','grant');
if ($grants->length < 1) {
throw new Sabre_DAV_Exception_NotImplemented('Every {DAV:}ace element must have a {DAV:}grant element. {DAV:}deny is not yet supported');
}
$grant = $grants->item(0);
- $xprivs = $grant->getElementsByTagNameNS('urn:DAV','privilege');
+ $xprivs = $grant->getElementsByTagNameNS('DAV:','privilege');
for($jj=0; $jj<$xprivs->length; $jj++) {
$xpriv = $xprivs->item($jj);
diff --git a/3rdparty/Sabre/DAVACL/Property/Principal.php b/3rdparty/Sabre/DAVACL/Property/Principal.php
index c36328a58e0..3f681742276 100755
--- a/3rdparty/Sabre/DAVACL/Property/Principal.php
+++ b/3rdparty/Sabre/DAVACL/Property/Principal.php
@@ -15,7 +15,7 @@
class Sabre_DAVACL_Property_Principal extends Sabre_DAV_Property implements Sabre_DAV_Property_IHref {
/**
- * To specify a not-logged-in user, use the UNAUTHENTICTED principal
+ * To specify a not-logged-in user, use the UNAUTHENTICATED principal
*/
const UNAUTHENTICATED = 1;
@@ -131,7 +131,7 @@ class Sabre_DAVACL_Property_Principal extends Sabre_DAV_Property implements Sabr
* Deserializes a DOM element into a property object.
*
* @param DOMElement $dom
- * @return Sabre_DAV_Property_Principal
+ * @return Sabre_DAVACL_Property_Principal
*/
static public function unserialize(DOMElement $dom) {
diff --git a/3rdparty/Sabre/DAVACL/Version.php b/3rdparty/Sabre/DAVACL/Version.php
index 9950f748741..084a9c13c89 100755
--- a/3rdparty/Sabre/DAVACL/Version.php
+++ b/3rdparty/Sabre/DAVACL/Version.php
@@ -14,7 +14,7 @@ class Sabre_DAVACL_Version {
/**
* Full version number
*/
- const VERSION = '1.6.0';
+ const VERSION = '1.7.0';
/**
* Stability : alpha, beta, stable