Skip to content

Commit 52989a6

Browse files
committed
Fix for #553
1 parent 19e3d10 commit 52989a6

File tree

2 files changed

+24
-10
lines changed

2 files changed

+24
-10
lines changed

api.php

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4586,6 +4586,18 @@ private function setBoudingBoxFilter(string $geometryColumnName, array &$params)
45864586
}
45874587
$params['filter'][] = "$geometryColumnName,sin,POLYGON(($c[0] $c[1],$c[2] $c[1],$c[2] $c[3],$c[0] $c[3],$c[0] $c[1]))";
45884588
}
4589+
/*
4590+
$tile = isset($params['tile']) ? $params['tile'][0] : '';
4591+
if ($tile) {
4592+
4593+
$n = pow(2, $zoom);
4594+
$lon_deg = $xtile / $n * 360.0 - 180.0;
4595+
$lat_deg = rad2deg(atan(sinh(pi() * (1 - 2 * $ytile / $n))));
4596+
4597+
calculates upperleft corner
4598+
4599+
$params['filter'][] = "$geometryColumnName,sin,POLYGON(($c[0] $c[1],$c[2] $c[1],$c[2] $c[3],$c[0] $c[3],$c[0] $c[1]))";
4600+
}*/
45894601
}
45904602

45914603
private function convertRecordToFeature( /*object*/$record, string $geometryColumnName)
@@ -4917,14 +4929,15 @@ private function handleTable(string $operation, string $tableName) /*: void*/
49174929
if (!$this->reflection->hasTable($tableName)) {
49184930
return;
49194931
}
4932+
$allowed = true;
49204933
$tableHandler = $this->getProperty('tableHandler', '');
49214934
if ($tableHandler) {
49224935
$allowed = call_user_func($tableHandler, $operation, $tableName);
4923-
if (!$allowed) {
4924-
$this->reflection->removeTable($tableName);
4925-
} else {
4926-
$this->handleColumns($operation, $tableName);
4927-
}
4936+
}
4937+
if (!$allowed) {
4938+
$this->reflection->removeTable($tableName);
4939+
} else {
4940+
$this->handleColumns($operation, $tableName);
49284941
}
49294942
}
49304943

src/Tqdev/PhpCrudApi/Middleware/AuthorizationMiddleware.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,15 @@ private function handleTable(string $operation, string $tableName) /*: void*/
4141
if (!$this->reflection->hasTable($tableName)) {
4242
return;
4343
}
44+
$allowed = true;
4445
$tableHandler = $this->getProperty('tableHandler', '');
4546
if ($tableHandler) {
4647
$allowed = call_user_func($tableHandler, $operation, $tableName);
47-
if (!$allowed) {
48-
$this->reflection->removeTable($tableName);
49-
} else {
50-
$this->handleColumns($operation, $tableName);
51-
}
48+
}
49+
if (!$allowed) {
50+
$this->reflection->removeTable($tableName);
51+
} else {
52+
$this->handleColumns($operation, $tableName);
5253
}
5354
}
5455

0 commit comments

Comments
 (0)