Passed
Push — master ( e9075b...2056b7 )
by Roeland
12:55 queued 10s
created
apps/dav/lib/DAV/Sharing/Xml/ShareRequest.php 2 patches
Indentation   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -26,54 +26,54 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -43,8 +43,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
apps/dav/lib/DAV/Sharing/Backend.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -191,13 +191,13 @@  discard block
 block discarded – undo
191 191
 		foreach ($shares as $share) {
192 192
 			$acl[] = [
193 193
 				'privilege' => '{DAV:}read',
194
-				'principal' => $share['{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}principal'],
194
+				'principal' => $share['{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}principal'],
195 195
 				'protected' => true,
196 196
 			];
197 197
 			if (!$share['readOnly']) {
198 198
 				$acl[] = [
199 199
 					'privilege' => '{DAV:}write',
200
-					'principal' => $share['{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}principal'],
200
+					'principal' => $share['{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}principal'],
201 201
 					'protected' => true,
202 202
 				];
203 203
 			} elseif ($this->resourceType === 'calendar') {
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
 				// so users can change the visibility.
206 206
 				$acl[] = [
207 207
 					'privilege' => '{DAV:}write-properties',
208
-					'principal' => $share['{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}principal'],
208
+					'principal' => $share['{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}principal'],
209 209
 					'protected' => true,
210 210
 				];
211 211
 			}
Please login to merge, or discard this patch.
Indentation   +211 added lines, -211 removed lines patch added patch discarded remove patch
@@ -36,215 +36,215 @@
 block discarded – undo
36 36
 
37 37
 class Backend {
38 38
 
39
-	/** @var IDBConnection */
40
-	private $db;
41
-	/** @var IUserManager */
42
-	private $userManager;
43
-	/** @var IGroupManager */
44
-	private $groupManager;
45
-	/** @var Principal */
46
-	private $principalBackend;
47
-	/** @var string */
48
-	private $resourceType;
49
-
50
-	public const ACCESS_OWNER = 1;
51
-	public const ACCESS_READ_WRITE = 2;
52
-	public const ACCESS_READ = 3;
53
-
54
-	/**
55
-	 * @param IDBConnection $db
56
-	 * @param IUserManager $userManager
57
-	 * @param IGroupManager $groupManager
58
-	 * @param Principal $principalBackend
59
-	 * @param string $resourceType
60
-	 */
61
-	public function __construct(IDBConnection $db, IUserManager $userManager, IGroupManager $groupManager, Principal $principalBackend, $resourceType) {
62
-		$this->db = $db;
63
-		$this->userManager = $userManager;
64
-		$this->groupManager = $groupManager;
65
-		$this->principalBackend = $principalBackend;
66
-		$this->resourceType = $resourceType;
67
-	}
68
-
69
-	/**
70
-	 * @param IShareable $shareable
71
-	 * @param string[] $add
72
-	 * @param string[] $remove
73
-	 */
74
-	public function updateShares(IShareable $shareable, array $add, array $remove) {
75
-		foreach ($add as $element) {
76
-			$principal = $this->principalBackend->findByUri($element['href'], '');
77
-			if ($principal !== '') {
78
-				$this->shareWith($shareable, $element);
79
-			}
80
-		}
81
-		foreach ($remove as $element) {
82
-			$principal = $this->principalBackend->findByUri($element, '');
83
-			if ($principal !== '') {
84
-				$this->unshare($shareable, $element);
85
-			}
86
-		}
87
-	}
88
-
89
-	/**
90
-	 * @param IShareable $shareable
91
-	 * @param string $element
92
-	 */
93
-	private function shareWith($shareable, $element) {
94
-		$user = $element['href'];
95
-		$parts = explode(':', $user, 2);
96
-		if ($parts[0] !== 'principal') {
97
-			return;
98
-		}
99
-
100
-		// don't share with owner
101
-		if ($shareable->getOwner() === $parts[1]) {
102
-			return;
103
-		}
104
-
105
-		$principal = explode('/', $parts[1], 3);
106
-		if (count($principal) !== 3 || $principal[0] !== 'principals' || !in_array($principal[1], ['users', 'groups', 'circles'], true)) {
107
-			// Invalid principal
108
-			return;
109
-		}
110
-
111
-		$principal[2] = urldecode($principal[2]);
112
-		if (($principal[1] === 'users' && !$this->userManager->userExists($principal[2])) ||
113
-			($principal[1] === 'groups' && !$this->groupManager->groupExists($principal[2]))) {
114
-			// User or group does not exist
115
-			return;
116
-		}
117
-
118
-		// remove the share if it already exists
119
-		$this->unshare($shareable, $element['href']);
120
-		$access = self::ACCESS_READ;
121
-		if (isset($element['readOnly'])) {
122
-			$access = $element['readOnly'] ? self::ACCESS_READ : self::ACCESS_READ_WRITE;
123
-		}
124
-
125
-		$query = $this->db->getQueryBuilder();
126
-		$query->insert('dav_shares')
127
-			->values([
128
-				'principaluri' => $query->createNamedParameter($parts[1]),
129
-				'type' => $query->createNamedParameter($this->resourceType),
130
-				'access' => $query->createNamedParameter($access),
131
-				'resourceid' => $query->createNamedParameter($shareable->getResourceId())
132
-			]);
133
-		$query->execute();
134
-	}
135
-
136
-	/**
137
-	 * @param $resourceId
138
-	 */
139
-	public function deleteAllShares($resourceId) {
140
-		$query = $this->db->getQueryBuilder();
141
-		$query->delete('dav_shares')
142
-			->where($query->expr()->eq('resourceid', $query->createNamedParameter($resourceId)))
143
-			->andWhere($query->expr()->eq('type', $query->createNamedParameter($this->resourceType)))
144
-			->execute();
145
-	}
146
-
147
-	public function deleteAllSharesByUser($principaluri) {
148
-		$query = $this->db->getQueryBuilder();
149
-		$query->delete('dav_shares')
150
-			->where($query->expr()->eq('principaluri', $query->createNamedParameter($principaluri)))
151
-			->andWhere($query->expr()->eq('type', $query->createNamedParameter($this->resourceType)))
152
-			->execute();
153
-	}
154
-
155
-	/**
156
-	 * @param IShareable $shareable
157
-	 * @param string $element
158
-	 */
159
-	private function unshare($shareable, $element) {
160
-		$parts = explode(':', $element, 2);
161
-		if ($parts[0] !== 'principal') {
162
-			return;
163
-		}
164
-
165
-		// don't share with owner
166
-		if ($shareable->getOwner() === $parts[1]) {
167
-			return;
168
-		}
169
-
170
-		$query = $this->db->getQueryBuilder();
171
-		$query->delete('dav_shares')
172
-			->where($query->expr()->eq('resourceid', $query->createNamedParameter($shareable->getResourceId())))
173
-			->andWhere($query->expr()->eq('type', $query->createNamedParameter($this->resourceType)))
174
-			->andWhere($query->expr()->eq('principaluri', $query->createNamedParameter($parts[1])))
175
-		;
176
-		$query->execute();
177
-	}
178
-
179
-	/**
180
-	 * Returns the list of people whom this resource is shared with.
181
-	 *
182
-	 * Every element in this array should have the following properties:
183
-	 *   * href - Often a mailto: address
184
-	 *   * commonName - Optional, for example a first + last name
185
-	 *   * status - See the Sabre\CalDAV\SharingPlugin::STATUS_ constants.
186
-	 *   * readOnly - boolean
187
-	 *   * summary - Optional, a description for the share
188
-	 *
189
-	 * @param int $resourceId
190
-	 * @return array
191
-	 */
192
-	public function getShares($resourceId) {
193
-		$query = $this->db->getQueryBuilder();
194
-		$result = $query->select(['principaluri', 'access'])
195
-			->from('dav_shares')
196
-			->where($query->expr()->eq('resourceid', $query->createNamedParameter($resourceId)))
197
-			->andWhere($query->expr()->eq('type', $query->createNamedParameter($this->resourceType)))
198
-			->groupBy(['principaluri', 'access'])
199
-			->execute();
200
-
201
-		$shares = [];
202
-		while ($row = $result->fetch()) {
203
-			$p = $this->principalBackend->getPrincipalByPath($row['principaluri']);
204
-			$shares[] = [
205
-				'href' => "principal:${row['principaluri']}",
206
-				'commonName' => isset($p['{DAV:}displayname']) ? $p['{DAV:}displayname'] : '',
207
-				'status' => 1,
208
-				'readOnly' => (int) $row['access'] === self::ACCESS_READ,
209
-				'{http://owncloud.org/ns}principal' => $row['principaluri'],
210
-				'{http://owncloud.org/ns}group-share' => is_null($p)
211
-			];
212
-		}
213
-
214
-		return $shares;
215
-	}
216
-
217
-	/**
218
-	 * For shared resources the sharee is set in the ACL of the resource
219
-	 *
220
-	 * @param int $resourceId
221
-	 * @param array $acl
222
-	 * @return array
223
-	 */
224
-	public function applyShareAcl($resourceId, $acl) {
225
-		$shares = $this->getShares($resourceId);
226
-		foreach ($shares as $share) {
227
-			$acl[] = [
228
-				'privilege' => '{DAV:}read',
229
-				'principal' => $share['{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}principal'],
230
-				'protected' => true,
231
-			];
232
-			if (!$share['readOnly']) {
233
-				$acl[] = [
234
-					'privilege' => '{DAV:}write',
235
-					'principal' => $share['{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}principal'],
236
-					'protected' => true,
237
-				];
238
-			} elseif ($this->resourceType === 'calendar') {
239
-				// Allow changing the properties of read only calendars,
240
-				// so users can change the visibility.
241
-				$acl[] = [
242
-					'privilege' => '{DAV:}write-properties',
243
-					'principal' => $share['{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}principal'],
244
-					'protected' => true,
245
-				];
246
-			}
247
-		}
248
-		return $acl;
249
-	}
39
+    /** @var IDBConnection */
40
+    private $db;
41
+    /** @var IUserManager */
42
+    private $userManager;
43
+    /** @var IGroupManager */
44
+    private $groupManager;
45
+    /** @var Principal */
46
+    private $principalBackend;
47
+    /** @var string */
48
+    private $resourceType;
49
+
50
+    public const ACCESS_OWNER = 1;
51
+    public const ACCESS_READ_WRITE = 2;
52
+    public const ACCESS_READ = 3;
53
+
54
+    /**
55
+     * @param IDBConnection $db
56
+     * @param IUserManager $userManager
57
+     * @param IGroupManager $groupManager
58
+     * @param Principal $principalBackend
59
+     * @param string $resourceType
60
+     */
61
+    public function __construct(IDBConnection $db, IUserManager $userManager, IGroupManager $groupManager, Principal $principalBackend, $resourceType) {
62
+        $this->db = $db;
63
+        $this->userManager = $userManager;
64
+        $this->groupManager = $groupManager;
65
+        $this->principalBackend = $principalBackend;
66
+        $this->resourceType = $resourceType;
67
+    }
68
+
69
+    /**
70
+     * @param IShareable $shareable
71
+     * @param string[] $add
72
+     * @param string[] $remove
73
+     */
74
+    public function updateShares(IShareable $shareable, array $add, array $remove) {
75
+        foreach ($add as $element) {
76
+            $principal = $this->principalBackend->findByUri($element['href'], '');
77
+            if ($principal !== '') {
78
+                $this->shareWith($shareable, $element);
79
+            }
80
+        }
81
+        foreach ($remove as $element) {
82
+            $principal = $this->principalBackend->findByUri($element, '');
83
+            if ($principal !== '') {
84
+                $this->unshare($shareable, $element);
85
+            }
86
+        }
87
+    }
88
+
89
+    /**
90
+     * @param IShareable $shareable
91
+     * @param string $element
92
+     */
93
+    private function shareWith($shareable, $element) {
94
+        $user = $element['href'];
95
+        $parts = explode(':', $user, 2);
96
+        if ($parts[0] !== 'principal') {
97
+            return;
98
+        }
99
+
100
+        // don't share with owner
101
+        if ($shareable->getOwner() === $parts[1]) {
102
+            return;
103
+        }
104
+
105
+        $principal = explode('/', $parts[1], 3);
106
+        if (count($principal) !== 3 || $principal[0] !== 'principals' || !in_array($principal[1], ['users', 'groups', 'circles'], true)) {
107
+            // Invalid principal
108
+            return;
109
+        }
110
+
111
+        $principal[2] = urldecode($principal[2]);
112
+        if (($principal[1] === 'users' && !$this->userManager->userExists($principal[2])) ||
113
+            ($principal[1] === 'groups' && !$this->groupManager->groupExists($principal[2]))) {
114
+            // User or group does not exist
115
+            return;
116
+        }
117
+
118
+        // remove the share if it already exists
119
+        $this->unshare($shareable, $element['href']);
120
+        $access = self::ACCESS_READ;
121
+        if (isset($element['readOnly'])) {
122
+            $access = $element['readOnly'] ? self::ACCESS_READ : self::ACCESS_READ_WRITE;
123
+        }
124
+
125
+        $query = $this->db->getQueryBuilder();
126
+        $query->insert('dav_shares')
127
+            ->values([
128
+                'principaluri' => $query->createNamedParameter($parts[1]),
129
+                'type' => $query->createNamedParameter($this->resourceType),
130
+                'access' => $query->createNamedParameter($access),
131
+                'resourceid' => $query->createNamedParameter($shareable->getResourceId())
132
+            ]);
133
+        $query->execute();
134
+    }
135
+
136
+    /**
137
+     * @param $resourceId
138
+     */
139
+    public function deleteAllShares($resourceId) {
140
+        $query = $this->db->getQueryBuilder();
141
+        $query->delete('dav_shares')
142
+            ->where($query->expr()->eq('resourceid', $query->createNamedParameter($resourceId)))
143
+            ->andWhere($query->expr()->eq('type', $query->createNamedParameter($this->resourceType)))
144
+            ->execute();
145
+    }
146
+
147
+    public function deleteAllSharesByUser($principaluri) {
148
+        $query = $this->db->getQueryBuilder();
149
+        $query->delete('dav_shares')
150
+            ->where($query->expr()->eq('principaluri', $query->createNamedParameter($principaluri)))
151
+            ->andWhere($query->expr()->eq('type', $query->createNamedParameter($this->resourceType)))
152
+            ->execute();
153
+    }
154
+
155
+    /**
156
+     * @param IShareable $shareable
157
+     * @param string $element
158
+     */
159
+    private function unshare($shareable, $element) {
160
+        $parts = explode(':', $element, 2);
161
+        if ($parts[0] !== 'principal') {
162
+            return;
163
+        }
164
+
165
+        // don't share with owner
166
+        if ($shareable->getOwner() === $parts[1]) {
167
+            return;
168
+        }
169
+
170
+        $query = $this->db->getQueryBuilder();
171
+        $query->delete('dav_shares')
172
+            ->where($query->expr()->eq('resourceid', $query->createNamedParameter($shareable->getResourceId())))
173
+            ->andWhere($query->expr()->eq('type', $query->createNamedParameter($this->resourceType)))
174
+            ->andWhere($query->expr()->eq('principaluri', $query->createNamedParameter($parts[1])))
175
+        ;
176
+        $query->execute();
177
+    }
178
+
179
+    /**
180
+     * Returns the list of people whom this resource is shared with.
181
+     *
182
+     * Every element in this array should have the following properties:
183
+     *   * href - Often a mailto: address
184
+     *   * commonName - Optional, for example a first + last name
185
+     *   * status - See the Sabre\CalDAV\SharingPlugin::STATUS_ constants.
186
+     *   * readOnly - boolean
187
+     *   * summary - Optional, a description for the share
188
+     *
189
+     * @param int $resourceId
190
+     * @return array
191
+     */
192
+    public function getShares($resourceId) {
193
+        $query = $this->db->getQueryBuilder();
194
+        $result = $query->select(['principaluri', 'access'])
195
+            ->from('dav_shares')
196
+            ->where($query->expr()->eq('resourceid', $query->createNamedParameter($resourceId)))
197
+            ->andWhere($query->expr()->eq('type', $query->createNamedParameter($this->resourceType)))
198
+            ->groupBy(['principaluri', 'access'])
199
+            ->execute();
200
+
201
+        $shares = [];
202
+        while ($row = $result->fetch()) {
203
+            $p = $this->principalBackend->getPrincipalByPath($row['principaluri']);
204
+            $shares[] = [
205
+                'href' => "principal:${row['principaluri']}",
206
+                'commonName' => isset($p['{DAV:}displayname']) ? $p['{DAV:}displayname'] : '',
207
+                'status' => 1,
208
+                'readOnly' => (int) $row['access'] === self::ACCESS_READ,
209
+                '{http://owncloud.org/ns}principal' => $row['principaluri'],
210
+                '{http://owncloud.org/ns}group-share' => is_null($p)
211
+            ];
212
+        }
213
+
214
+        return $shares;
215
+    }
216
+
217
+    /**
218
+     * For shared resources the sharee is set in the ACL of the resource
219
+     *
220
+     * @param int $resourceId
221
+     * @param array $acl
222
+     * @return array
223
+     */
224
+    public function applyShareAcl($resourceId, $acl) {
225
+        $shares = $this->getShares($resourceId);
226
+        foreach ($shares as $share) {
227
+            $acl[] = [
228
+                'privilege' => '{DAV:}read',
229
+                'principal' => $share['{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}principal'],
230
+                'protected' => true,
231
+            ];
232
+            if (!$share['readOnly']) {
233
+                $acl[] = [
234
+                    'privilege' => '{DAV:}write',
235
+                    'principal' => $share['{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}principal'],
236
+                    'protected' => true,
237
+                ];
238
+            } elseif ($this->resourceType === 'calendar') {
239
+                // Allow changing the properties of read only calendars,
240
+                // so users can change the visibility.
241
+                $acl[] = [
242
+                    'privilege' => '{DAV:}write-properties',
243
+                    'principal' => $share['{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}principal'],
244
+                    'protected' => true,
245
+                ];
246
+            }
247
+        }
248
+        return $acl;
249
+    }
250 250
 }
Please login to merge, or discard this patch.
apps/dav/lib/Connector/Sabre/BearerAuth.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@
 block discarded – undo
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
 	/**
Please login to merge, or discard this patch.
Indentation   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -31,66 +31,66 @@
 block discarded – undo
31 31
 use Sabre\HTTP\ResponseInterface;
32 32
 
33 33
 class BearerAuth extends AbstractBearer {
34
-	/** @var IUserSession */
35
-	private $userSession;
36
-	/** @var ISession */
37
-	private $session;
38
-	/** @var IRequest */
39
-	private $request;
40
-	/** @var string */
41
-	private $principalPrefix;
34
+    /** @var IUserSession */
35
+    private $userSession;
36
+    /** @var ISession */
37
+    private $session;
38
+    /** @var IRequest */
39
+    private $request;
40
+    /** @var string */
41
+    private $principalPrefix;
42 42
 
43
-	/**
44
-	 * @param IUserSession $userSession
45
-	 * @param ISession $session
46
-	 * @param string $principalPrefix
47
-	 * @param IRequest $request
48
-	 */
49
-	public function __construct(IUserSession $userSession,
50
-								ISession $session,
51
-								IRequest $request,
52
-								$principalPrefix = 'principals/users/') {
53
-		$this->userSession = $userSession;
54
-		$this->session = $session;
55
-		$this->request = $request;
56
-		$this->principalPrefix = $principalPrefix;
43
+    /**
44
+     * @param IUserSession $userSession
45
+     * @param ISession $session
46
+     * @param string $principalPrefix
47
+     * @param IRequest $request
48
+     */
49
+    public function __construct(IUserSession $userSession,
50
+                                ISession $session,
51
+                                IRequest $request,
52
+                                $principalPrefix = 'principals/users/') {
53
+        $this->userSession = $userSession;
54
+        $this->session = $session;
55
+        $this->request = $request;
56
+        $this->principalPrefix = $principalPrefix;
57 57
 
58
-		// setup realm
59
-		$defaults = new \OCP\Defaults();
60
-		$this->realm = $defaults->getName();
61
-	}
58
+        // setup realm
59
+        $defaults = new \OCP\Defaults();
60
+        $this->realm = $defaults->getName();
61
+    }
62 62
 
63
-	private function setupUserFs($userId) {
64
-		\OC_Util::setupFS($userId);
65
-		$this->session->close();
66
-		return $this->principalPrefix . $userId;
67
-	}
63
+    private function setupUserFs($userId) {
64
+        \OC_Util::setupFS($userId);
65
+        $this->session->close();
66
+        return $this->principalPrefix . $userId;
67
+    }
68 68
 
69
-	/**
70
-	 * {@inheritdoc}
71
-	 */
72
-	public function validateBearerToken($bearerToken) {
73
-		\OC_Util::setupFS();
69
+    /**
70
+     * {@inheritdoc}
71
+     */
72
+    public function validateBearerToken($bearerToken) {
73
+        \OC_Util::setupFS();
74 74
 
75
-		if (!$this->userSession->isLoggedIn()) {
76
-			$this->userSession->tryTokenLogin($this->request);
77
-		}
78
-		if ($this->userSession->isLoggedIn()) {
79
-			return $this->setupUserFs($this->userSession->getUser()->getUID());
80
-		}
75
+        if (!$this->userSession->isLoggedIn()) {
76
+            $this->userSession->tryTokenLogin($this->request);
77
+        }
78
+        if ($this->userSession->isLoggedIn()) {
79
+            return $this->setupUserFs($this->userSession->getUser()->getUID());
80
+        }
81 81
 
82
-		return false;
83
-	}
82
+        return false;
83
+    }
84 84
 
85
-	/**
86
-	 * \Sabre\DAV\Auth\Backend\AbstractBearer::challenge sets an WWW-Authenticate
87
-	 * header which some DAV clients can't handle. Thus we override this function
88
-	 * and make it simply return a 401.
89
-	 *
90
-	 * @param RequestInterface $request
91
-	 * @param ResponseInterface $response
92
-	 */
93
-	public function challenge(RequestInterface $request, ResponseInterface $response) {
94
-		$response->setStatus(401);
95
-	}
85
+    /**
86
+     * \Sabre\DAV\Auth\Backend\AbstractBearer::challenge sets an WWW-Authenticate
87
+     * header which some DAV clients can't handle. Thus we override this function
88
+     * and make it simply return a 401.
89
+     *
90
+     * @param RequestInterface $request
91
+     * @param ResponseInterface $response
92
+     */
93
+    public function challenge(RequestInterface $request, ResponseInterface $response) {
94
+        $response->setStatus(401);
95
+    }
96 96
 }
