public function startDelivery(core_kernel_classes_Resource $delivery, core_kernel_classes_Resource $link, User $user) {
        $this->getAuthorizationProvider()->verifyStartAuthorization($delivery->getUri(), $user);

        /** @var LtiAssignment $assignmentService */
        $assignmentService = $this->getServiceLocator()->get(LtiAssignment::SERVICE_ID);
        if (!$assignmentService->isDeliveryExecutionAllowed($delivery->getUri(), $user) ) {
            throw new \common_exception_Unauthorized(__('User is not authorized to run this delivery'));
        }
        $stateService = $this->getServiceLocator()->get(StateServiceInterface::SERVICE_ID);
        $deliveryExecution = $stateService->createDeliveryExecution($delivery->getUri(), $user, $delivery->getLabel());

        $this->getServiceLocator()->get(LtiDeliveryExecutionService::SERVICE_ID)->createDeliveryExecutionLink($user->getIdentifier(), $link->getUri(), $deliveryExecution->getIdentifier());

	    return $deliveryExecution;
	}
public function startDelivery(core_kernel_classes_Resource $delivery, core_kernel_classes_Resource $link, User $user) {
        $this->getAuthorizationProvider()->verifyStartAuthorization($delivery->getUri(), $user);

        /** @var LtiAssignment $assignmentService */
        $assignmentService = $this->getServiceLocator()->get(LtiAssignment::SERVICE_ID);
        if (!$assignmentService->isDeliveryExecutionAllowed($delivery->getUri(), $user) ) {
            throw new \common_exception_Unauthorized(__('User is not authorized to run this delivery'));
        }
        $stateService = $this->getServiceLocator()->get(StateServiceInterface::SERVICE_ID);
        $deliveryExecution = $stateService->createDeliveryExecution($delivery->getUri(), $user, $delivery->getLabel());

        $this->getServiceLocator()->get(LtiDeliveryExecutionService::SERVICE_ID)->createDeliveryExecutionLink($user->getIdentifier(), $link->getUri(), $deliveryExecution->getIdentifier());

	    return $deliveryExecution;
	}
public function startDelivery ( core_kernel_classes_Resource $ delivery , core_kernel_classes_Resource $ link , User $ user ) { $ this -> getAuthorizationProvider ( ) -> verifyStartAuthorization ( $ delivery -> getUri ( ) , $ user ) ; /** @var LtiAssignment $assignmentService */ $ assignmentService = $ this -> getServiceLocator ( ) -> get ( LtiAssignment :: SERVICE_ID ) ; if ( ! $ assignmentService -> isDeliveryExecutionAllowed ( $ delivery -> getUri ( ) , $ user ) ) { throw new \ common_exception_Unauthorized ( __ ( 'User is not authorized to run this delivery' ) ) ; } $ stateService = $ this -> getServiceLocator ( ) -> get ( StateServiceInterface :: SERVICE_ID ) ; $ deliveryExecution = $ stateService -> createDeliveryExecution ( $ delivery -> getUri ( ) , $ user , $ delivery -> getLabel ( ) ) ; $ this -> getServiceLocator ( ) -> get ( LtiDeliveryExecutionService :: SERVICE_ID ) -> createDeliveryExecutionLink ( $ user -> getIdentifier ( ) , $ link -> getUri ( ) , $ deliveryExecution -> getIdentifier ( ) ) ; return $ deliveryExecution ; }
Start a new delivery execution

@param core_kernel_classes_Resource $delivery
@param core_kernel_classes_Resource $link
@param User $user
@return DeliveryExecution
@throws \common_exception_Unauthorized
Start a new delivery execution