commit vendor

This commit is contained in:
2025-11-11 14:49:30 +01:00
parent f33121a308
commit 6d03080c00
2436 changed files with 483781 additions and 0 deletions

View File

@ -0,0 +1,66 @@
<?php
declare(strict_types=1);
namespace Sabre\DAVACL\Xml\Request;
use Sabre\Xml\Deserializer;
use Sabre\Xml\Reader;
use Sabre\Xml\XmlDeserializable;
/**
* AclPrincipalPropSet request parser.
*
* This class parses the {DAV:}acl-principal-prop-set REPORT, as defined in:
*
* https://tools.ietf.org/html/rfc3744#section-9.2
*
* @copyright Copyright (C) fruux GmbH (https://fruux.com/)
* @author Evert Pot (https://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
class AclPrincipalPropSetReport implements XmlDeserializable
{
public $properties = [];
/**
* The deserialize method is called during xml parsing.
*
* This method is called statically, this is because in theory this method
* may be used as a type of constructor, or factory method.
*
* Often you want to return an instance of the current class, but you are
* free to return other data as well.
*
* You are responsible for advancing the reader to the next element. Not
* doing anything will result in a never-ending loop.
*
* If you just want to skip parsing for this element altogether, you can
* just call $reader->next();
*
* $reader->parseInnerTree() will parse the entire sub-tree, and advance to
* the next element.
*
* @return mixed
*/
public static function xmlDeserialize(Reader $reader)
{
$reader->pushContext();
$reader->elementMap['{DAV:}prop'] = 'Sabre\Xml\Deserializer\enum';
$elems = Deserializer\keyValue(
$reader,
'DAV:'
);
$reader->popContext();
$report = new self();
if (!empty($elems['prop'])) {
$report->properties = $elems['prop'];
}
return $report;
}
}

View File

@ -0,0 +1,100 @@
<?php
declare(strict_types=1);
namespace Sabre\DAVACL\Xml\Request;
use Sabre\Xml\Reader;
use Sabre\Xml\XmlDeserializable;
/**
* ExpandProperty request parser.
*
* This class parses the {DAV:}expand-property REPORT, as defined in:
*
* http://tools.ietf.org/html/rfc3253#section-3.8
*
* @copyright Copyright (C) fruux GmbH (https://fruux.com/)
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
class ExpandPropertyReport implements XmlDeserializable
{
/**
* An array with requested properties.
*
* The requested properties will be used as keys in this array. The value
* is normally null.
*
* If the value is an array though, it means the property must be expanded.
* Within the array, the sub-properties, which themselves may be null or
* arrays.
*
* @var array
*/
public $properties;
/**
* The deserialize method is called during xml parsing.
*
* This method is called statically, this is because in theory this method
* may be used as a type of constructor, or factory method.
*
* Often you want to return an instance of the current class, but you are
* free to return other data as well.
*
* You are responsible for advancing the reader to the next element. Not
* doing anything will result in a never-ending loop.
*
* If you just want to skip parsing for this element altogether, you can
* just call $reader->next();
*
* $reader->parseInnerTree() will parse the entire sub-tree, and advance to
* the next element.
*
* @return mixed
*/
public static function xmlDeserialize(Reader $reader)
{
$elems = $reader->parseInnerTree();
$obj = new self();
$obj->properties = self::traverse($elems);
return $obj;
}
/**
* This method is used by deserializeXml, to recursively parse the
* {DAV:}property elements.
*
* @param array $elems
*
* @return array
*/
private static function traverse($elems)
{
$result = [];
foreach ($elems as $elem) {
if ('{DAV:}property' !== $elem['name']) {
continue;
}
$namespace = isset($elem['attributes']['namespace']) ?
$elem['attributes']['namespace'] :
'DAV:';
$propName = '{'.$namespace.'}'.$elem['attributes']['name'];
$value = null;
if (is_array($elem['value'])) {
$value = self::traverse($elem['value']);
}
$result[$propName] = $value;
}
return $result;
}
}

View File

@ -0,0 +1,106 @@
<?php
declare(strict_types=1);
namespace Sabre\DAVACL\Xml\Request;
use Sabre\Xml\Deserializer;
use Sabre\Xml\Reader;
use Sabre\Xml\XmlDeserializable;
/**
* PrincipalMatchReport request parser.
*
* This class parses the {DAV:}principal-match REPORT, as defined
* in:
*
* https://tools.ietf.org/html/rfc3744#section-9.3
*
* @copyright Copyright (C) fruux GmbH (https://fruux.com/)
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
class PrincipalMatchReport implements XmlDeserializable
{
/**
* Report on a list of principals that match the current principal.
*/
const SELF = 1;
/**
* Report on a property on resources, such as {DAV:}owner, that match the current principal.
*/
const PRINCIPAL_PROPERTY = 2;
/**
* Must be SELF or PRINCIPAL_PROPERTY.
*
* @var int
*/
public $type;
/**
* List of properties that are being requested for matching resources.
*
* @var string[]
*/
public $properties = [];
/**
* If $type = PRINCIPAL_PROPERTY, which WebDAV property we should compare
* to the current principal.
*
* @var string
*/
public $principalProperty;
/**
* The deserialize method is called during xml parsing.
*
* This method is called statically, this is because in theory this method
* may be used as a type of constructor, or factory method.
*
* Often you want to return an instance of the current class, but you are
* free to return other data as well.
*
* You are responsible for advancing the reader to the next element. Not
* doing anything will result in a never-ending loop.
*
* If you just want to skip parsing for this element altogether, you can
* just call $reader->next();
*
* $reader->parseInnerTree() will parse the entire sub-tree, and advance to
* the next element.
*
* @return mixed
*/
public static function xmlDeserialize(Reader $reader)
{
$reader->pushContext();
$reader->elementMap['{DAV:}prop'] = 'Sabre\Xml\Deserializer\enum';
$elems = Deserializer\keyValue(
$reader,
'DAV:'
);
$reader->popContext();
$principalMatch = new self();
if (array_key_exists('self', $elems)) {
$principalMatch->type = self::SELF;
}
if (array_key_exists('principal-property', $elems)) {
$principalMatch->type = self::PRINCIPAL_PROPERTY;
$principalMatch->principalProperty = $elems['principal-property'][0]['name'];
}
if (!empty($elems['prop'])) {
$principalMatch->properties = $elems['prop'];
}
return $principalMatch;
}
}