Please login to merge, or discard this patch.
apps/dav/lib/Connector/Sabre/Exception/FileLocked.php 1 patch
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -29,19 +29,19 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
apps/dav/lib/Connector/Sabre/Exception/UnsupportedMediaType.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -31,12 +31,12 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
apps/dav/lib/Connector/Sabre/Exception/EntityTooLarge.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -31,12 +31,12 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
apps/dav/lib/Connector/Sabre/TagList.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
Indentation   +79 added lines, -79 removed lines patch added patch discarded remove patch
@@ -34,89 +34,89 @@
 block discarded – undo
34 34
  * This property contains multiple "tag" elements, each containing a tag name.
35 35
  */
36 36
 class TagList implements Element {
37
-	public const NS_OWNCLOUD = 'http://owncloud.org/ns';
37
+    public const NS_OWNCLOUD = 'http://owncloud.org/ns';
38 38
 
39
-	/**
40
-	 * tags
41
-	 *
42
-	 * @var array
43
-	 */
44
-	private $tags;
39
+    /**
40
+     * tags
41
+     *
42
+     * @var array
43
+     */
44
+    private $tags;
45 45
 
46
-	/**
47
-	 * @param array $tags
48
-	 */
49
-	public function __construct(array $tags) {
50
-		$this->tags = $tags;
51
-	}
46
+    /**
47
+     * @param array $tags
48
+     */
49
+    public function __construct(array $tags) {
50
+        $this->tags = $tags;
51
+    }
52 52
 
53
-	/**
54
-	 * Returns the tags
55
-	 *
56
-	 * @return array
57
-	 */
58
-	public function getTags() {
59
-		return $this->tags;
60
-	}
53
+    /**
54
+     * Returns the tags
55
+     *
56
+     * @return array
57
+     */
58
+    public function getTags() {
59
+        return $this->tags;
60
+    }
61 61
 
62
-	/**
63
-	 * The deserialize method is called during xml parsing.
64
-	 *
65
-	 * This method is called statictly, this is because in theory this method
66
-	 * may be used as a type of constructor, or factory method.
67
-	 *
68
-	 * Often you want to return an instance of the current class, but you are
69
-	 * free to return other data as well.
70
-	 *
71
-	 * You are responsible for advancing the reader to the next element. Not
72
-	 * doing anything will result in a never-ending loop.
73
-	 *
74
-	 * If you just want to skip parsing for this element altogether, you can
75
-	 * just call $reader->next();
76
-	 *
77
-	 * $reader->parseInnerTree() will parse the entire sub-tree, and advance to
78
-	 * the next element.
79
-	 *
80
-	 * @param Reader $reader
81
-	 * @return mixed
82
-	 */
83
-	public static function xmlDeserialize(Reader $reader) {
84
-		$tags = [];
62
+    /**
63
+     * The deserialize method is called during xml parsing.
64
+     *
65
+     * This method is called statictly, this is because in theory this method
66
+     * may be used as a type of constructor, or factory method.
67
+     *
68
+     * Often you want to return an instance of the current class, but you are
69
+     * free to return other data as well.
70
+     *
71
+     * You are responsible for advancing the reader to the next element. Not
72
+     * doing anything will result in a never-ending loop.
73
+     *
74
+     * If you just want to skip parsing for this element altogether, you can
75
+     * just call $reader->next();
76
+     *
77
+     * $reader->parseInnerTree() will parse the entire sub-tree, and advance to
78
+     * the next element.
79
+     *
80
+     * @param Reader $reader
81
+     * @return mixed
82
+     */
83
+    public static function xmlDeserialize(Reader $reader) {
84
+        $tags = [];
85 85
 
86
-		$tree = $reader->parseInnerTree();
87
-		if ($tree === null) {
88
-			return null;
89
-		}
90
-		foreach ($tree as $elem) {
91
-			if ($elem['name'] === '{' . self::NS_OWNCLOUD . '}tag') {
92
-				$tags[] = $elem['value'];
93
-			}
94
-		}
95
-		return new self($tags);
96
-	}
86
+        $tree = $reader->parseInnerTree();
87
+        if ($tree === null) {
88
+            return null;
89
+        }
90
+        foreach ($tree as $elem) {
91
+            if ($elem['name'] === '{' . self::NS_OWNCLOUD . '}tag') {
92
+                $tags[] = $elem['value'];
93
+            }
94
+        }
95
+        return new self($tags);
96
+    }
97 97
 
98
-	/**
99
-	 * The xmlSerialize metod is called during xml writing.
100
-	 *
101
-	 * Use the $writer argument to write its own xml serialization.
102
-	 *
103
-	 * An important note: do _not_ create a parent element. Any element
104
-	 * implementing XmlSerializble should only ever write what's considered
105
-	 * its 'inner xml'.
106
-	 *
107
-	 * The parent of the current element is responsible for writing a
108
-	 * containing element.
109
-	 *
110
-	 * This allows serializers to be re-used for different element names.
111
-	 *
112
-	 * If you are opening new elements, you must also close them again.
113
-	 *
114
-	 * @param Writer $writer
115
-	 * @return void
116
-	 */
117
-	public function xmlSerialize(Writer $writer) {
118
-		foreach ($this->tags as $tag) {
119
-			$writer->writeElement('{' . self::NS_OWNCLOUD . '}tag', $tag);
120
-		}
121
-	}
98
+    /**
99
+     * The xmlSerialize metod is called during xml writing.
100
+     *
101
+     * Use the $writer argument to write its own xml serialization.
102
+     *
103
+     * An important note: do _not_ create a parent element. Any element
104
+     * implementing XmlSerializble should only ever write what's considered
105
+     * its 'inner xml'.
106
+     *
107
+     * The parent of the current element is responsible for writing a
108
+     * containing element.
109
+     *
110
+     * This allows serializers to be re-used for different element names.
111
+     *
112
+     * If you are opening new elements, you must also close them again.
113
+     *
114
+     * @param Writer $writer
115
+     * @return void
116
+     */
117
+    public function xmlSerialize(Writer $writer) {
118
+        foreach ($this->tags as $tag) {
119
+            $writer->writeElement('{' . self::NS_OWNCLOUD . '}tag', $tag);
120
+        }
121
+    }
122 122
 }
