@@ -41,9 +41,9 @@ discard block |
||
41 | 41 | $schema = $schemaClosure(); |
42 | 42 | |
43 | 43 | $types = ['resources', 'rooms']; |
44 | - foreach($types as $type) { |
|
45 | - if (!$schema->hasTable('calendar_' . $type)) { |
|
46 | - $table = $schema->createTable('calendar_' . $type); |
|
44 | + foreach ($types as $type) { |
|
45 | + if (!$schema->hasTable('calendar_'.$type)) { |
|
46 | + $table = $schema->createTable('calendar_'.$type); |
|
47 | 47 | |
48 | 48 | $table->addColumn('id', Type::BIGINT, [ |
49 | 49 | 'autoincrement' => true, |
@@ -73,9 +73,9 @@ discard block |
||
73 | 73 | ]); |
74 | 74 | |
75 | 75 | $table->setPrimaryKey(['id']); |
76 | - $table->addIndex(['backend_id', 'resource_id'], 'calendar_' . $type . '_bkdrsc'); |
|
77 | - $table->addIndex(['email'], 'calendar_' . $type . '_email'); |
|
78 | - $table->addIndex(['displayname'], 'calendar_' . $type . '_name'); |
|
76 | + $table->addIndex(['backend_id', 'resource_id'], 'calendar_'.$type.'_bkdrsc'); |
|
77 | + $table->addIndex(['email'], 'calendar_'.$type.'_email'); |
|
78 | + $table->addIndex(['displayname'], 'calendar_'.$type.'_name'); |
|
79 | 79 | } |
80 | 80 | } |
81 | 81 |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | $this->groupManager = $groupManager; |
69 | 69 | $this->logger = $logger; |
70 | 70 | $this->principalPrefix = $principalPrefix; |
71 | - $this->dbTableName = 'calendar_' . $dbPrefix; |
|
71 | + $this->dbTableName = 'calendar_'.$dbPrefix; |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | /** |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | ->from($this->dbTableName); |
94 | 94 | $stmt = $query->execute(); |
95 | 95 | |
96 | - while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
96 | + while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
97 | 97 | $principals[] = $this->rowToPrincipal($row); |
98 | 98 | } |
99 | 99 | |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | } |
118 | 118 | list(, $name) = \Sabre\Uri\split($path); |
119 | 119 | |
120 | - list($backendId, $resourceId) = explode('-', $name, 2); |
|
120 | + list($backendId, $resourceId) = explode('-', $name, 2); |
|
121 | 121 | |
122 | 122 | $query = $this->db->getQueryBuilder(); |
123 | 123 | $query->select(['id', 'backend_id', 'resource_id', 'email', 'displayname']) |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | $stmt = $query->execute(); |
128 | 128 | $row = $stmt->fetch(\PDO::FETCH_ASSOC); |
129 | 129 | |
130 | - if(!$row) { |
|
130 | + if (!$row) { |
|
131 | 131 | return null; |
132 | 132 | } |
133 | 133 | |
@@ -203,11 +203,11 @@ discard block |
||
203 | 203 | $query = $this->db->getQueryBuilder(); |
204 | 204 | $query->select(['id', 'backend_id', 'resource_id', 'email', 'displayname', 'group_restrictions']) |
205 | 205 | ->from($this->dbTableName) |
206 | - ->where($query->expr()->iLike('email', $query->createNamedParameter('%' . $this->db->escapeLikeParameter($value) . '%'))); |
|
206 | + ->where($query->expr()->iLike('email', $query->createNamedParameter('%'.$this->db->escapeLikeParameter($value).'%'))); |
|
207 | 207 | |
208 | 208 | $stmt = $query->execute(); |
209 | 209 | $principals = []; |
210 | - while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
210 | + while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
211 | 211 | if (!$this->isAllowedToAccessResource($row, $usersGroups)) { |
212 | 212 | continue; |
213 | 213 | } |
@@ -222,11 +222,11 @@ discard block |
||
222 | 222 | $query = $this->db->getQueryBuilder(); |
223 | 223 | $query->select(['id', 'backend_id', 'resource_id', 'email', 'displayname', 'group_restrictions']) |
224 | 224 | ->from($this->dbTableName) |
225 | - ->where($query->expr()->iLike('displayname', $query->createNamedParameter('%' . $this->db->escapeLikeParameter($value) . '%'))); |
|
225 | + ->where($query->expr()->iLike('displayname', $query->createNamedParameter('%'.$this->db->escapeLikeParameter($value).'%'))); |
|
226 | 226 | |
227 | 227 | $stmt = $query->execute(); |
228 | 228 | $principals = []; |
229 | - while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
229 | + while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
230 | 230 | if (!$this->isAllowedToAccessResource($row, $usersGroups)) { |
231 | 231 | continue; |
232 | 232 | } |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | $stmt = $query->execute(); |
282 | 282 | $row = $stmt->fetch(\PDO::FETCH_ASSOC); |
283 | 283 | |
284 | - if(!$row) { |
|
284 | + if (!$row) { |
|
285 | 285 | return null; |
286 | 286 | } |
287 | 287 | if (!$this->isAllowedToAccessResource($row, $usersGroups)) { |
@@ -298,7 +298,7 @@ discard block |
||
298 | 298 | } |
299 | 299 | |
300 | 300 | list(, $name) = \Sabre\Uri\split($path); |
301 | - list($backendId, $resourceId) = explode('-', $name, 2); |
|
301 | + list($backendId, $resourceId) = explode('-', $name, 2); |
|
302 | 302 | |
303 | 303 | $query = $this->db->getQueryBuilder(); |
304 | 304 | $query->select(['id', 'backend_id', 'resource_id', 'email', 'displayname', 'group_restrictions']) |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | $stmt = $query->execute(); |
309 | 309 | $row = $stmt->fetch(\PDO::FETCH_ASSOC); |
310 | 310 | |
311 | - if(!$row) { |
|
311 | + if (!$row) { |
|
312 | 312 | return null; |
313 | 313 | } |
314 | 314 | if (!$this->isAllowedToAccessResource($row, $usersGroups)) { |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | */ |
327 | 327 | private function rowToPrincipal($row) { |
328 | 328 | return [ |
329 | - 'uri' => $this->principalPrefix . '/' . $row['backend_id'] . '-' . $row['resource_id'], |
|
329 | + 'uri' => $this->principalPrefix.'/'.$row['backend_id'].'-'.$row['resource_id'], |
|
330 | 330 | '{DAV:}displayname' => $row['displayname'], |
331 | 331 | '{http://sabredav.org/ns}email-address' => $row['email'] |
332 | 332 | ]; |
@@ -347,7 +347,7 @@ discard block |
||
347 | 347 | // group restrictions contains something, but not parsable, deny access and log warning |
348 | 348 | $json = json_decode($row['group_restrictions']); |
349 | 349 | if (!\is_array($json)) { |
350 | - $this->logger->info('group_restrictions field could not be parsed for ' . $this->dbTableName . '::' . $row['id'] . ', denying access to resource'); |
|
350 | + $this->logger->info('group_restrictions field could not be parsed for '.$this->dbTableName.'::'.$row['id'].', denying access to resource'); |
|
351 | 351 | return false; |
352 | 352 | } |
353 | 353 |