diff --git a/app/resto/core/RestoUser.php b/app/resto/core/RestoUser.php index 64dbae7c..0e8edb81 100755 --- a/app/resto/core/RestoUser.php +++ b/app/resto/core/RestoUser.php @@ -320,10 +320,10 @@ public function hasRightsTo($action, $params = array()) // Only owner of feature can do this case RestoUser::DELETE_FEATURE: case RestoUser::UPDATE_FEATURE: - if ( !isset($feature) ) { + if ( !isset($params['feature']) ) { return false; } - $featureArray = $feature->toArray(); + $featureArray = $params['feature']->toArray(); return $rights[$action] && isset($featureArray['properties']['owner']) && $featureArray['properties']['owner'] !== $this->profile['id']; default: diff --git a/app/resto/core/addons/STACCatalog.php b/app/resto/core/addons/STACCatalog.php index 7834a80e..f4c93928 100644 --- a/app/resto/core/addons/STACCatalog.php +++ b/app/resto/core/addons/STACCatalog.php @@ -133,7 +133,7 @@ public function addCatalog($params, $body) * Update catalog as a facet entry * * @OA\Put( - * path="/catalogs/{catalogId}", + * path="/catalogs/catalogs/{catalogId}", * summary="Update catalog", * description="Update catalog as a facet entry", * tags={"STAC"}, @@ -231,7 +231,7 @@ public function updateCatalog($params, $body) * Delete catalog as a facet entry * * @OA\Delete( - * path="/catalogs/{catalogId}", + * path="/catalogs/catalogs/{catalogId}", * summary="Delete catalog", * description="Delete catalog as a facet entry - update feature keywords accordingly", * tags={"STAC"}, @@ -368,12 +368,12 @@ private function storeCatalogAsFacet($catalog, $parentId) $catalog['id'] = substr($catalog['id'], strlen($this->prefix)); } - $parentId = isset($parentId) ? (str_starts_with($parentId, $this->prefix) ? $parentId : $this->prefix . $parentId) : null; + $parentId = isset($parentId) ? (str_starts_with($parentId, $this->prefix) ? $parentId : $this->prefix . $parentId) : 'root'; /* * Catalog already exist */ - if ( $this->catalogExists($this->prefix . $catalog['id'], $parentId ?? 'root', '*') ) { + if ( $this->catalogExists($this->prefix . $catalog['id'], $parentId, '*') ) { return RestoLogUtil::httpError(409, 'Catalog ' . $catalog['id'] . ' already exist'); } diff --git a/docs/api/resto-api.html b/docs/api/resto-api.html index 9e73a32d..aacc0526 100644 --- a/docs/api/resto-api.html +++ b/docs/api/resto-api.html @@ -1496,7 +1496,7 @@