@@ -39,7 +39,7 @@ |
||
| 39 | 39 | |
| 40 | 40 | public function xmlSerialize(Writer $writer) { |
| 41 | 41 | foreach ($this->groups as $group) { |
| 42 | - $writer->writeElement('{' . self::NS_OWNCLOUD . '}group', $group); |
|
| 42 | + $writer->writeElement('{'.self::NS_OWNCLOUD.'}group', $group); |
|
| 43 | 43 | } |
| 44 | 44 | } |
| 45 | 45 | } |
@@ -27,21 +27,21 @@ |
||
| 27 | 27 | use Sabre\Xml\XmlSerializable; |
| 28 | 28 | |
| 29 | 29 | class Groups implements XmlSerializable { |
| 30 | - public const NS_OWNCLOUD = 'http://owncloud.org/ns'; |
|
| 30 | + public const NS_OWNCLOUD = 'http://owncloud.org/ns'; |
|
| 31 | 31 | |
| 32 | - /** @var string[] of TYPE:CHECKSUM */ |
|
| 33 | - private $groups; |
|
| 32 | + /** @var string[] of TYPE:CHECKSUM */ |
|
| 33 | + private $groups; |
|
| 34 | 34 | |
| 35 | - /** |
|
| 36 | - * @param string $groups |
|
| 37 | - */ |
|
| 38 | - public function __construct($groups) { |
|
| 39 | - $this->groups = $groups; |
|
| 40 | - } |
|
| 35 | + /** |
|
| 36 | + * @param string $groups |
|
| 37 | + */ |
|
| 38 | + public function __construct($groups) { |
|
| 39 | + $this->groups = $groups; |
|
| 40 | + } |
|
| 41 | 41 | |
| 42 | - public function xmlSerialize(Writer $writer) { |
|
| 43 | - foreach ($this->groups as $group) { |
|
| 44 | - $writer->writeElement('{' . self::NS_OWNCLOUD . '}group', $group); |
|
| 45 | - } |
|
| 46 | - } |
|
| 42 | + public function xmlSerialize(Writer $writer) { |
|
| 43 | + foreach ($this->groups as $group) { |
|
| 44 | + $writer->writeElement('{' . self::NS_OWNCLOUD . '}group', $group); |
|
| 45 | + } |
|
| 46 | + } |
|
| 47 | 47 | } |
@@ -116,42 +116,42 @@ |
||
| 116 | 116 | * @return void |
| 117 | 117 | */ |
| 118 | 118 | public function xmlSerialize(Writer $writer) { |
| 119 | - $cs = '{' . Plugin::NS_OWNCLOUD . '}'; |
|
| 119 | + $cs = '{'.Plugin::NS_OWNCLOUD.'}'; |
|
| 120 | 120 | |
| 121 | 121 | if (!is_null($this->organizer)) { |
| 122 | - $writer->startElement($cs . 'organizer'); |
|
| 122 | + $writer->startElement($cs.'organizer'); |
|
| 123 | 123 | $writer->writeElement('{DAV:}href', $this->organizer['href']); |
| 124 | 124 | |
| 125 | 125 | if (isset($this->organizer['commonName']) && $this->organizer['commonName']) { |
| 126 | - $writer->writeElement($cs . 'common-name', $this->organizer['commonName']); |
|
| 126 | + $writer->writeElement($cs.'common-name', $this->organizer['commonName']); |
|
| 127 | 127 | } |
| 128 | 128 | if (isset($this->organizer['firstName']) && $this->organizer['firstName']) { |
| 129 | - $writer->writeElement($cs . 'first-name', $this->organizer['firstName']); |
|
| 129 | + $writer->writeElement($cs.'first-name', $this->organizer['firstName']); |
|
| 130 | 130 | } |
| 131 | 131 | if (isset($this->organizer['lastName']) && $this->organizer['lastName']) { |
| 132 | - $writer->writeElement($cs . 'last-name', $this->organizer['lastName']); |
|
| 132 | + $writer->writeElement($cs.'last-name', $this->organizer['lastName']); |
|
| 133 | 133 | } |
| 134 | 134 | $writer->endElement(); // organizer |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | foreach ($this->users as $user) { |
| 138 | - $writer->startElement($cs . 'user'); |
|
| 138 | + $writer->startElement($cs.'user'); |
|
| 139 | 139 | $writer->writeElement('{DAV:}href', $user['href']); |
| 140 | 140 | if (isset($user['commonName']) && $user['commonName']) { |
| 141 | - $writer->writeElement($cs . 'common-name', $user['commonName']); |
|
| 141 | + $writer->writeElement($cs.'common-name', $user['commonName']); |
|
| 142 | 142 | } |
| 143 | - $writer->writeElement($cs . 'invite-accepted'); |
|
| 143 | + $writer->writeElement($cs.'invite-accepted'); |
|
| 144 | 144 | |
| 145 | - $writer->startElement($cs . 'access'); |
|
| 145 | + $writer->startElement($cs.'access'); |
|
| 146 | 146 | if ($user['readOnly']) { |
| 147 | - $writer->writeElement($cs . 'read'); |
|
| 147 | + $writer->writeElement($cs.'read'); |
|
| 148 | 148 | } else { |
| 149 | - $writer->writeElement($cs . 'read-write'); |
|
| 149 | + $writer->writeElement($cs.'read-write'); |
|
| 150 | 150 | } |
| 151 | 151 | $writer->endElement(); // access |
| 152 | 152 | |
| 153 | 153 | if (isset($user['summary']) && $user['summary']) { |
| 154 | - $writer->writeElement($cs . 'summary', $user['summary']); |
|
| 154 | + $writer->writeElement($cs.'summary', $user['summary']); |
|
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | $writer->endElement(); //user |
@@ -44,120 +44,120 @@ |
||
| 44 | 44 | */ |
| 45 | 45 | class Invite implements XmlSerializable { |
| 46 | 46 | |
| 47 | - /** |
|
| 48 | - * The list of users a calendar has been shared to. |
|
| 49 | - * |
|
| 50 | - * @var array |
|
| 51 | - */ |
|
| 52 | - protected $users; |
|
| 47 | + /** |
|
| 48 | + * The list of users a calendar has been shared to. |
|
| 49 | + * |
|
| 50 | + * @var array |
|
| 51 | + */ |
|
| 52 | + protected $users; |
|
| 53 | 53 | |
| 54 | - /** |
|
| 55 | - * The organizer contains information about the person who shared the |
|
| 56 | - * object. |
|
| 57 | - * |
|
| 58 | - * @var array|null |
|
| 59 | - */ |
|
| 60 | - protected $organizer; |
|
| 54 | + /** |
|
| 55 | + * The organizer contains information about the person who shared the |
|
| 56 | + * object. |
|
| 57 | + * |
|
| 58 | + * @var array|null |
|
| 59 | + */ |
|
| 60 | + protected $organizer; |
|
| 61 | 61 | |
| 62 | - /** |
|
| 63 | - * Creates the property. |
|
| 64 | - * |
|
| 65 | - * Users is an array. Each element of the array has the following |
|
| 66 | - * properties: |
|
| 67 | - * |
|
| 68 | - * * href - Often a mailto: address |
|
| 69 | - * * commonName - Optional, for example a first and lastname for a user. |
|
| 70 | - * * status - One of the SharingPlugin::STATUS_* constants. |
|
| 71 | - * * readOnly - true or false |
|
| 72 | - * * summary - Optional, description of the share |
|
| 73 | - * |
|
| 74 | - * The organizer key is optional to specify. It's only useful when a |
|
| 75 | - * 'sharee' requests the sharing information. |
|
| 76 | - * |
|
| 77 | - * The organizer may have the following properties: |
|
| 78 | - * * href - Often a mailto: address. |
|
| 79 | - * * commonName - Optional human-readable name. |
|
| 80 | - * * firstName - Optional first name. |
|
| 81 | - * * lastName - Optional last name. |
|
| 82 | - * |
|
| 83 | - * If you wonder why these two structures are so different, I guess a |
|
| 84 | - * valid answer is that the current spec is still a draft. |
|
| 85 | - * |
|
| 86 | - * @param array $users |
|
| 87 | - */ |
|
| 88 | - public function __construct(array $users, array $organizer = null) { |
|
| 89 | - $this->users = $users; |
|
| 90 | - $this->organizer = $organizer; |
|
| 91 | - } |
|
| 62 | + /** |
|
| 63 | + * Creates the property. |
|
| 64 | + * |
|
| 65 | + * Users is an array. Each element of the array has the following |
|
| 66 | + * properties: |
|
| 67 | + * |
|
| 68 | + * * href - Often a mailto: address |
|
| 69 | + * * commonName - Optional, for example a first and lastname for a user. |
|
| 70 | + * * status - One of the SharingPlugin::STATUS_* constants. |
|
| 71 | + * * readOnly - true or false |
|
| 72 | + * * summary - Optional, description of the share |
|
| 73 | + * |
|
| 74 | + * The organizer key is optional to specify. It's only useful when a |
|
| 75 | + * 'sharee' requests the sharing information. |
|
| 76 | + * |
|
| 77 | + * The organizer may have the following properties: |
|
| 78 | + * * href - Often a mailto: address. |
|
| 79 | + * * commonName - Optional human-readable name. |
|
| 80 | + * * firstName - Optional first name. |
|
| 81 | + * * lastName - Optional last name. |
|
| 82 | + * |
|
| 83 | + * If you wonder why these two structures are so different, I guess a |
|
| 84 | + * valid answer is that the current spec is still a draft. |
|
| 85 | + * |
|
| 86 | + * @param array $users |
|
| 87 | + */ |
|
| 88 | + public function __construct(array $users, array $organizer = null) { |
|
| 89 | + $this->users = $users; |
|
| 90 | + $this->organizer = $organizer; |
|
| 91 | + } |
|
| 92 | 92 | |
| 93 | - /** |
|
| 94 | - * Returns the list of users, as it was passed to the constructor. |
|
| 95 | - * |
|
| 96 | - * @return array |
|
| 97 | - */ |
|
| 98 | - public function getValue() { |
|
| 99 | - return $this->users; |
|
| 100 | - } |
|
| 93 | + /** |
|
| 94 | + * Returns the list of users, as it was passed to the constructor. |
|
| 95 | + * |
|
| 96 | + * @return array |
|
| 97 | + */ |
|
| 98 | + public function getValue() { |
|
| 99 | + return $this->users; |
|
| 100 | + } |
|
| 101 | 101 | |
| 102 | - /** |
|
| 103 | - * The xmlSerialize method is called during xml writing. |
|
| 104 | - * |
|
| 105 | - * Use the $writer argument to write its own xml serialization. |
|
| 106 | - * |
|
| 107 | - * An important note: do _not_ create a parent element. Any element |
|
| 108 | - * implementing XmlSerializble should only ever write what's considered |
|
| 109 | - * its 'inner xml'. |
|
| 110 | - * |
|
| 111 | - * The parent of the current element is responsible for writing a |
|
| 112 | - * containing element. |
|
| 113 | - * |
|
| 114 | - * This allows serializers to be re-used for different element names. |
|
| 115 | - * |
|
| 116 | - * If you are opening new elements, you must also close them again. |
|
| 117 | - * |
|
| 118 | - * @param Writer $writer |
|
| 119 | - * @return void |
|
| 120 | - */ |
|
| 121 | - public function xmlSerialize(Writer $writer) { |
|
| 122 | - $cs = '{' . Plugin::NS_OWNCLOUD . '}'; |
|
| 102 | + /** |
|
| 103 | + * The xmlSerialize method is called during xml writing. |
|
| 104 | + * |
|
| 105 | + * Use the $writer argument to write its own xml serialization. |
|
| 106 | + * |
|
| 107 | + * An important note: do _not_ create a parent element. Any element |
|
| 108 | + * implementing XmlSerializble should only ever write what's considered |
|
| 109 | + * its 'inner xml'. |
|
| 110 | + * |
|
| 111 | + * The parent of the current element is responsible for writing a |
|
| 112 | + * containing element. |
|
| 113 | + * |
|
| 114 | + * This allows serializers to be re-used for different element names. |
|
| 115 | + * |
|
| 116 | + * If you are opening new elements, you must also close them again. |
|
| 117 | + * |
|
| 118 | + * @param Writer $writer |
|
| 119 | + * @return void |
|
| 120 | + */ |
|
| 121 | + public function xmlSerialize(Writer $writer) { |
|
| 122 | + $cs = '{' . Plugin::NS_OWNCLOUD . '}'; |
|
| 123 | 123 | |
| 124 | - if (!is_null($this->organizer)) { |
|
| 125 | - $writer->startElement($cs . 'organizer'); |
|
| 126 | - $writer->writeElement('{DAV:}href', $this->organizer['href']); |
|
| 124 | + if (!is_null($this->organizer)) { |
|
| 125 | + $writer->startElement($cs . 'organizer'); |
|
| 126 | + $writer->writeElement('{DAV:}href', $this->organizer['href']); |
|
| 127 | 127 | |
| 128 | - if (isset($this->organizer['commonName']) && $this->organizer['commonName']) { |
|
| 129 | - $writer->writeElement($cs . 'common-name', $this->organizer['commonName']); |
|
| 130 | - } |
|
| 131 | - if (isset($this->organizer['firstName']) && $this->organizer['firstName']) { |
|
| 132 | - $writer->writeElement($cs . 'first-name', $this->organizer['firstName']); |
|
| 133 | - } |
|
| 134 | - if (isset($this->organizer['lastName']) && $this->organizer['lastName']) { |
|
| 135 | - $writer->writeElement($cs . 'last-name', $this->organizer['lastName']); |
|
| 136 | - } |
|
| 137 | - $writer->endElement(); // organizer |
|
| 138 | - } |
|
| 128 | + if (isset($this->organizer['commonName']) && $this->organizer['commonName']) { |
|
| 129 | + $writer->writeElement($cs . 'common-name', $this->organizer['commonName']); |
|
| 130 | + } |
|
| 131 | + if (isset($this->organizer['firstName']) && $this->organizer['firstName']) { |
|
| 132 | + $writer->writeElement($cs . 'first-name', $this->organizer['firstName']); |
|
| 133 | + } |
|
| 134 | + if (isset($this->organizer['lastName']) && $this->organizer['lastName']) { |
|
| 135 | + $writer->writeElement($cs . 'last-name', $this->organizer['lastName']); |
|
| 136 | + } |
|
| 137 | + $writer->endElement(); // organizer |
|
| 138 | + } |
|
| 139 | 139 | |
| 140 | - foreach ($this->users as $user) { |
|
| 141 | - $writer->startElement($cs . 'user'); |
|
| 142 | - $writer->writeElement('{DAV:}href', $user['href']); |
|
| 143 | - if (isset($user['commonName']) && $user['commonName']) { |
|
| 144 | - $writer->writeElement($cs . 'common-name', $user['commonName']); |
|
| 145 | - } |
|
| 146 | - $writer->writeElement($cs . 'invite-accepted'); |
|
| 140 | + foreach ($this->users as $user) { |
|
| 141 | + $writer->startElement($cs . 'user'); |
|
| 142 | + $writer->writeElement('{DAV:}href', $user['href']); |
|
| 143 | + if (isset($user['commonName']) && $user['commonName']) { |
|
| 144 | + $writer->writeElement($cs . 'common-name', $user['commonName']); |
|
| 145 | + } |
|
| 146 | + $writer->writeElement($cs . 'invite-accepted'); |
|
| 147 | 147 | |
| 148 | - $writer->startElement($cs . 'access'); |
|
| 149 | - if ($user['readOnly']) { |
|
| 150 | - $writer->writeElement($cs . 'read'); |
|
| 151 | - } else { |
|
| 152 | - $writer->writeElement($cs . 'read-write'); |
|
| 153 | - } |
|
| 154 | - $writer->endElement(); // access |
|
| 148 | + $writer->startElement($cs . 'access'); |
|
| 149 | + if ($user['readOnly']) { |
|
| 150 | + $writer->writeElement($cs . 'read'); |
|
| 151 | + } else { |
|
| 152 | + $writer->writeElement($cs . 'read-write'); |
|
| 153 | + } |
|
| 154 | + $writer->endElement(); // access |
|
| 155 | 155 | |
| 156 | - if (isset($user['summary']) && $user['summary']) { |
|
| 157 | - $writer->writeElement($cs . 'summary', $user['summary']); |
|
| 158 | - } |
|
| 156 | + if (isset($user['summary']) && $user['summary']) { |
|
| 157 | + $writer->writeElement($cs . 'summary', $user['summary']); |
|
| 158 | + } |
|
| 159 | 159 | |
| 160 | - $writer->endElement(); //user |
|
| 161 | - } |
|
| 162 | - } |
|
| 160 | + $writer->endElement(); //user |
|
| 161 | + } |
|
| 162 | + } |
|
| 163 | 163 | } |
@@ -26,54 +26,54 @@ |
||
| 26 | 26 | use Sabre\Xml\XmlDeserializable; |
| 27 | 27 | |
| 28 | 28 | class ShareRequest implements XmlDeserializable { |
| 29 | - public $set = []; |
|
| 29 | + public $set = []; |
|
| 30 | 30 | |
| 31 | - public $remove = []; |
|
| 31 | + public $remove = []; |
|
| 32 | 32 | |
| 33 | - /** |
|
| 34 | - * Constructor |
|
| 35 | - * |
|
| 36 | - * @param array $set |
|
| 37 | - * @param array $remove |
|
| 38 | - */ |
|
| 39 | - public function __construct(array $set, array $remove) { |
|
| 40 | - $this->set = $set; |
|
| 41 | - $this->remove = $remove; |
|
| 42 | - } |
|
| 33 | + /** |
|
| 34 | + * Constructor |
|
| 35 | + * |
|
| 36 | + * @param array $set |
|
| 37 | + * @param array $remove |
|
| 38 | + */ |
|
| 39 | + public function __construct(array $set, array $remove) { |
|
| 40 | + $this->set = $set; |
|
| 41 | + $this->remove = $remove; |
|
| 42 | + } |
|
| 43 | 43 | |
| 44 | - public static function xmlDeserialize(Reader $reader) { |
|
| 45 | - $elements = $reader->parseInnerTree([ |
|
| 46 | - '{' . Plugin::NS_OWNCLOUD. '}set' => 'Sabre\\Xml\\Element\\KeyValue', |
|
| 47 | - '{' . Plugin::NS_OWNCLOUD . '}remove' => 'Sabre\\Xml\\Element\\KeyValue', |
|
| 48 | - ]); |
|
| 44 | + public static function xmlDeserialize(Reader $reader) { |
|
| 45 | + $elements = $reader->parseInnerTree([ |
|
| 46 | + '{' . Plugin::NS_OWNCLOUD. '}set' => 'Sabre\\Xml\\Element\\KeyValue', |
|
| 47 | + '{' . Plugin::NS_OWNCLOUD . '}remove' => 'Sabre\\Xml\\Element\\KeyValue', |
|
| 48 | + ]); |
|
| 49 | 49 | |
| 50 | - $set = []; |
|
| 51 | - $remove = []; |
|
| 50 | + $set = []; |
|
| 51 | + $remove = []; |
|
| 52 | 52 | |
| 53 | - foreach ($elements as $elem) { |
|
| 54 | - switch ($elem['name']) { |
|
| 53 | + foreach ($elements as $elem) { |
|
| 54 | + switch ($elem['name']) { |
|
| 55 | 55 | |
| 56 | - case '{' . Plugin::NS_OWNCLOUD . '}set': |
|
| 57 | - $sharee = $elem['value']; |
|
| 56 | + case '{' . Plugin::NS_OWNCLOUD . '}set': |
|
| 57 | + $sharee = $elem['value']; |
|
| 58 | 58 | |
| 59 | - $sumElem = '{' . Plugin::NS_OWNCLOUD . '}summary'; |
|
| 60 | - $commonName = '{' . Plugin::NS_OWNCLOUD . '}common-name'; |
|
| 59 | + $sumElem = '{' . Plugin::NS_OWNCLOUD . '}summary'; |
|
| 60 | + $commonName = '{' . Plugin::NS_OWNCLOUD . '}common-name'; |
|
| 61 | 61 | |
| 62 | - $set[] = [ |
|
| 63 | - 'href' => $sharee['{DAV:}href'], |
|
| 64 | - 'commonName' => isset($sharee[$commonName]) ? $sharee[$commonName] : null, |
|
| 65 | - 'summary' => isset($sharee[$sumElem]) ? $sharee[$sumElem] : null, |
|
| 66 | - 'readOnly' => !array_key_exists('{' . Plugin::NS_OWNCLOUD . '}read-write', $sharee), |
|
| 67 | - ]; |
|
| 68 | - break; |
|
| 62 | + $set[] = [ |
|
| 63 | + 'href' => $sharee['{DAV:}href'], |
|
| 64 | + 'commonName' => isset($sharee[$commonName]) ? $sharee[$commonName] : null, |
|
| 65 | + 'summary' => isset($sharee[$sumElem]) ? $sharee[$sumElem] : null, |
|
| 66 | + 'readOnly' => !array_key_exists('{' . Plugin::NS_OWNCLOUD . '}read-write', $sharee), |
|
| 67 | + ]; |
|
| 68 | + break; |
|
| 69 | 69 | |
| 70 | - case '{' . Plugin::NS_OWNCLOUD . '}remove': |
|
| 71 | - $remove[] = $elem['value']['{DAV:}href']; |
|
| 72 | - break; |
|
| 70 | + case '{' . Plugin::NS_OWNCLOUD . '}remove': |
|
| 71 | + $remove[] = $elem['value']['{DAV:}href']; |
|
| 72 | + break; |
|
| 73 | 73 | |
| 74 | - } |
|
| 75 | - } |
|
| 74 | + } |
|
| 75 | + } |
|
| 76 | 76 | |
| 77 | - return new self($set, $remove); |
|
| 78 | - } |
|
| 77 | + return new self($set, $remove); |
|
| 78 | + } |
|
| 79 | 79 | } |
@@ -43,8 +43,8 @@ discard block |
||
| 43 | 43 | |
| 44 | 44 | public static function xmlDeserialize(Reader $reader) { |
| 45 | 45 | $elements = $reader->parseInnerTree([ |
| 46 | - '{' . Plugin::NS_OWNCLOUD. '}set' => 'Sabre\\Xml\\Element\\KeyValue', |
|
| 47 | - '{' . Plugin::NS_OWNCLOUD . '}remove' => 'Sabre\\Xml\\Element\\KeyValue', |
|
| 46 | + '{'.Plugin::NS_OWNCLOUD.'}set' => 'Sabre\\Xml\\Element\\KeyValue', |
|
| 47 | + '{'.Plugin::NS_OWNCLOUD.'}remove' => 'Sabre\\Xml\\Element\\KeyValue', |
|
| 48 | 48 | ]); |
| 49 | 49 | |
| 50 | 50 | $set = []; |
@@ -53,21 +53,21 @@ discard block |
||
| 53 | 53 | foreach ($elements as $elem) { |
| 54 | 54 | switch ($elem['name']) { |
| 55 | 55 | |
| 56 | - case '{' . Plugin::NS_OWNCLOUD . '}set': |
|
| 56 | + case '{'.Plugin::NS_OWNCLOUD.'}set': |
|
| 57 | 57 | $sharee = $elem['value']; |
| 58 | 58 | |
| 59 | - $sumElem = '{' . Plugin::NS_OWNCLOUD . '}summary'; |
|
| 60 | - $commonName = '{' . Plugin::NS_OWNCLOUD . '}common-name'; |
|
| 59 | + $sumElem = '{'.Plugin::NS_OWNCLOUD.'}summary'; |
|
| 60 | + $commonName = '{'.Plugin::NS_OWNCLOUD.'}common-name'; |
|
| 61 | 61 | |
| 62 | 62 | $set[] = [ |
| 63 | 63 | 'href' => $sharee['{DAV:}href'], |
| 64 | 64 | 'commonName' => isset($sharee[$commonName]) ? $sharee[$commonName] : null, |
| 65 | 65 | 'summary' => isset($sharee[$sumElem]) ? $sharee[$sumElem] : null, |
| 66 | - 'readOnly' => !array_key_exists('{' . Plugin::NS_OWNCLOUD . '}read-write', $sharee), |
|
| 66 | + 'readOnly' => !array_key_exists('{'.Plugin::NS_OWNCLOUD.'}read-write', $sharee), |
|
| 67 | 67 | ]; |
| 68 | 68 | break; |
| 69 | 69 | |
| 70 | - case '{' . Plugin::NS_OWNCLOUD . '}remove': |
|
| 70 | + case '{'.Plugin::NS_OWNCLOUD.'}remove': |
|
| 71 | 71 | $remove[] = $elem['value']['{DAV:}href']; |
| 72 | 72 | break; |
| 73 | 73 | |
@@ -63,7 +63,7 @@ |
||
| 63 | 63 | private function setupUserFs($userId) { |
| 64 | 64 | \OC_Util::setupFS($userId); |
| 65 | 65 | $this->session->close(); |
| 66 | - return $this->principalPrefix . $userId; |
|
| 66 | + return $this->principalPrefix.$userId; |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | /** |
@@ -31,56 +31,56 @@ |
||
| 31 | 31 | use Sabre\HTTP\ResponseInterface; |
| 32 | 32 | |
| 33 | 33 | class BearerAuth extends AbstractBearer { |
| 34 | - private IUserSession $userSession; |
|
| 35 | - private ISession $session; |
|
| 36 | - private IRequest $request; |
|
| 37 | - private string $principalPrefix; |
|
| 34 | + private IUserSession $userSession; |
|
| 35 | + private ISession $session; |
|
| 36 | + private IRequest $request; |
|
| 37 | + private string $principalPrefix; |
|
| 38 | 38 | |
| 39 | - public function __construct(IUserSession $userSession, |
|
| 40 | - ISession $session, |
|
| 41 | - IRequest $request, |
|
| 42 | - $principalPrefix = 'principals/users/') { |
|
| 43 | - $this->userSession = $userSession; |
|
| 44 | - $this->session = $session; |
|
| 45 | - $this->request = $request; |
|
| 46 | - $this->principalPrefix = $principalPrefix; |
|
| 39 | + public function __construct(IUserSession $userSession, |
|
| 40 | + ISession $session, |
|
| 41 | + IRequest $request, |
|
| 42 | + $principalPrefix = 'principals/users/') { |
|
| 43 | + $this->userSession = $userSession; |
|
| 44 | + $this->session = $session; |
|
| 45 | + $this->request = $request; |
|
| 46 | + $this->principalPrefix = $principalPrefix; |
|
| 47 | 47 | |
| 48 | - // setup realm |
|
| 49 | - $defaults = new \OCP\Defaults(); |
|
| 50 | - $this->realm = $defaults->getName(); |
|
| 51 | - } |
|
| 48 | + // setup realm |
|
| 49 | + $defaults = new \OCP\Defaults(); |
|
| 50 | + $this->realm = $defaults->getName(); |
|
| 51 | + } |
|
| 52 | 52 | |
| 53 | - private function setupUserFs($userId) { |
|
| 54 | - \OC_Util::setupFS($userId); |
|
| 55 | - $this->session->close(); |
|
| 56 | - return $this->principalPrefix . $userId; |
|
| 57 | - } |
|
| 53 | + private function setupUserFs($userId) { |
|
| 54 | + \OC_Util::setupFS($userId); |
|
| 55 | + $this->session->close(); |
|
| 56 | + return $this->principalPrefix . $userId; |
|
| 57 | + } |
|
| 58 | 58 | |
| 59 | - /** |
|
| 60 | - * {@inheritdoc} |
|
| 61 | - */ |
|
| 62 | - public function validateBearerToken($bearerToken) { |
|
| 63 | - \OC_Util::setupFS(); |
|
| 59 | + /** |
|
| 60 | + * {@inheritdoc} |
|
| 61 | + */ |
|
| 62 | + public function validateBearerToken($bearerToken) { |
|
| 63 | + \OC_Util::setupFS(); |
|
| 64 | 64 | |
| 65 | - if (!$this->userSession->isLoggedIn()) { |
|
| 66 | - $this->userSession->tryTokenLogin($this->request); |
|
| 67 | - } |
|
| 68 | - if ($this->userSession->isLoggedIn()) { |
|
| 69 | - return $this->setupUserFs($this->userSession->getUser()->getUID()); |
|
| 70 | - } |
|
| 65 | + if (!$this->userSession->isLoggedIn()) { |
|
| 66 | + $this->userSession->tryTokenLogin($this->request); |
|
| 67 | + } |
|
| 68 | + if ($this->userSession->isLoggedIn()) { |
|
| 69 | + return $this->setupUserFs($this->userSession->getUser()->getUID()); |
|
| 70 | + } |
|
| 71 | 71 | |
| 72 | - return false; |
|
| 73 | - } |
|
| 72 | + return false; |
|
| 73 | + } |
|
| 74 | 74 | |
| 75 | - /** |
|
| 76 | - * \Sabre\DAV\Auth\Backend\AbstractBearer::challenge sets an WWW-Authenticate |
|
| 77 | - * header which some DAV clients can't handle. Thus we override this function |
|
| 78 | - * and make it simply return a 401. |
|
| 79 | - * |
|
| 80 | - * @param RequestInterface $request |
|
| 81 | - * @param ResponseInterface $response |
|
| 82 | - */ |
|
| 83 | - public function challenge(RequestInterface $request, ResponseInterface $response): void { |
|
| 84 | - $response->setStatus(401); |
|
| 85 | - } |
|
| 75 | + /** |
|
| 76 | + * \Sabre\DAV\Auth\Backend\AbstractBearer::challenge sets an WWW-Authenticate |
|
| 77 | + * header which some DAV clients can't handle. Thus we override this function |
|
| 78 | + * and make it simply return a 401. |
|
| 79 | + * |
|
| 80 | + * @param RequestInterface $request |
|
| 81 | + * @param ResponseInterface $response |
|
| 82 | + */ |
|
| 83 | + public function challenge(RequestInterface $request, ResponseInterface $response): void { |
|
| 84 | + $response->setStatus(401); |
|
| 85 | + } |
|
| 86 | 86 | } |
@@ -29,19 +29,19 @@ |
||
| 29 | 29 | use Exception; |
| 30 | 30 | |
| 31 | 31 | class FileLocked extends \Sabre\DAV\Exception { |
| 32 | - public function __construct($message = "", $code = 0, Exception $previous = null) { |
|
| 33 | - if ($previous instanceof \OCP\Files\LockNotAcquiredException) { |
|
| 34 | - $message = sprintf('Target file %s is locked by another process.', $previous->path); |
|
| 35 | - } |
|
| 36 | - parent::__construct($message, $code, $previous); |
|
| 37 | - } |
|
| 32 | + public function __construct($message = "", $code = 0, Exception $previous = null) { |
|
| 33 | + if ($previous instanceof \OCP\Files\LockNotAcquiredException) { |
|
| 34 | + $message = sprintf('Target file %s is locked by another process.', $previous->path); |
|
| 35 | + } |
|
| 36 | + parent::__construct($message, $code, $previous); |
|
| 37 | + } |
|
| 38 | 38 | |
| 39 | - /** |
|
| 40 | - * Returns the HTTP status code for this exception |
|
| 41 | - * |
|
| 42 | - * @return int |
|
| 43 | - */ |
|
| 44 | - public function getHTTPCode() { |
|
| 45 | - return 423; |
|
| 46 | - } |
|
| 39 | + /** |
|
| 40 | + * Returns the HTTP status code for this exception |
|
| 41 | + * |
|
| 42 | + * @return int |
|
| 43 | + */ |
|
| 44 | + public function getHTTPCode() { |
|
| 45 | + return 423; |
|
| 46 | + } |
|
| 47 | 47 | } |
@@ -31,12 +31,12 @@ |
||
| 31 | 31 | */ |
| 32 | 32 | class UnsupportedMediaType extends \Sabre\DAV\Exception { |
| 33 | 33 | |
| 34 | - /** |
|
| 35 | - * Returns the HTTP status code for this exception |
|
| 36 | - * |
|
| 37 | - * @return int |
|
| 38 | - */ |
|
| 39 | - public function getHTTPCode() { |
|
| 40 | - return 415; |
|
| 41 | - } |
|
| 34 | + /** |
|
| 35 | + * Returns the HTTP status code for this exception |
|
| 36 | + * |
|
| 37 | + * @return int |
|
| 38 | + */ |
|
| 39 | + public function getHTTPCode() { |
|
| 40 | + return 415; |
|
| 41 | + } |
|
| 42 | 42 | } |
@@ -31,12 +31,12 @@ |
||
| 31 | 31 | */ |
| 32 | 32 | class EntityTooLarge extends \Sabre\DAV\Exception { |
| 33 | 33 | |
| 34 | - /** |
|
| 35 | - * Returns the HTTP status code for this exception |
|
| 36 | - * |
|
| 37 | - * @return int |
|
| 38 | - */ |
|
| 39 | - public function getHTTPCode() { |
|
| 40 | - return 413; |
|
| 41 | - } |
|
| 34 | + /** |
|
| 35 | + * Returns the HTTP status code for this exception |
|
| 36 | + * |
|
| 37 | + * @return int |
|
| 38 | + */ |
|
| 39 | + public function getHTTPCode() { |
|
| 40 | + return 413; |
|
| 41 | + } |
|
| 42 | 42 | } |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | return null; |
| 89 | 89 | } |
| 90 | 90 | foreach ($tree as $elem) { |
| 91 | - if ($elem['name'] === '{' . self::NS_OWNCLOUD . '}tag') { |
|
| 91 | + if ($elem['name'] === '{'.self::NS_OWNCLOUD.'}tag') { |
|
| 92 | 92 | $tags[] = $elem['value']; |
| 93 | 93 | } |
| 94 | 94 | } |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | */ |
| 117 | 117 | public function xmlSerialize(Writer $writer) { |
| 118 | 118 | foreach ($this->tags as $tag) { |
| 119 | - $writer->writeElement('{' . self::NS_OWNCLOUD . '}tag', $tag); |
|
| 119 | + $writer->writeElement('{'.self::NS_OWNCLOUD.'}tag', $tag); |
|
| 120 | 120 | } |
| 121 | 121 | } |
| 122 | 122 | } |
@@ -33,89 +33,89 @@ |
||
| 33 | 33 | * This property contains multiple "tag" elements, each containing a tag name. |
| 34 | 34 | */ |
| 35 | 35 | class TagList implements Element { |
| 36 | - public const NS_OWNCLOUD = 'http://owncloud.org/ns'; |
|
| 36 | + public const NS_OWNCLOUD = 'http://owncloud.org/ns'; |
|
| 37 | 37 | |
| 38 | - /** |
|
| 39 | - * tags |
|
| 40 | - * |
|
| 41 | - * @var array |
|
| 42 | - */ |
|
| 43 | - private $tags; |
|
| 38 | + /** |
|
| 39 | + * tags |
|
| 40 | + * |
|
| 41 | + * @var array |
|
| 42 | + */ |
|
| 43 | + private $tags; |
|
| 44 | 44 | |
| 45 | - /** |
|
| 46 | - * @param array $tags |
|
| 47 | - */ |
|
| 48 | - public function __construct(array $tags) { |
|
| 49 | - $this->tags = $tags; |
|
| 50 | - } |
|
| 45 | + /** |
|
| 46 | + * @param array $tags |
|
| 47 | + */ |
|
| 48 | + public function __construct(array $tags) { |
|
| 49 | + $this->tags = $tags; |
|
| 50 | + } |
|
| 51 | 51 | |
| 52 | - /** |
|
| 53 | - * Returns the tags |
|
| 54 | - * |
|
| 55 | - * @return array |
|
| 56 | - */ |
|
| 57 | - public function getTags() { |
|
| 58 | - return $this->tags; |
|
| 59 | - } |
|
| 52 | + /** |
|
| 53 | + * Returns the tags |
|
| 54 | + * |
|
| 55 | + * @return array |
|
| 56 | + */ |
|
| 57 | + public function getTags() { |
|
| 58 | + return $this->tags; |
|
| 59 | + } |
|
| 60 | 60 | |
| 61 | - /** |
|
| 62 | - * The deserialize method is called during xml parsing. |
|
| 63 | - * |
|
| 64 | - * This method is called statictly, this is because in theory this method |
|
| 65 | - * may be used as a type of constructor, or factory method. |
|
| 66 | - * |
|
| 67 | - * Often you want to return an instance of the current class, but you are |
|
| 68 | - * free to return other data as well. |
|
| 69 | - * |
|
| 70 | - * You are responsible for advancing the reader to the next element. Not |
|
| 71 | - * doing anything will result in a never-ending loop. |
|
| 72 | - * |
|
| 73 | - * If you just want to skip parsing for this element altogether, you can |
|
| 74 | - * just call $reader->next(); |
|
| 75 | - * |
|
| 76 | - * $reader->parseInnerTree() will parse the entire sub-tree, and advance to |
|
| 77 | - * the next element. |
|
| 78 | - * |
|
| 79 | - * @param Reader $reader |
|
| 80 | - * @return mixed |
|
| 81 | - */ |
|
| 82 | - public static function xmlDeserialize(Reader $reader) { |
|
| 83 | - $tags = []; |
|
| 61 | + /** |
|
| 62 | + * The deserialize method is called during xml parsing. |
|
| 63 | + * |
|
| 64 | + * This method is called statictly, this is because in theory this method |
|
| 65 | + * may be used as a type of constructor, or factory method. |
|
| 66 | + * |
|
| 67 | + * Often you want to return an instance of the current class, but you are |
|
| 68 | + * free to return other data as well. |
|
| 69 | + * |
|
| 70 | + * You are responsible for advancing the reader to the next element. Not |
|
| 71 | + * doing anything will result in a never-ending loop. |
|
| 72 | + * |
|
| 73 | + * If you just want to skip parsing for this element altogether, you can |
|
| 74 | + * just call $reader->next(); |
|
| 75 | + * |
|
| 76 | + * $reader->parseInnerTree() will parse the entire sub-tree, and advance to |
|
| 77 | + * the next element. |
|
| 78 | + * |
|
| 79 | + * @param Reader $reader |
|
| 80 | + * @return mixed |
|
| 81 | + */ |
|
| 82 | + public static function xmlDeserialize(Reader $reader) { |
|
| 83 | + $tags = []; |
|
| 84 | 84 | |
| 85 | - $tree = $reader->parseInnerTree(); |
|
| 86 | - if ($tree === null) { |
|
| 87 | - return null; |
|
| 88 | - } |
|
| 89 | - foreach ($tree as $elem) { |
|
| 90 | - if ($elem['name'] === '{' . self::NS_OWNCLOUD . '}tag') { |
|
| 91 | - $tags[] = $elem['value']; |
|
| 92 | - } |
|
| 93 | - } |
|
| 94 | - return new self($tags); |
|
| 95 | - } |
|
| 85 | + $tree = $reader->parseInnerTree(); |
|
| 86 | + if ($tree === null) { |
|
| 87 | + return null; |
|
| 88 | + } |
|
| 89 | + foreach ($tree as $elem) { |
|
| 90 | + if ($elem['name'] === '{' . self::NS_OWNCLOUD . '}tag') { |
|
| 91 | + $tags[] = $elem['value']; |
|
| 92 | + } |
|
| 93 | + } |
|
| 94 | + return new self($tags); |
|
| 95 | + } |
|
| 96 | 96 | |
| 97 | - /** |
|
| 98 | - * The xmlSerialize method is called during xml writing. |
|
| 99 | - * |
|
| 100 | - * Use the $writer argument to write its own xml serialization. |
|
| 101 | - * |
|
| 102 | - * An important note: do _not_ create a parent element. Any element |
|
| 103 | - * implementing XmlSerializble should only ever write what's considered |
|
| 104 | - * its 'inner xml'. |
|
| 105 | - * |
|
| 106 | - * The parent of the current element is responsible for writing a |
|
| 107 | - * containing element. |
|
| 108 | - * |
|
| 109 | - * This allows serializers to be re-used for different element names. |
|
| 110 | - * |
|
| 111 | - * If you are opening new elements, you must also close them again. |
|
| 112 | - * |
|
| 113 | - * @param Writer $writer |
|
| 114 | - * @return void |
|
| 115 | - */ |
|
| 116 | - public function xmlSerialize(Writer $writer) { |
|
| 117 | - foreach ($this->tags as $tag) { |
|
| 118 | - $writer->writeElement('{' . self::NS_OWNCLOUD . '}tag', $tag); |
|
| 119 | - } |
|
| 120 | - } |
|
| 97 | + /** |
|
| 98 | + * The xmlSerialize method is called during xml writing. |
|
| 99 | + * |
|
| 100 | + * Use the $writer argument to write its own xml serialization. |
|
| 101 | + * |
|
| 102 | + * An important note: do _not_ create a parent element. Any element |
|
| 103 | + * implementing XmlSerializble should only ever write what's considered |
|
| 104 | + * its 'inner xml'. |
|
| 105 | + * |
|
| 106 | + * The parent of the current element is responsible for writing a |
|
| 107 | + * containing element. |
|
| 108 | + * |
|
| 109 | + * This allows serializers to be re-used for different element names. |
|
| 110 | + * |
|
| 111 | + * If you are opening new elements, you must also close them again. |
|
| 112 | + * |
|
| 113 | + * @param Writer $writer |
|
| 114 | + * @return void |
|
| 115 | + */ |
|
| 116 | + public function xmlSerialize(Writer $writer) { |
|
| 117 | + foreach ($this->tags as $tag) { |
|
| 118 | + $writer->writeElement('{' . self::NS_OWNCLOUD . '}tag', $tag); |
|
| 119 | + } |
|
| 120 | + } |
|
| 121 | 121 | } |
@@ -64,7 +64,7 @@ |
||
| 64 | 64 | */ |
| 65 | 65 | public function xmlSerialize(Writer $writer) { |
| 66 | 66 | foreach ($this->checksums as $checksum) { |
| 67 | - $writer->writeElement('{' . self::NS_OWNCLOUD . '}checksum', $checksum); |
|
| 67 | + $writer->writeElement('{'.self::NS_OWNCLOUD.'}checksum', $checksum); |
|
| 68 | 68 | } |
| 69 | 69 | } |
| 70 | 70 | } |
@@ -32,37 +32,37 @@ |
||
| 32 | 32 | * checksum name. |
| 33 | 33 | */ |
| 34 | 34 | class ChecksumList implements XmlSerializable { |
| 35 | - public const NS_OWNCLOUD = 'http://owncloud.org/ns'; |
|
| 35 | + public const NS_OWNCLOUD = 'http://owncloud.org/ns'; |
|
| 36 | 36 | |
| 37 | - /** @var string[] of TYPE:CHECKSUM */ |
|
| 38 | - private array $checksums; |
|
| 37 | + /** @var string[] of TYPE:CHECKSUM */ |
|
| 38 | + private array $checksums; |
|
| 39 | 39 | |
| 40 | - public function __construct(string $checksum) { |
|
| 41 | - $this->checksums = explode(' ', $checksum); |
|
| 42 | - } |
|
| 40 | + public function __construct(string $checksum) { |
|
| 41 | + $this->checksums = explode(' ', $checksum); |
|
| 42 | + } |
|
| 43 | 43 | |
| 44 | - /** |
|
| 45 | - * The xmlSerialize method is called during xml writing. |
|
| 46 | - * |
|
| 47 | - * Use the $writer argument to write its own xml serialization. |
|
| 48 | - * |
|
| 49 | - * An important note: do _not_ create a parent element. Any element |
|
| 50 | - * implementing XmlSerializble should only ever write what's considered |
|
| 51 | - * its 'inner xml'. |
|
| 52 | - * |
|
| 53 | - * The parent of the current element is responsible for writing a |
|
| 54 | - * containing element. |
|
| 55 | - * |
|
| 56 | - * This allows serializers to be re-used for different element names. |
|
| 57 | - * |
|
| 58 | - * If you are opening new elements, you must also close them again. |
|
| 59 | - * |
|
| 60 | - * @param Writer $writer |
|
| 61 | - * @return void |
|
| 62 | - */ |
|
| 63 | - public function xmlSerialize(Writer $writer) { |
|
| 64 | - foreach ($this->checksums as $checksum) { |
|
| 65 | - $writer->writeElement('{' . self::NS_OWNCLOUD . '}checksum', $checksum); |
|
| 66 | - } |
|
| 67 | - } |
|
| 44 | + /** |
|
| 45 | + * The xmlSerialize method is called during xml writing. |
|
| 46 | + * |
|
| 47 | + * Use the $writer argument to write its own xml serialization. |
|
| 48 | + * |
|
| 49 | + * An important note: do _not_ create a parent element. Any element |
|
| 50 | + * implementing XmlSerializble should only ever write what's considered |
|
| 51 | + * its 'inner xml'. |
|
| 52 | + * |
|
| 53 | + * The parent of the current element is responsible for writing a |
|
| 54 | + * containing element. |
|
| 55 | + * |
|
| 56 | + * This allows serializers to be re-used for different element names. |
|
| 57 | + * |
|
| 58 | + * If you are opening new elements, you must also close them again. |
|
| 59 | + * |
|
| 60 | + * @param Writer $writer |
|
| 61 | + * @return void |
|
| 62 | + */ |
|
| 63 | + public function xmlSerialize(Writer $writer) { |
|
| 64 | + foreach ($this->checksums as $checksum) { |
|
| 65 | + $writer->writeElement('{' . self::NS_OWNCLOUD . '}checksum', $checksum); |
|
| 66 | + } |
|
| 67 | + } |
|
| 68 | 68 | } |