Please login to merge, or discard this patch.
apps/dav/lib/Connector/Sabre/FakeLockerPlugin.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -87,10 +87,10 @@
 block discarded – undo
87 87
 	 * @return void
88 88
 	 */
89 89
 	public function propFind(PropFind $propFind, INode $node) {
90
-		$propFind->handle('{DAV:}supportedlock', function () {
90
+		$propFind->handle('{DAV:}supportedlock', function() {
91 91
 			return new SupportedLock(true);
92 92
 		});
93
-		$propFind->handle('{DAV:}lockdiscovery', function () use ($propFind) {
93
+		$propFind->handle('{DAV:}lockdiscovery', function() use ($propFind) {
94 94
 			return new LockDiscovery([]);
95 95
 		});
96 96
 	}
Please login to merge, or discard this patch.
Indentation   +99 added lines, -99 removed lines patch added patch discarded remove patch
@@ -47,113 +47,113 @@
 block discarded – undo
47 47
  * @package OCA\DAV\Connector\Sabre
48 48
  */
49 49
 class FakeLockerPlugin extends ServerPlugin {
50
-	/** @var \Sabre\DAV\Server */
51
-	private $server;
50
+    /** @var \Sabre\DAV\Server */
51
+    private $server;
52 52
 
53
-	/** {@inheritDoc} */
54
-	public function initialize(\Sabre\DAV\Server $server) {
55
-		$this->server = $server;
56
-		$this->server->on('method:LOCK', [$this, 'fakeLockProvider'], 1);
57
-		$this->server->on('method:UNLOCK', [$this, 'fakeUnlockProvider'], 1);
58
-		$server->on('propFind', [$this, 'propFind']);
59
-		$server->on('validateTokens', [$this, 'validateTokens']);
60
-	}
53
+    /** {@inheritDoc} */
54
+    public function initialize(\Sabre\DAV\Server $server) {
55
+        $this->server = $server;
56
+        $this->server->on('method:LOCK', [$this, 'fakeLockProvider'], 1);
57
+        $this->server->on('method:UNLOCK', [$this, 'fakeUnlockProvider'], 1);
58
+        $server->on('propFind', [$this, 'propFind']);
59
+        $server->on('validateTokens', [$this, 'validateTokens']);
60
+    }
61 61
 
62
-	/**
63
-	 * Indicate that we support LOCK and UNLOCK
64
-	 *
65
-	 * @param string $path
66
-	 * @return string[]
67
-	 */
68
-	public function getHTTPMethods($path) {
69
-		return [
70
-			'LOCK',
71
-			'UNLOCK',
72
-		];
73
-	}
62
+    /**
63
+     * Indicate that we support LOCK and UNLOCK
64
+     *
65
+     * @param string $path
66
+     * @return string[]
67
+     */
68
+    public function getHTTPMethods($path) {
69
+        return [
70
+            'LOCK',
71
+            'UNLOCK',
72
+        ];
73
+    }
74 74
 
75
-	/**
76
-	 * Indicate that we support locking
77
-	 *
78
-	 * @return integer[]
79
-	 */
80
-	public function getFeatures() {
81
-		return [2];
82
-	}
75
+    /**
76
+     * Indicate that we support locking
77
+     *
78
+     * @return integer[]
79
+     */
80
+    public function getFeatures() {
81
+        return [2];
82
+    }
83 83
 
84
-	/**
85
-	 * Return some dummy response for PROPFIND requests with regard to locking
86
-	 *
87
-	 * @param PropFind $propFind
88
-	 * @param INode $node
89
-	 * @return void
90
-	 */
91
-	public function propFind(PropFind $propFind, INode $node) {
92
-		$propFind->handle('{DAV:}supportedlock', function () {
93
-			return new SupportedLock(true);
94
-		});
95
-		$propFind->handle('{DAV:}lockdiscovery', function () use ($propFind) {
96
-			return new LockDiscovery([]);
97
-		});
98
-	}
84
+    /**
85
+     * Return some dummy response for PROPFIND requests with regard to locking
86
+     *
87
+     * @param PropFind $propFind
88
+     * @param INode $node
89
+     * @return void
90
+     */
91
+    public function propFind(PropFind $propFind, INode $node) {
92
+        $propFind->handle('{DAV:}supportedlock', function () {
93
+            return new SupportedLock(true);
94
+        });
95
+        $propFind->handle('{DAV:}lockdiscovery', function () use ($propFind) {
96
+            return new LockDiscovery([]);
97
+        });
98
+    }
99 99
 
100
-	/**
101
-	 * Mark a locking token always as valid
102
-	 *
103
-	 * @param RequestInterface $request
104
-	 * @param array $conditions
105
-	 */
106
-	public function validateTokens(RequestInterface $request, &$conditions) {
107
-		foreach ($conditions as &$fileCondition) {
108
-			if (isset($fileCondition['tokens'])) {
109
-				foreach ($fileCondition['tokens'] as &$token) {
110
-					if (isset($token['token'])) {
111
-						if (substr($token['token'], 0, 16) === 'opaquelocktoken:') {
112
-							$token['validToken'] = true;
113
-						}
114
-					}
115
-				}
116
-			}
117
-		}
118
-	}
100
+    /**
101
+     * Mark a locking token always as valid
102
+     *
103
+     * @param RequestInterface $request
104
+     * @param array $conditions
105
+     */
106
+    public function validateTokens(RequestInterface $request, &$conditions) {
107
+        foreach ($conditions as &$fileCondition) {
108
+            if (isset($fileCondition['tokens'])) {
109
+                foreach ($fileCondition['tokens'] as &$token) {
110
+                    if (isset($token['token'])) {
111
+                        if (substr($token['token'], 0, 16) === 'opaquelocktoken:') {
112
+                            $token['validToken'] = true;
113
+                        }
114
+                    }
115
+                }
116
+            }
117
+        }
118
+    }
119 119
 
120
-	/**
121
-	 * Fakes a successful LOCK
122
-	 *
123
-	 * @param RequestInterface $request
124
-	 * @param ResponseInterface $response
125
-	 * @return bool
126
-	 */
127
-	public function fakeLockProvider(RequestInterface $request,
128
-									 ResponseInterface $response) {
129
-		$lockInfo = new LockInfo();
130
-		$lockInfo->token = md5($request->getPath());
131
-		$lockInfo->uri = $request->getPath();
132
-		$lockInfo->depth = \Sabre\DAV\Server::DEPTH_INFINITY;
133
-		$lockInfo->timeout = 1800;
120
+    /**
121
+     * Fakes a successful LOCK
122
+     *
123
+     * @param RequestInterface $request
124
+     * @param ResponseInterface $response
125
+     * @return bool
126
+     */
127
+    public function fakeLockProvider(RequestInterface $request,
128
+                                        ResponseInterface $response) {
129
+        $lockInfo = new LockInfo();
130
+        $lockInfo->token = md5($request->getPath());
131
+        $lockInfo->uri = $request->getPath();
132
+        $lockInfo->depth = \Sabre\DAV\Server::DEPTH_INFINITY;
133
+        $lockInfo->timeout = 1800;
134 134
 
135
-		$body = $this->server->xml->write('{DAV:}prop', [
136
-			'{DAV:}lockdiscovery' =>
137
-					new LockDiscovery([$lockInfo])
138
-		]);
135
+        $body = $this->server->xml->write('{DAV:}prop', [
136
+            '{DAV:}lockdiscovery' =>
137
+                    new LockDiscovery([$lockInfo])
138
+        ]);
139 139
 
140
-		$response->setStatus(200);
141
-		$response->setBody($body);
140
+        $response->setStatus(200);
141
+        $response->setBody($body);
142 142
 
143
-		return false;
144
-	}
143
+        return false;
144
+    }
145 145
 
146
-	/**
147
-	 * Fakes a successful LOCK
148
-	 *
149
-	 * @param RequestInterface $request
150
-	 * @param ResponseInterface $response
151
-	 * @return bool
152
-	 */
153
-	public function fakeUnlockProvider(RequestInterface $request,
154
-									 ResponseInterface $response) {
155
-		$response->setStatus(204);
156
-		$response->setHeader('Content-Length', '0');
157
-		return false;
158
-	}
146
+    /**
147
+     * Fakes a successful LOCK
148
+     *
149
+     * @param RequestInterface $request
150
+     * @param ResponseInterface $response
151
+     * @return bool
152
+     */
153
+    public function fakeUnlockProvider(RequestInterface $request,
154
+                                        ResponseInterface $response) {
155
+        $response->setStatus(204);
156
+        $response->setHeader('Content-Length', '0');
157
+        return false;
158
+    }
159 159
 }
Please login to merge, or discard this patch.
apps/dav/lib/Connector/Sabre/ChecksumList.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -32,40 +32,40 @@
 block discarded – undo
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 $checksums;
37
+    /** @var string[] of TYPE:CHECKSUM */
38
+    private $checksums;
39 39
 
40
-	/**
41
-	 * @param string $checksum
42
-	 */
43
-	public function __construct($checksum) {
44
-		$this->checksums = explode(',', $checksum);
45
-	}
40
+    /**
41
+     * @param string $checksum
42
+     */
43
+    public function __construct($checksum) {
44
+        $this->checksums = explode(',', $checksum);
45
+    }
46 46
 
47
-	/**
48
-	 * The xmlSerialize metod is called during xml writing.
49
-	 *
50
-	 * Use the $writer argument to write its own xml serialization.
51
-	 *
52
-	 * An important note: do _not_ create a parent element. Any element
53
-	 * implementing XmlSerializble should only ever write what's considered
54
-	 * its 'inner xml'.
55
-	 *
56
-	 * The parent of the current element is responsible for writing a
57
-	 * containing element.
58
-	 *
59
-	 * This allows serializers to be re-used for different element names.
60
-	 *
61
-	 * If you are opening new elements, you must also close them again.
62
-	 *
63
-	 * @param Writer $writer
64
-	 * @return void
65
-	 */
66
-	public function xmlSerialize(Writer $writer) {
67
-		foreach ($this->checksums as $checksum) {
68
-			$writer->writeElement('{' . self::NS_OWNCLOUD . '}checksum', $checksum);
69
-		}
70
-	}
47
+    /**
48
+     * The xmlSerialize metod is called during xml writing.
49
+     *
50
+     * Use the $writer argument to write its own xml serialization.
51
+     *
52
+     * An important note: do _not_ create a parent element. Any element
53
+     * implementing XmlSerializble should only ever write what's considered
54
+     * its 'inner xml'.
55
+     *
56
+     * The parent of the current element is responsible for writing a
57
+     * containing element.
58
+     *
59
+     * This allows serializers to be re-used for different element names.
60
+     *
61
+     * If you are opening new elements, you must also close them again.
62
+     *
63
+     * @param Writer $writer
64
+     * @return void
65
+     */
66
+    public function xmlSerialize(Writer $writer) {
67
+        foreach ($this->checksums as $checksum) {
68
+            $writer->writeElement('{' . self::NS_OWNCLOUD . '}checksum', $checksum);
69
+        }
70
+    }
71 71
 }
Please login to merge, or discard this patch.