View File

@ -0,0 +1,122 @@
<?php
declare(strict_types=1);
namespace Sabre\DAVACL\Xml\Request;
use Sabre\DAV\Exception\BadRequest;
use Sabre\Xml\Reader;
use Sabre\Xml\XmlDeserializable;
/**
* PrincipalSearchPropertySetReport request parser.
*
* This class parses the {DAV:}principal-property-search REPORT, as defined
* in:
*
* https://tools.ietf.org/html/rfc3744#section-9.4
*
* @copyright Copyright (C) fruux GmbH (https://fruux.com/)
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
class PrincipalPropertySearchReport implements XmlDeserializable
{
/**
* The requested properties.
*
* @var array|null
*/
public $properties;
/**
* searchProperties.
*
* @var array
*/
public $searchProperties = [];
/**
* By default the property search will be conducted on the url of the http
* request. If this is set to true, it will be applied to the principal
* collection set instead.
*
* @var bool
*/
public $applyToPrincipalCollectionSet = false;
/**
* Search for principals matching ANY of the properties (OR) or a ALL of
* the properties (AND).
*
* This property is either "anyof" or "allof".
*
* @var string
*/
public $test;
/**
* The deserialize method is called during xml parsing.
*
* This method is called statically, this is because in theory this method
* may be used as a type of constructor, or factory method.
*
* Often you want to return an instance of the current class, but you are
* free to return other data as well.
*
* You are responsible for advancing the reader to the next element. Not
* doing anything will result in a never-ending loop.
*
* If you just want to skip parsing for this element altogether, you can
* just call $reader->next();
*
* $reader->parseInnerTree() will parse the entire sub-tree, and advance to
* the next element.
*
* @return mixed
*/
public static function xmlDeserialize(Reader $reader)
{
$self = new self();
$foundSearchProp = false;
$self->test = 'allof';
if ('anyof' === $reader->getAttribute('test')) {
$self->test = 'anyof';
}
$elemMap = [
'{DAV:}property-search' => 'Sabre\\Xml\\Element\\KeyValue',
'{DAV:}prop' => 'Sabre\\Xml\\Element\\KeyValue',
];
foreach ($reader->parseInnerTree($elemMap) as $elem) {
switch ($elem['name']) {
case '{DAV:}prop':
$self->properties = array_keys($elem['value']);
break;
case '{DAV:}property-search':
$foundSearchProp = true;
// This property has two sub-elements:
// {DAV:}prop - The property to be searched on. This may
// also be more than one
// {DAV:}match - The value to match with
if (!isset($elem['value']['{DAV:}prop']) || !isset($elem['value']['{DAV:}match'])) {
throw new BadRequest('The {DAV:}property-search element must contain one {DAV:}match and one {DAV:}prop element');
}
foreach ($elem['value']['{DAV:}prop'] as $propName => $discard) {
$self->searchProperties[$propName] = $elem['value']['{DAV:}match'];
}
break;
case '{DAV:}apply-to-principal-collection-set':
$self->applyToPrincipalCollectionSet = true;
break;
}
}
if (!$foundSearchProp) {
throw new BadRequest('The {DAV:}principal-property-search report must contain at least 1 {DAV:}property-search element');
}
return $self;
}
}

View File

@ -0,0 +1,58 @@
<?php
declare(strict_types=1);
namespace Sabre\DAVACL\Xml\Request;
use Sabre\DAV\Exception\BadRequest;
use Sabre\Xml\Reader;
use Sabre\Xml\XmlDeserializable;
/**
* PrincipalSearchPropertySetReport request parser.
*
* This class parses the {DAV:}principal-search-property-set REPORT, as defined
* in:
*
* https://tools.ietf.org/html/rfc3744#section-9.5
*
* @copyright Copyright (C) fruux GmbH (https://fruux.com/)
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
class PrincipalSearchPropertySetReport implements XmlDeserializable
{
/**
* The deserialize method is called during xml parsing.
*
* This method is called statically, this is because in theory this method
* may be used as a type of constructor, or factory method.
*
* Often you want to return an instance of the current class, but you are
* free to return other data as well.
*
* You are responsible for advancing the reader to the next element. Not
* doing anything will result in a never-ending loop.
*
* If you just want to skip parsing for this element altogether, you can
* just call $reader->next();
*
* $reader->parseInnerTree() will parse the entire sub-tree, and advance to
* the next element.
*
* @return mixed
*/
public static function xmlDeserialize(Reader $reader)
{
if (!$reader->isEmptyElement) {
throw new BadRequest('The {DAV:}principal-search-property-set element must be empty');
}
// The element is actually empty, so there's not much to do.
$reader->next();
$self = new self();
return $self;
}
}