Maurits van der Schee 5 years ago
parent
commit
52989a66f6
2 changed files with 24 additions and 10 deletions
  1. 18
    5
      api.php
  2. 6
    5
      src/Tqdev/PhpCrudApi/Middleware/AuthorizationMiddleware.php

+ 18
- 5
api.php View File

@@ -4586,6 +4586,18 @@ class GeoJsonService
4586 4586
             }
4587 4587
             $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]))";
4588 4588
         }
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
+        }*/
4589 4601
     }
4590 4602
 
4591 4603
     private function convertRecordToFeature( /*object*/$record, string $geometryColumnName)
@@ -4917,14 +4929,15 @@ class AuthorizationMiddleware extends Middleware
4917 4929
         if (!$this->reflection->hasTable($tableName)) {
4918 4930
             return;
4919 4931
         }
4932
+        $allowed = true;
4920 4933
         $tableHandler = $this->getProperty('tableHandler', '');
4921 4934
         if ($tableHandler) {
4922 4935
             $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);
4928 4941
         }
4929 4942
     }
4930 4943
 

+ 6
- 5
src/Tqdev/PhpCrudApi/Middleware/AuthorizationMiddleware.php View File

@@ -41,14 +41,15 @@ class AuthorizationMiddleware extends Middleware
41 41
         if (!$this->reflection->hasTable($tableName)) {
42 42
             return;
43 43
         }
44
+        $allowed = true;
44 45
         $tableHandler = $this->getProperty('tableHandler', '');
45 46
         if ($tableHandler) {
46 47
             $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);
52 53
         }
53 54
     }
54 55
 

Loading…
Cancel
Save