private function doDeliverPermalink(Request $request, $sbas_id, $record_id, $token, $subdef) { $databox = $this->getDatabox($sbas_id); $record = $this->retrieveRecord($databox, $token, $record_id, $subdef); $watermark = $stamp = false; if ($this->authentication->isAuthenticated()) { $watermark = !$this->acl->get($this->authentication->getUser())->has_right_on_base($record->get_base_id(), 'nowatermark'); if ($watermark) { /** @var BasketElementRepository $repository */ $repository = $this->app['repo.basket-elements']; if (count($repository->findReceivedValidationElementsByRecord($record, $this->authentication->getUser())) > 0) { $watermark = false; } elseif (count($repository->findReceivedElementsByRecord($record, $this->authentication->getUser())) > 0) { $watermark = false; } } return $this->deliverContentWithCaptionLink($request, $record, $subdef, $watermark, $stamp, $token); } $collection = \collection::get_from_base_id($this->app, $record->get_base_id()); switch ($collection->get_pub_wm()) { default: case 'none': $watermark = false; break; case 'stamp': $stamp = true; break; case 'wm': $watermark = true; break; } return $this->deliverContentWithCaptionLink($request, $record, $subdef, $watermark, $stamp, $token); }
/** * @covers Alchemy\Phrasea\Authentication\Authenticator::isAuthenticated */ public function testIsNotAuthenticated() { $app = $this->loadApp(); $app['browser'] = $browser = $this->getBrowserMock(); $app['session'] = $session = $this->getSessionMock(); $app['EM'] = $em = $this->getEntityManagerMock(); $authenticator = new Authenticator($app, $browser, $session, $em); $this->assertFalse($authenticator->isAuthenticated()); }