getProviders() as $provider) { $provider->verifyStartAuthorization($deliveryId, $user); } } /** * Verify that a given delivery execution is allowed to be executed * * @param DeliveryExecutionInterface $deliveryExecution * @param User $user */ public function verifyResumeAuthorization(DeliveryExecutionInterface $deliveryExecution, User $user) { foreach ($this->getProviders() as $provider) { $provider->verifyResumeAuthorization($deliveryExecution, $user); } $this->getServiceManager()->get(EventManager::SERVICE_ID)->trigger(new DeliveryExecutionVerified($deliveryExecution)); } /** * Returns a list of providers that need to be verified * * @return AuthorizationProvider[] */ protected function getProviders() { if (is_null($this->providers)) { $this->providers = []; if ($this->hasOption(self::OPTION_PROVIDERS)) { foreach ($this->getOption(self::OPTION_PROVIDERS) as $provider) { if ($provider instanceof ServiceLocatorAwareInterface) { $provider->setServiceLocator($this->getServiceLocator()); } $this->providers[] = $provider; } } } return $this->providers; } /** * Add an additional authorization provider that needs * to be satisfied as well * * @param AuthorizationProvider $provider */ public function addProvider(AuthorizationProvider $provider) { $providers = $this->getOption(self::OPTION_PROVIDERS); $providers[] = $provider; $this->setOption(self::OPTION_PROVIDERS, $providers); } /** * Remove an existing authorization provider, identified by * exact class * * @param $providerClass * @internal param AuthorizationProvider $provider */ public function unregister($providerClass) { $providers = $this->getOption(self::OPTION_PROVIDERS); foreach ($providers as $key => $provider) { if (get_class($provider) == $providerClass) { unset($providers[$key]); } } $this->setOption(self::OPTION_PROVIDERS, $providers); } }