protected function canBeAuthorised(DeliveryExecution $deliveryExecution)
    {
        $result = false;
        $user = \common_session_SessionManager::getSession()->getUser();
        $stateUri = $deliveryExecution->getState()->getUri();
        if ($stateUri === ProctoredDeliveryExecution::STATE_AWAITING) {
            $result = true;
        }

        if (
            $user instanceof GuestTestUser &&
            !in_array($stateUri, [
                ProctoredDeliveryExecution::STATE_FINISHED,
                ProctoredDeliveryExecution::STATE_TERMINATED,
                ProctoredDeliveryExecution::STATE_CANCELED,
            ])
        ){
            $result = true;
        }

        return $result;
    }
protected function canBeAuthorised(DeliveryExecution $deliveryExecution)
    {
        $result = false;
        $user = \common_session_SessionManager::getSession()->getUser();
        $stateUri = $deliveryExecution->getState()->getUri();
        if ($stateUri === ProctoredDeliveryExecution::STATE_AWAITING) {
            $result = true;
        }

        if (
            $user instanceof GuestTestUser &&
            !in_array($stateUri, [
                ProctoredDeliveryExecution::STATE_FINISHED,
                ProctoredDeliveryExecution::STATE_TERMINATED,
                ProctoredDeliveryExecution::STATE_CANCELED,
            ])
        ){
            $result = true;
        }

        return $result;
    }
protected function canBeAuthorised ( DeliveryExecution $ deliveryExecution ) { $ result = false ; $ user = \ common_session_SessionManager :: getSession ( ) -> getUser ( ) ; $ stateUri = $ deliveryExecution -> getState ( ) -> getUri ( ) ; if ( $ stateUri === ProctoredDeliveryExecution :: STATE_AWAITING ) { $ result = true ; } if ( $ user instanceof GuestTestUser && ! in_array ( $ stateUri , [ ProctoredDeliveryExecution :: STATE_FINISHED , ProctoredDeliveryExecution :: STATE_TERMINATED , ProctoredDeliveryExecution :: STATE_CANCELED , ] ) ) { $ result = true ; } return $ result ; }
Whether delivery execution can be moved to authorised state.
@param DeliveryExecution $deliveryExecution
@return bool
Whether delivery execution can be moved to authorised state .