diff --git a/controllers/ApiController.php b/controllers/ApiController.php index b02bb4e0..d41455b0 100644 --- a/controllers/ApiController.php +++ b/controllers/ApiController.php @@ -55,6 +55,7 @@ class ApiController extends Controller { protected $objectKey; protected $objectName; protected $subset; + protected $getOnly; protected $singleObject; protected $publications = false; protected $legacyPublications = false; @@ -446,6 +447,7 @@ public function init($extra) { $this->scopeObject = !empty($extra['scopeObject']) ? $extra['scopeObject'] : $this->scopeObject; $this->subset = !empty($extra['subset']) ? $extra['subset'] : $this->subset; + $this->getOnly = !empty($extra['getOnly']) ? $extra['getOnly'] : $this->getOnly; $this->fileMode = !empty($extra['file']) ? (!empty($_GET['info']) ? 'info' : 'download') diff --git a/controllers/ItemsController.php b/controllers/ItemsController.php index d3a6e489..f9a827fb 100644 --- a/controllers/ItemsController.php +++ b/controllers/ItemsController.php @@ -425,6 +425,9 @@ public function items() { ); } else if ($this->subset == 'children') { + if ($this->getOnly) { + $this->allowMethods(array('GET')); + } $item = Zotero_Items::getByLibraryAndKey($this->objectLibraryID, $this->objectKey); if (!$item) { $this->e404("Item not found"); diff --git a/include/config/routes.inc.php b/include/config/routes.inc.php index b8b1a75d..d31ead5e 100644 --- a/include/config/routes.inc.php +++ b/include/config/routes.inc.php @@ -34,6 +34,8 @@ $router->map('/groups/i:objectGroupID/items/:objectKey/file', array('controller' => 'Items', 'extra' => array('allowHTTP' => true, 'file' => true))); $router->map('/groups/i:objectGroupID/items/:objectKey/file/view', array('controller' => 'Items', 'extra' => array('allowHTTP' => true, 'file' => true, 'view' => true))); $router->map('/groups/i:objectGroupID/items/:objectKey/file/view/url', ['controller' => 'Items', 'extra' => ['file' => true, 'viewurl' => true]]); +$router->map('/users/i:objectUserID/items/:objectKey/children', ['controller' => 'Items', 'extra' => ['subset' => 'children', 'getOnly' => true]]); +$router->map('/groups/i:objectGroupID/items/:objectKey/children', ['controller' => 'Items', 'extra' => ['subset' => 'children', 'getOnly' => true]]); // Full-text content $router->map('/users/i:objectUserID/items/:objectKey/fulltext', array('controller' => 'FullText', 'action' => 'itemContent'));