Skip to content

Commit

Permalink
Assign group to a delivery via REST API
Browse files Browse the repository at this point in the history
  • Loading branch information
wildanm committed May 24, 2022
1 parent ceaedc2 commit d0e41cc
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions controller/RestDelivery.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,15 @@
use oat\taoDeliveryRdf\model\DeliveryFactory;
use oat\taoDeliveryRdf\model\tasks\CompileDelivery;
use oat\taoDeliveryRdf\model\tasks\UpdateDelivery;
use oat\generis\model\OntologyAwareTrait;
use Request;
use RuntimeException;
use tao_models_classes_dataBinding_GenerisFormDataBindingException as FormDataBindingException;

class RestDelivery extends \tao_actions_RestController
{
use TaskLogActionTrait;
use OntologyAwareTrait;

const REST_DELIVERY_TEST_ID = 'test';
const REST_DELIVERY_SEARCH_PARAMS = 'searchParams';
Expand Down Expand Up @@ -554,4 +556,14 @@ private function getDeliveryPatchRequestHandler(): DeliveryPatchRequestHandler
{
return $this->getPsrContainer()->get(DeliveryPatchRequestHandler::class);
}

public function assignDeliveryToGroup()
{
$resource = $this->getResource($this->getRequestParameter('resourceUri')); //Group Resource URI
$property = $this->getProperty("http://www.tao.lu/Ontologies/TAOGroup.rdf#Deliveries");
$resource_delivery_uri = [$this->getProperty($this->getRequestParameter('resourceDeliveryUri'))]; //Delivery URI
$success = $resource->editPropertyValues($property, $resource_delivery_uri);

return $this->returnJson(['saved' => $success ]);
}
}

0 comments on commit d0e41cc

Please sign in to comment.