diff --git a/lib/Alchemy/Phrasea/Application/Helper/AuthenticatorAware.php b/lib/Alchemy/Phrasea/Application/Helper/AuthenticatorAware.php index eb924e657b..d43a68a4d5 100644 --- a/lib/Alchemy/Phrasea/Application/Helper/AuthenticatorAware.php +++ b/lib/Alchemy/Phrasea/Application/Helper/AuthenticatorAware.php @@ -10,6 +10,7 @@ namespace Alchemy\Phrasea\Application\Helper; use Alchemy\Phrasea\Authentication\Authenticator; +use Alchemy\Phrasea\Model\Entities\User; trait AuthenticatorAware { @@ -66,4 +67,12 @@ trait AuthenticatorAware return $this->authenticator; } + + /** + * @return User|null + */ + public function getAuthenticatedUser() + { + return $this->getAuthenticator()->getUser(); + } } diff --git a/lib/Alchemy/Phrasea/Command/Developer/JsFixtures.php b/lib/Alchemy/Phrasea/Command/Developer/JsFixtures.php index 97df2ca102..b8dd78033a 100644 --- a/lib/Alchemy/Phrasea/Command/Developer/JsFixtures.php +++ b/lib/Alchemy/Phrasea/Command/Developer/JsFixtures.php @@ -93,12 +93,12 @@ class JsFixtures extends Command private function loginUser(Application $app, User $user) { - $app['authentication']->openAccount($user); + $app->getAuthenticator()->openAccount($user); } private function logoutUser(Application $app) { - $app['authentication']->closeAccount(); + $app->getAuthenticator()->closeAccount(); } private function writeResponse(OutputInterface $output, $method, $path, $to, $authenticateUser = false) diff --git a/lib/Alchemy/Phrasea/Controller/Admin/DashboardController.php b/lib/Alchemy/Phrasea/Controller/Admin/DashboardController.php index b3f34cb254..6fcded5b62 100644 --- a/lib/Alchemy/Phrasea/Controller/Admin/DashboardController.php +++ b/lib/Alchemy/Phrasea/Controller/Admin/DashboardController.php @@ -128,7 +128,7 @@ class DashboardController extends Controller $this->app->abort(400, '"admins" parameter must contains at least one value.'); } /** @var Authenticator $authenticator */ - $authenticator = $this->app['authentication']; + $authenticator = $this->app->getAuthenticator(); if (!in_array($authenticator->getUser()->getId(), $admins)) { $admins[] = $authenticator->getUser()->getId(); } diff --git a/lib/Alchemy/Phrasea/Controller/Admin/DataboxController.php b/lib/Alchemy/Phrasea/Controller/Admin/DataboxController.php index a1c749b679..d1f6e8789b 100644 --- a/lib/Alchemy/Phrasea/Controller/Admin/DataboxController.php +++ b/lib/Alchemy/Phrasea/Controller/Admin/DataboxController.php @@ -271,7 +271,7 @@ class DataboxController extends Controller $connection->beginTransaction(); try { /** @var Authenticator $authenticator */ - $authenticator = $this->app['authentication']; + $authenticator = $this->app->getAuthenticator(); $baseId = \collection::mount_collection( $this->app, $this->findDataboxById($databox_id), diff --git a/lib/Alchemy/Phrasea/Controller/Admin/DataboxesController.php b/lib/Alchemy/Phrasea/Controller/Admin/DataboxesController.php index a13a62197d..5f59064396 100644 --- a/lib/Alchemy/Phrasea/Controller/Admin/DataboxesController.php +++ b/lib/Alchemy/Phrasea/Controller/Admin/DataboxesController.php @@ -222,7 +222,7 @@ class DataboxesController extends Controller $this->app['phraseanet.appbox']->get_connection()->beginTransaction(); $base = \databox::mount($this->app, $hostname, $port, $user, $password, $dbName); - $base->registerAdmin($this->app['authentication']->getUser()); + $base->registerAdmin($this->app->getAuthenticatedUser()); $this->app['phraseanet.appbox']->get_connection()->commit(); return $this->app->redirectPath('admin_database', [ diff --git a/lib/Alchemy/Phrasea/Controller/RecordsRequest.php b/lib/Alchemy/Phrasea/Controller/RecordsRequest.php index 3aae4c914c..eea6ad3700 100644 --- a/lib/Alchemy/Phrasea/Controller/RecordsRequest.php +++ b/lib/Alchemy/Phrasea/Controller/RecordsRequest.php @@ -208,7 +208,7 @@ class RecordsRequest extends ArrayCollection if ($request->get('ssel')) { $basket = $app['converter.basket']->convert($request->get('ssel')); - $app['acl.basket']->hasAccess($basket, $app['authentication']->getUser()); + $app['acl.basket']->hasAccess($basket, $app->getAuthenticatedUser()); foreach ($basket->getElements() as $basket_element) { $received[$basket_element->getRecord($app)->get_serialize_key()] = $basket_element->getRecord($app); @@ -217,7 +217,7 @@ class RecordsRequest extends ArrayCollection $repository = $app['repo.story-wz']; $storyWZ = $repository->findByUserAndId( - $app, $app['authentication']->getUser() + $app, $app->getAuthenticatedUser() , $request->get('story') ); @@ -243,20 +243,20 @@ class RecordsRequest extends ArrayCollection $to_remove = []; foreach ($elements as $id => $record) { - if (!$app['acl']->get($app['authentication']->getUser())->has_access_to_record($record)) { + if (!$app['acl']->get($app->getAuthenticatedUser())->has_access_to_record($record)) { $to_remove[] = $id; continue; } foreach ($rightsColl as $right) { - if (!$app['acl']->get($app['authentication']->getUser())->has_right_on_base($record->get_base_id(), $right)) { + if (!$app['acl']->get($app->getAuthenticatedUser())->has_right_on_base($record->get_base_id(), $right)) { $to_remove[] = $id; continue; } } foreach ($rightsDatabox as $right) { - if (!$app['acl']->get($app['authentication']->getUser())->has_right_on_sbas($record->get_sbas_id(), $right)) { + if (!$app['acl']->get($app->getAuthenticatedUser())->has_right_on_sbas($record->get_sbas_id(), $right)) { $to_remove[] = $id; continue; } diff --git a/lib/Alchemy/Phrasea/Controller/SetupController.php b/lib/Alchemy/Phrasea/Controller/SetupController.php index 937db64b10..776a2eb4e9 100644 --- a/lib/Alchemy/Phrasea/Controller/SetupController.php +++ b/lib/Alchemy/Phrasea/Controller/SetupController.php @@ -177,7 +177,7 @@ class SetupController extends Controller $user = $installer->install($email, $password, $abConn, $servername, $dataPath, $dbConn, $template, $binaryData); - $this->app['authentication']->openAccount($user); + $this->app->getAuthenticator()->openAccount($user); return $this->app->redirectPath('admin', [ 'section' => 'taskmanager', diff --git a/lib/Alchemy/Phrasea/ControllerProvider/Datafiles.php b/lib/Alchemy/Phrasea/ControllerProvider/Datafiles.php index c1e7757438..76f8dfc1ea 100644 --- a/lib/Alchemy/Phrasea/ControllerProvider/Datafiles.php +++ b/lib/Alchemy/Phrasea/ControllerProvider/Datafiles.php @@ -24,7 +24,7 @@ class Datafiles implements ControllerProviderInterface, ServiceProviderInterface public function register(Application $app) { $app['controller.datafiles'] = $app->share(function (PhraseaApplication $app) { - return (new DatafileController($app, $app['phraseanet.appbox'], $app['acl'], $app['authentication'])) + return (new DatafileController($app, $app['phraseanet.appbox'], $app['acl'], $app->getAuthenticator())) ->setDataboxLoggerLocator($app['phraseanet.logger']) ->setDelivererLocator(new LazyLocator($app, 'phraseanet.file-serve')) ; @@ -40,7 +40,7 @@ class Datafiles implements ControllerProviderInterface, ServiceProviderInterface $controllers = $app['controllers_factory']; $controllers->before(function (Request $request) use ($app) { - if (!$app['authentication']->isAuthenticated()) { + if (!$app->getAuthenticator()->isAuthenticated()) { $app->abort(403, sprintf('You are not authorized to access %s', $request->getRequestUri())); } }); diff --git a/lib/Alchemy/Phrasea/ControllerProvider/Lightbox.php b/lib/Alchemy/Phrasea/ControllerProvider/Lightbox.php index 42f618d3a2..e540724c13 100644 --- a/lib/Alchemy/Phrasea/ControllerProvider/Lightbox.php +++ b/lib/Alchemy/Phrasea/ControllerProvider/Lightbox.php @@ -119,8 +119,8 @@ class Lightbox implements ControllerProviderInterface, ServiceProviderInterface return null; } - if ($app['authentication']->isAuthenticated()) { - $app['authentication']->closeAccount(); + if ($app->getAuthenticator()->isAuthenticated()) { + $app->getAuthenticator()->closeAccount(); } if (null === $token = $app['repo.tokens']->findValidToken($request->query->get('LOG'))) { @@ -130,7 +130,7 @@ class Lightbox implements ControllerProviderInterface, ServiceProviderInterface } /** @var Token $token */ - $app['authentication']->openAccount($token->getUser()); + $app->getAuthenticator()->openAccount($token->getUser()); switch ($token->getType()) { case TokenManipulator::TYPE_FEED_ENTRY: diff --git a/lib/Alchemy/Phrasea/ControllerProvider/Permalink.php b/lib/Alchemy/Phrasea/ControllerProvider/Permalink.php index 72bcdf08fe..ec9053dd8c 100644 --- a/lib/Alchemy/Phrasea/ControllerProvider/Permalink.php +++ b/lib/Alchemy/Phrasea/ControllerProvider/Permalink.php @@ -24,7 +24,7 @@ class Permalink implements ControllerProviderInterface, ServiceProviderInterface public function register(Application $app) { $app['controller.permalink'] = $app->share(function (PhraseaApplication $app) { - return (new PermalinkController($app, $app['phraseanet.appbox'], $app['acl'], $app['authentication'])) + return (new PermalinkController($app, $app['phraseanet.appbox'], $app['acl'], $app->getAuthenticator())) ->setDataboxLoggerLocator($app['phraseanet.logger']) ->setDelivererLocator(new LazyLocator($app, 'phraseanet.file-serve')) ; diff --git a/lib/Alchemy/Phrasea/Core/Event/Subscriber/PersistentCookieSubscriber.php b/lib/Alchemy/Phrasea/Core/Event/Subscriber/PersistentCookieSubscriber.php index 83bd1070e3..18adbffc25 100644 --- a/lib/Alchemy/Phrasea/Core/Event/Subscriber/PersistentCookieSubscriber.php +++ b/lib/Alchemy/Phrasea/Core/Event/Subscriber/PersistentCookieSubscriber.php @@ -36,9 +36,9 @@ class PersistentCookieSubscriber implements EventSubscriberInterface { $request = $event->getRequest(); - if ($this->app['configuration.store']->isSetup() && $request->cookies->has('persistent') && !$this->app['authentication']->isAuthenticated()) { + if ($this->app['configuration.store']->isSetup() && $request->cookies->has('persistent') && !$this->app->getAuthenticator()->isAuthenticated()) { if (false !== $session = $this->app['authentication.persistent-manager']->getSession($request->cookies->get('persistent'))) { - $this->app['authentication']->refreshAccount($session); + $this->app->getAuthenticator()->refreshAccount($session); } } } diff --git a/lib/Alchemy/Phrasea/Core/Event/Subscriber/SessionManagerSubscriber.php b/lib/Alchemy/Phrasea/Core/Event/Subscriber/SessionManagerSubscriber.php index 0cd51d857e..e34270f5b3 100644 --- a/lib/Alchemy/Phrasea/Core/Event/Subscriber/SessionManagerSubscriber.php +++ b/lib/Alchemy/Phrasea/Core/Event/Subscriber/SessionManagerSubscriber.php @@ -97,7 +97,7 @@ class SessionManagerSubscriber implements EventSubscriberInterface } // if we are already disconnected (ex. from another window), quit immediatly - if (!($this->app['authentication']->isAuthenticated())) { + if (!($this->app->getAuthenticator()->isAuthenticated())) { if ($event->getRequest()->isXmlHttpRequest()) { $response = new Response("End-Session", 403); } else { @@ -120,7 +120,7 @@ class SessionManagerSubscriber implements EventSubscriberInterface $dt = $now->getTimestamp() - $session->getUpdated()->getTimestamp(); if ($idle > 0 && $dt > $idle) { // we must disconnet due to idletime - $this->app['authentication']->closeAccount(); + $this->app->getAuthenticator()->closeAccount(); if ($event->getRequest()->isXmlHttpRequest()) { $response = new Response("End-Session", 403); } else { diff --git a/lib/Alchemy/Phrasea/Core/Middleware/BasketMiddlewareProvider.php b/lib/Alchemy/Phrasea/Core/Middleware/BasketMiddlewareProvider.php index 9acc2ad1dd..cc92682ec1 100644 --- a/lib/Alchemy/Phrasea/Core/Middleware/BasketMiddlewareProvider.php +++ b/lib/Alchemy/Phrasea/Core/Middleware/BasketMiddlewareProvider.php @@ -28,14 +28,14 @@ class BasketMiddlewareProvider implements ServiceProviderInterface $app['middleware.basket.user-access'] = $app->protect(function (Request $request, Application $app) { if ($request->attributes->has('basket')) { - if (!$app['acl.basket']->hasAccess($request->attributes->get('basket'), $app['authentication']->getUser())) { + if (!$app['acl.basket']->hasAccess($request->attributes->get('basket'), $app->getAuthenticatedUser())) { throw new AccessDeniedHttpException('Current user does not have access to the basket'); } } }); $app['middleware.basket.user-is-owner'] = $app->protect(function (Request $request, Application $app) { - if (!$app['acl.basket']->isOwner($request->attributes->get('basket'), $app['authentication']->getUser())) { + if (!$app['acl.basket']->isOwner($request->attributes->get('basket'), $app->getAuthenticatedUser())) { throw new AccessDeniedHttpException('Only basket owner can modify the basket'); } }); diff --git a/lib/Alchemy/Phrasea/Feed/Formatter/RssFormatter.php b/lib/Alchemy/Phrasea/Feed/Formatter/RssFormatter.php index a802118c60..ec892d2fc3 100644 --- a/lib/Alchemy/Phrasea/Feed/Formatter/RssFormatter.php +++ b/lib/Alchemy/Phrasea/Feed/Formatter/RssFormatter.php @@ -182,7 +182,7 @@ class RssFormatter extends FeedFormatterAbstract implements FeedFormatterInterfa if ($feed->isPublic()) { $link = $app['feed.link-generator-collection']->generatePublic($feed, FeedLinkGenerator::FORMAT_RSS); } else { - $link = $app['feed.link-generator-collection']->generate($feed, $app['authentication']->getUser(), FeedLinkGenerator::FORMAT_RSS); + $link = $app['feed.link-generator-collection']->generate($feed, $app->getAuthenticatedUser(), FeedLinkGenerator::FORMAT_RSS); } $this->addTag($document, $item, 'title', $entry->getTitle()); diff --git a/lib/Alchemy/Phrasea/Helper/Prod.php b/lib/Alchemy/Phrasea/Helper/Prod.php index e7f8bf22f4..490e4a4707 100644 --- a/lib/Alchemy/Phrasea/Helper/Prod.php +++ b/lib/Alchemy/Phrasea/Helper/Prod.php @@ -25,19 +25,19 @@ class Prod extends Helper $bases = $fields = $dates = $sort = array(); - if (!$this->app['authentication']->getUser()) { + if (!$this->app->getAuthenticatedUser()) { return $searchData; } - $searchSet = json_decode($this->app['settings']->getUserSetting($this->app['authentication']->getUser(), 'search'), true); - $saveSettings = $this->app['settings']->getUserSetting($this->app['authentication']->getUser(), 'advanced_search_reload'); + $searchSet = json_decode($this->app['settings']->getUserSetting($this->app->getAuthenticatedUser(), 'search'), true); + $saveSettings = $this->app['settings']->getUserSetting($this->app->getAuthenticatedUser(), 'advanced_search_reload'); - foreach ($this->app['acl']->get($this->app['authentication']->getUser())->get_granted_sbas() as $databox) { + foreach ($this->app['acl']->get($this->app->getAuthenticatedUser())->get_granted_sbas() as $databox) { $sbasId = $databox->get_sbas_id(); $bases[$sbasId] = array('thesaurus' => (trim($databox->get_thesaurus()) !== ""), 'cterms' => false, 'collections' => array(), 'sbas_id' => $sbasId); - foreach ($this->app['acl']->get($this->app['authentication']->getUser())->get_granted_base([], [$databox->get_sbas_id()]) as $coll) { + foreach ($this->app['acl']->get($this->app->getAuthenticatedUser())->get_granted_base([], [$databox->get_sbas_id()]) as $coll) { $selected = $saveSettings ? ((isset($searchSet['bases']) && isset($searchSet['bases'][$sbasId])) ? (in_array($coll->get_base_id(), $searchSet['bases'][$sbasId])) : true) : true; $bases[$sbasId]['collections'][] = array('selected' => $selected, 'base_id' => $coll->get_base_id()); } @@ -78,7 +78,7 @@ class Prod extends Helper if (!$bases[$sbasId]['thesaurus']) { continue; } - if (!$this->app['acl']->get($this->app['authentication']->getUser())->has_right_on_sbas($sbasId, 'bas_modif_th')) { + if (!$this->app['acl']->get($this->app->getAuthenticatedUser())->has_right_on_sbas($sbasId, 'bas_modif_th')) { continue; } diff --git a/lib/Alchemy/Phrasea/Helper/Record/Helper.php b/lib/Alchemy/Phrasea/Helper/Record/Helper.php index 7071ff0349..d23485cccc 100644 --- a/lib/Alchemy/Phrasea/Helper/Record/Helper.php +++ b/lib/Alchemy/Phrasea/Helper/Record/Helper.php @@ -109,7 +109,7 @@ class Helper extends \Alchemy\Phrasea\Helper\Helper if (trim($Request->get('ssel')) !== '') { $Basket = $app['converter.basket']->convert($Request->get('ssel')); - $app['acl.basket']->hasAccess($Basket, $app['authentication']->getUser()); + $app['acl.basket']->hasAccess($Basket, $app->getAuthenticatedUser()); $this->selection->load_basket($Basket); @@ -118,7 +118,7 @@ class Helper extends \Alchemy\Phrasea\Helper\Helper } elseif (trim($Request->get('story')) !== '') { $repository = $app['repo.story-wz']; - $storyWZ = $repository->findByUserAndId($app, $app['authentication']->getUser(), $Request->get('story')); + $storyWZ = $repository->findByUserAndId($app, $app->getAuthenticatedUser(), $Request->get('story')); $this->selection->load_list([$storyWZ->getRecord($this->app)->get_serialize_key()], $this->flatten_groupings); } else { diff --git a/lib/Alchemy/Phrasea/Helper/User/Edit.php b/lib/Alchemy/Phrasea/Helper/User/Edit.php index 83a26582dc..e06d1109eb 100644 --- a/lib/Alchemy/Phrasea/Helper/User/Edit.php +++ b/lib/Alchemy/Phrasea/Helper/User/Edit.php @@ -59,7 +59,7 @@ class Edit extends \Alchemy\Phrasea\Helper\Helper public function delete_users() { foreach ($this->users as $usr_id) { - if ($this->app['authentication']->getUser()->getId() === (int) $usr_id) { + if ($this->app->getAuthenticatedUser()->getId() === (int) $usr_id) { continue; } $user = $this->app['repo.users']->find($usr_id); @@ -71,7 +71,7 @@ class Edit extends \Alchemy\Phrasea\Helper\Helper protected function delete_user(User $user) { - $list = array_keys($this->app['acl']->get($this->app['authentication']->getUser())->get_granted_base(['canadmin'])); + $list = array_keys($this->app['acl']->get($this->app->getAuthenticatedUser())->get_granted_base(['canadmin'])); $this->app['acl']->get($user)->revoke_access_from_bases($list); @@ -84,7 +84,7 @@ class Edit extends \Alchemy\Phrasea\Helper\Helper public function get_users_rights() { - $list = array_keys($this->app['acl']->get($this->app['authentication']->getUser())->get_granted_base(['canadmin'])); + $list = array_keys($this->app['acl']->get($this->app->getAuthenticatedUser())->get_granted_base(['canadmin'])); $sql = "SELECT b.sbas_id, @@ -476,7 +476,7 @@ class Edit extends \Alchemy\Phrasea\Helper\Helper public function apply_rights() { - $ACL = $this->app['acl']->get($this->app['authentication']->getUser()); + $ACL = $this->app['acl']->get($this->app->getAuthenticatedUser()); $base_ids = array_keys($ACL->get_granted_base(['canadmin'])); $update = $create = $delete = $create_sbas = $update_sbas = []; @@ -684,11 +684,11 @@ class Edit extends \Alchemy\Phrasea\Helper\Helper if (null === $template) { throw new NotFoundHttpException(sprintf('Given template "%s" could not be found', $this->request->get('template'))); } - if (null === $template->getTemplateOwner() || $template->getTemplateOwner()->getId() !== $this->app['authentication']->getUser()->getId()) { + if (null === $template->getTemplateOwner() || $template->getTemplateOwner()->getId() !== $this->app->getAuthenticatedUser()->getId()) { throw new AccessDeniedHttpException('You are not the owner of the template'); } - $base_ids = array_keys($this->app['acl']->get($this->app['authentication']->getUser())->get_granted_base(['canadmin'])); + $base_ids = array_keys($this->app['acl']->get($this->app->getAuthenticatedUser())->get_granted_base(['canadmin'])); foreach ($this->users as $usr_id) { $user = $this->app['repo.users']->find($usr_id); @@ -744,7 +744,7 @@ class Edit extends \Alchemy\Phrasea\Helper\Helper $activate = !!$this->request->get('limit'); - $base_ids = array_keys($this->app['acl']->get($this->app['authentication']->getUser())->get_granted_base(['canadmin'])); + $base_ids = array_keys($this->app['acl']->get($this->app->getAuthenticatedUser())->get_granted_base(['canadmin'])); foreach ($this->users as $usr_id) { $user = $this->app['repo.users']->find($usr_id); @@ -763,7 +763,7 @@ class Edit extends \Alchemy\Phrasea\Helper\Helper public function resetRights() { - $base_ids = array_keys($this->app['acl']->get($this->app['authentication']->getUser())->get_granted_base(['canadmin'])); + $base_ids = array_keys($this->app['acl']->get($this->app->getAuthenticatedUser())->get_granted_base(['canadmin'])); foreach ($this->users as $usr_id) { $user = $this->app['repo.users']->find($usr_id); @@ -772,7 +772,7 @@ class Edit extends \Alchemy\Phrasea\Helper\Helper if ($user->isTemplate()) { $template = $user; - if ($template->getTemplateOwner()->getId() !== $this->app['authentication']->getUser()->getId()) { + if ($template->getTemplateOwner()->getId() !== $this->app->getAuthenticatedUser()->getId()) { continue; } } diff --git a/lib/Alchemy/Phrasea/Helper/User/Manage.php b/lib/Alchemy/Phrasea/Helper/User/Manage.php index b18c6a5cb9..44651c4372 100644 --- a/lib/Alchemy/Phrasea/Helper/User/Manage.php +++ b/lib/Alchemy/Phrasea/Helper/User/Manage.php @@ -76,7 +76,7 @@ class Manage extends Helper ->last_model_is($this->query_parms['last_model']) ->get_inactives($this->query_parms['inactives']) ->include_templates(false) - ->on_bases_where_i_am($this->app['acl']->get($this->app['authentication']->getUser()), ['canadmin']) + ->on_bases_where_i_am($this->app['acl']->get($this->app->getAuthenticatedUser()), ['canadmin']) ->execute(); return $this->results->get_results(); @@ -114,7 +114,7 @@ class Manage extends Helper ->last_model_is($this->query_parms['last_model']) ->get_inactives($this->query_parms['inactives']) ->include_templates(true) - ->on_bases_where_i_am($this->app['acl']->get($this->app['authentication']->getUser()), ['canadmin']) + ->on_bases_where_i_am($this->app['acl']->get($this->app->getAuthenticatedUser()), ['canadmin']) ->limit($offset_start, $results_quantity) ->execute(); @@ -198,8 +198,8 @@ class Manage extends Helper throw new \Exception_InvalidArgument('Invalid template name'); } - $created_user = $this->app['manipulator.user']->createTemplate($name, $this->app['authentication']->getUser()); - $this->usr_id = $this->app['authentication']->getUser()->getId(); + $created_user = $this->app['manipulator.user']->createTemplate($name, $this->app->getAuthenticatedUser()); + $this->usr_id = $this->app->getAuthenticatedUser()->getId(); return $created_user; } diff --git a/lib/Alchemy/Phrasea/Helper/WorkZone.php b/lib/Alchemy/Phrasea/Helper/WorkZone.php index 281d57ec6b..542d240343 100644 --- a/lib/Alchemy/Phrasea/Helper/WorkZone.php +++ b/lib/Alchemy/Phrasea/Helper/WorkZone.php @@ -39,26 +39,26 @@ class WorkZone extends Helper $ret = new ArrayCollection(); - $baskets = $repo_baskets->findActiveByUser($this->app['authentication']->getUser(), $sort); + $baskets = $repo_baskets->findActiveByUser($this->app->getAuthenticatedUser(), $sort); // force creation of a default basket if (0 === count($baskets)) { $basket = new BasketEntity(); $basket->setName($this->app->trans('Default basket')); - $basket->setUser($this->app['authentication']->getUser()); + $basket->setUser($this->app->getAuthenticatedUser()); $this->app['orm.em']->persist($basket); $this->app['orm.em']->flush(); $baskets = [$basket]; } - $validations = $repo_baskets->findActiveValidationByUser($this->app['authentication']->getUser(), $sort); + $validations = $repo_baskets->findActiveValidationByUser($this->app->getAuthenticatedUser(), $sort); /* @var $repo_stories Alchemy\Phrasea\Model\Repositories\StoryWZRepository */ $repo_stories = $this->app['repo.story-wz']; - $stories = $repo_stories->findByUser($this->app, $this->app['authentication']->getUser(), $sort); + $stories = $repo_stories->findByUser($this->app, $this->app->getAuthenticatedUser(), $sort); $ret->set(self::BASKETS, $baskets); $ret->set(self::VALIDATIONS, $validations); diff --git a/lib/Alchemy/Phrasea/Out/Module/PDF.php b/lib/Alchemy/Phrasea/Out/Module/PDF.php index cd98a10810..ccb619a962 100644 --- a/lib/Alchemy/Phrasea/Out/Module/PDF.php +++ b/lib/Alchemy/Phrasea/Out/Module/PDF.php @@ -166,7 +166,7 @@ class PDF $fimg = $subdef->get_pathfile(); - if (!$this->app['acl']->get($this->app['authentication']->getUser())->has_right_on_base($rec->get_base_id(), "nowatermark") + if (!$this->app['acl']->get($this->app->getAuthenticatedUser())->has_right_on_base($rec->get_base_id(), "nowatermark") && $subdef->get_type() == \media_subdef::TYPE_IMAGE) { $fimg = \recordutils_image::watermark($this->app, $subdef); } @@ -438,7 +438,7 @@ class PDF $f = $subdef->get_pathfile(); - if (!$this->app['acl']->get($this->app['authentication']->getUser())->has_right_on_base($rec->get_base_id(), "nowatermark") + if (!$this->app['acl']->get($this->app->getAuthenticatedUser())->has_right_on_base($rec->get_base_id(), "nowatermark") && $subdef->get_type() == \media_subdef::TYPE_IMAGE) $f = \recordutils_image::watermark($this->app, $subdef); diff --git a/lib/Alchemy/Phrasea/SearchEngine/Elastic/ElasticSearchEngine.php b/lib/Alchemy/Phrasea/SearchEngine/Elastic/ElasticSearchEngine.php index 9f9c159ba3..f49ba150f8 100644 --- a/lib/Alchemy/Phrasea/SearchEngine/Elastic/ElasticSearchEngine.php +++ b/lib/Alchemy/Phrasea/SearchEngine/Elastic/ElasticSearchEngine.php @@ -396,11 +396,11 @@ class ElasticSearchEngine implements SearchEngineInterface private function createACLFilters() { // No ACLs if no user - if (false === $this->app['authentication']->isAuthenticated()) { + if (false === $this->app->getAuthenticator()->isAuthenticated()) { return []; } - $acl = $this->app['acl']->get($this->app['authentication']->getUser()); + $acl = $this->app['acl']->get($this->app->getAuthenticatedUser()); $grantedCollections = array_keys($acl->get_granted_base(['actif'])); diff --git a/lib/Alchemy/Phrasea/SearchEngine/SearchEngineOptions.php b/lib/Alchemy/Phrasea/SearchEngine/SearchEngineOptions.php index 276b6a1442..ec564aa57e 100644 --- a/lib/Alchemy/Phrasea/SearchEngine/SearchEngineOptions.php +++ b/lib/Alchemy/Phrasea/SearchEngine/SearchEngineOptions.php @@ -550,7 +550,7 @@ class SearchEngineOptions $options->setLocale($app['locale']); /** @var Authenticator $authenticator */ - $authenticator = $app['authentication']; + $authenticator = $app->getAuthenticator(); $isAuthenticated = $authenticator->isAuthenticated(); /** @var ACLProvider $aclProvider */ $aclProvider = $app['acl']; diff --git a/lib/Alchemy/Phrasea/Security/Firewall.php b/lib/Alchemy/Phrasea/Security/Firewall.php index 739555d444..178bf91f29 100644 --- a/lib/Alchemy/Phrasea/Security/Firewall.php +++ b/lib/Alchemy/Phrasea/Security/Firewall.php @@ -41,7 +41,7 @@ class Firewall { $this->requireNotGuest(); - if (!$this->app['acl']->get($this->app['authentication']->getUser())->is_admin()) { + if (!$this->app['acl']->get($this->app->getAuthenticatedUser())->is_admin()) { $this->app->abort(403, 'Admin role is required'); } @@ -50,7 +50,7 @@ class Firewall public function requireAccessToModule($module) { - if (!$this->app['acl']->get($this->app['authentication']->getUser())->has_access_to_module($module)) { + if (!$this->app['acl']->get($this->app->getAuthenticatedUser())->has_access_to_module($module)) { $this->app->abort(403, 'You do not have required rights'); } @@ -59,7 +59,7 @@ class Firewall public function requireAccessToSbas($sbas_id) { - if (!$this->app['acl']->get($this->app['authentication']->getUser())->has_access_to_sbas($sbas_id)) { + if (!$this->app['acl']->get($this->app->getAuthenticatedUser())->has_access_to_sbas($sbas_id)) { $this->app->abort(403, 'You do not have required rights'); } @@ -68,7 +68,7 @@ class Firewall public function requireAccessToBase($base_id) { - if (!$this->app['acl']->get($this->app['authentication']->getUser())->has_access_to_base($base_id)) { + if (!$this->app['acl']->get($this->app->getAuthenticatedUser())->has_access_to_base($base_id)) { $this->app->abort(403, 'You do not have required rights'); } @@ -77,7 +77,7 @@ class Firewall public function requireRight($right) { - if (!$this->app['acl']->get($this->app['authentication']->getUser())->has_right($right)) { + if (!$this->app['acl']->get($this->app->getAuthenticatedUser())->has_right($right)) { $this->app->abort(403, 'You do not have required rights'); } @@ -86,7 +86,7 @@ class Firewall public function requireRightOnBase($base_id, $right) { - if (!$this->app['acl']->get($this->app['authentication']->getUser())->has_right_on_base($base_id, $right)) { + if (!$this->app['acl']->get($this->app->getAuthenticatedUser())->has_right_on_base($base_id, $right)) { $this->app->abort(403, 'You do not have required rights'); } @@ -95,7 +95,7 @@ class Firewall public function requireRightOnSbas($sbas_id, $right) { - if (!$this->app['acl']->get($this->app['authentication']->getUser())->has_right_on_sbas($sbas_id, $right)) { + if (!$this->app['acl']->get($this->app->getAuthenticatedUser())->has_right_on_sbas($sbas_id, $right)) { $this->app->abort(403, 'You do not have required rights'); } @@ -104,7 +104,7 @@ class Firewall public function requireNotGuest() { - if ($this->app['authentication']->getUser()->isGuest()) { + if ($this->app->getAuthenticatedUser()->isGuest()) { $this->app->abort(403, 'Guests do not have admin role'); } @@ -117,7 +117,7 @@ class Firewall if (null !== $request) { $params['redirect'] = '..' . $request->getPathInfo().'?'.$request->getQueryString(); } - if (!$this->app['authentication']->isAuthenticated()) { + if (!$this->app->getAuthenticator()->isAuthenticated()) { return new RedirectResponse($this->app->path('homepage', $params)); } } @@ -139,14 +139,14 @@ class Firewall public function requireNotAuthenticated() { - if ($this->app['authentication']->isAuthenticated()) { + if ($this->app->getAuthenticator()->isAuthenticated()) { return new RedirectResponse($this->app->path('prod')); } } public function requireOrdersAdmin() { - if (false === !!count($this->app['acl']->get($this->app['authentication']->getUser())->get_granted_base(['order_master']))) { + if (false === !!count($this->app['acl']->get($this->app->getAuthenticatedUser())->get_granted_base(['order_master']))) { $this->app->abort(403, 'You are not an order admin'); } diff --git a/lib/Alchemy/Phrasea/Twig/PhraseanetExtension.php b/lib/Alchemy/Phrasea/Twig/PhraseanetExtension.php index 8b64321afd..d51af79715 100644 --- a/lib/Alchemy/Phrasea/Twig/PhraseanetExtension.php +++ b/lib/Alchemy/Phrasea/Twig/PhraseanetExtension.php @@ -128,14 +128,14 @@ class PhraseanetExtension extends \Twig_Extension public function isGrantedOnDatabox($databoxId, $rights) { - if (false === ($this->app['authentication']->getUser() instanceof User)) { + if (false === ($this->app->getAuthenticatedUser() instanceof User)) { return false; } $rights = (array) $rights; foreach ($rights as $right) { - if (false === $this->app['acl']->get($this->app['authentication']->getUser())->has_right_on_sbas($databoxId, $right)) { + if (false === $this->app['acl']->get($this->app->getAuthenticatedUser())->has_right_on_sbas($databoxId, $right)) { return false; } @@ -146,14 +146,14 @@ class PhraseanetExtension extends \Twig_Extension public function isGrantedOnCollection($baseId, $rights) { - if (false === ($this->app['authentication']->getUser() instanceof User)) { + if (false === ($this->app->getAuthenticatedUser() instanceof User)) { return false; } $rights = (array) $rights; foreach ($rights as $right) { - if (false === $this->app['acl']->get($this->app['authentication']->getUser())->has_right_on_base($baseId, $right)) { + if (false === $this->app['acl']->get($this->app->getAuthenticatedUser())->has_right_on_base($baseId, $right)) { return false; } @@ -177,12 +177,12 @@ class PhraseanetExtension extends \Twig_Extension public function hasAccessSubDefinition(RecordInterface $record, $subDefinition) { - if (false === ($this->app['authentication']->getUser() instanceof User)) { + if (false === ($this->app->getAuthenticatedUser() instanceof User)) { return false; } - return $this->app['acl']->get($this->app['authentication']->getUser())->has_access_to_subdef($record, $subDefinition); + return $this->app['acl']->get($this->app->getAuthenticatedUser())->has_access_to_subdef($record, $subDefinition); } public function getDoctypeIcon(RecordInterface $record) @@ -260,12 +260,12 @@ class PhraseanetExtension extends \Twig_Extension public function getUserSetting($setting, $default = null) { - if (false === ($this->app['authentication']->getUser() instanceof User)) { + if (false === ($this->app->getAuthenticatedUser() instanceof User)) { return $default; } - return $this->app['settings']->getUserSetting($this->app['authentication']->getUser(), $setting, $default); + return $this->app['settings']->getUserSetting($this->app->getAuthenticatedUser(), $setting, $default); } public function getCheckerFromFQCN($checkerFQCN) diff --git a/lib/classes/Session/Logger.php b/lib/classes/Session/Logger.php index 1f08cd9c2f..96c3cb71c4 100644 --- a/lib/classes/Session/Logger.php +++ b/lib/classes/Session/Logger.php @@ -98,8 +98,8 @@ class Session_Logger { $colls = []; - if ($app['authentication']->getUser()) { - $bases = $app['acl']->get($app['authentication']->getUser())->get_granted_base([], [$databox->get_sbas_id()]); + if ($app->getAuthenticatedUser()) { + $bases = $app['acl']->get($app->getAuthenticatedUser())->get_granted_base([], [$databox->get_sbas_id()]); foreach ($bases as $collection) { $colls[] = $collection->get_coll_id(); } @@ -118,9 +118,9 @@ class Session_Logger $params = [ ':ses_id' => $app['session']->get('session_id'), - ':usr_login' => $app['authentication']->getUser() ? $app['authentication']->getUser()->getLogin() : null, + ':usr_login' => $app->getAuthenticatedUser() ? $app->getAuthenticatedUser()->getLogin() : null, ':site_id' => $app['conf']->get(['main', 'key']), - ':usr_id' => $app['authentication']->isAuthenticated() ? $app['authentication']->getUser()->getId() : null, + ':usr_id' => $app->getAuthenticator()->isAuthenticated() ? $app->getAuthenticatedUser()->getId() : null, ':browser' => $browser->getBrowser(), ':browser_version' => $browser->getExtendedVersion(), ':platform' => $browser->getPlatform(), @@ -128,10 +128,10 @@ class Session_Logger ':ip' => $browser->getIP(), ':user_agent' => $browser->getUserAgent(), ':appli' => serialize([]), - ':fonction' => $app['authentication']->getUser() ? $app['authentication']->getUser()->getJob() : null, - ':company' => $app['authentication']->getUser() ? $app['authentication']->getUser()->getCompany() : null, - ':activity' => $app['authentication']->getUser() ? $app['authentication']->getUser()->getActivity() : null, - ':country' => $app['authentication']->getUser() ? $app['authentication']->getUser()->getCountry() : null + ':fonction' => $app->getAuthenticatedUser() ? $app->getAuthenticatedUser()->getJob() : null, + ':company' => $app->getAuthenticatedUser() ? $app->getAuthenticatedUser()->getCompany() : null, + ':activity' => $app->getAuthenticatedUser() ? $app->getAuthenticatedUser()->getActivity() : null, + ':country' => $app->getAuthenticatedUser() ? $app->getAuthenticatedUser()->getCountry() : null ]; $stmt = $conn->prepare($sql); @@ -157,7 +157,7 @@ class Session_Logger public static function load(Application $app, databox $databox) { - if ( ! $app['authentication']->isAuthenticated()) { + if ( ! $app->getAuthenticator()->isAuthenticated()) { throw new Exception_Session_LoggerNotFound('Not authenticated'); } @@ -182,7 +182,7 @@ class Session_Logger public static function updateClientInfos(Application $app, $appId) { - if (!$app['authentication']->isAuthenticated()) { + if (!$app->getAuthenticator()->isAuthenticated()) { return; } @@ -218,7 +218,7 @@ class Session_Logger ]; if (isset($appName[$appId])) { - $sbas_ids = array_keys($app['acl']->get($app['authentication']->getUser())->get_granted_sbas()); + $sbas_ids = array_keys($app['acl']->get($app->getAuthenticatedUser())->get_granted_sbas()); foreach ($sbas_ids as $sbas_id) { try { diff --git a/lib/classes/User/Query.php b/lib/classes/User/Query.php index 8df3ca0992..80e3fbe57b 100644 --- a/lib/classes/User/Query.php +++ b/lib/classes/User/Query.php @@ -814,14 +814,14 @@ class User_Query implements User_QueryInterface } if ($this->only_templates === true) { - if (!$this->app['authentication']->getUser()) { + if (!$this->app->getAuthenticatedUser()) { throw new InvalidArgumentException('Unable to load templates while disconnected'); } - $sql .= ' AND model_of = ' . $this->app['authentication']->getUser()->getId(); + $sql .= ' AND model_of = ' . $this->app->getAuthenticatedUser()->getId(); } elseif ($this->include_templates === false) { $sql .= ' AND model_of IS NULL'; - } elseif ($this->app['authentication']->getUser()) { - $sql .= ' AND (model_of IS NULL OR model_of = ' . $this->app['authentication']->getUser()->getId() . ' ) '; + } elseif ($this->app->getAuthenticatedUser()) { + $sql .= ' AND (model_of IS NULL OR model_of = ' . $this->app->getAuthenticatedUser()->getId() . ' ) '; } else { $sql .= ' AND model_of IS NULL'; } diff --git a/lib/classes/databox/cgu.php b/lib/classes/databox/cgu.php index b720963e7e..e443afc849 100644 --- a/lib/classes/databox/cgu.php +++ b/lib/classes/databox/cgu.php @@ -59,10 +59,10 @@ class databox_cgu $userValidation = true; if (! $home) { - if ( ! $app['acl']->get($app['authentication']->getUser())->has_access_to_sbas($databox->get_sbas_id())) { + if ( ! $app['acl']->get($app->getAuthenticatedUser())->has_access_to_sbas($databox->get_sbas_id())) { continue; } - $userValidation = ($app['settings']->getUserSetting($app['authentication']->getUser(), 'terms_of_use_' . $databox->get_sbas_id()) !== $update && trim($value) !== ''); + $userValidation = ($app['settings']->getUserSetting($app->getAuthenticatedUser(), 'terms_of_use_' . $databox->get_sbas_id()) !== $update && trim($value) !== ''); } if ($userValidation) diff --git a/lib/classes/databox/status.php b/lib/classes/databox/status.php index c59562c40b..126043bff7 100644 --- a/lib/classes/databox/status.php +++ b/lib/classes/databox/status.php @@ -22,10 +22,10 @@ class databox_status public static function getSearchStatus(Application $app) { $see_all = $structures = $stats = []; - foreach ($app['acl']->get($app['authentication']->getUser())->get_granted_sbas() as $databox) { + foreach ($app['acl']->get($app->getAuthenticatedUser())->get_granted_sbas() as $databox) { $see_all[$databox->get_sbas_id()] = false; foreach ($databox->get_collections() as $collection) { - if ($app['acl']->get($app['authentication']->getUser())->has_right_on_base($collection->get_base_id(), 'chgstatus')) { + if ($app['acl']->get($app->getAuthenticatedUser())->has_right_on_base($collection->get_base_id(), 'chgstatus')) { $see_all[$databox->get_sbas_id()] = true; break; } diff --git a/lib/classes/eventsmanager/broker.php b/lib/classes/eventsmanager/broker.php index 313f906d2e..8078d7f468 100644 --- a/lib/classes/eventsmanager/broker.php +++ b/lib/classes/eventsmanager/broker.php @@ -105,7 +105,7 @@ class eventsmanager_broker FROM notifications WHERE usr_id = :usr_id'; $stmt = $this->app['phraseanet.appbox']->get_connection()->prepare($sql); - $stmt->execute([':usr_id' => $this->app['authentication']->getUser()->getId()]); + $stmt->execute([':usr_id' => $this->app->getAuthenticatedUser()->getId()]); $row = $stmt->fetch(PDO::FETCH_ASSOC); $stmt->closeCursor(); @@ -123,7 +123,7 @@ class eventsmanager_broker $data = ['notifications' => [], 'next' => '']; $stmt = $this->app['phraseanet.appbox']->get_connection()->prepare($sql); - $stmt->execute([':usr_id' => $this->app['authentication']->getUser()->getId()]); + $stmt->execute([':usr_id' => $this->app->getAuthenticatedUser()->getId()]); $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); $stmt->closeCursor(); @@ -179,7 +179,7 @@ class eventsmanager_broker FROM notifications WHERE usr_id = :usr_id AND unread="1"'; $stmt = $this->app['phraseanet.appbox']->get_connection()->prepare($sql); - $stmt->execute([':usr_id' => $this->app['authentication']->getUser()->getId()]); + $stmt->execute([':usr_id' => $this->app->getAuthenticatedUser()->getId()]); $row = $stmt->fetch(PDO::FETCH_ASSOC); $stmt->closeCursor(); @@ -198,7 +198,7 @@ class eventsmanager_broker FROM notifications WHERE usr_id = :usr_id'; $stmt = $this->app['phraseanet.appbox']->get_connection()->prepare($sql); - $stmt->execute([':usr_id' => $this->app['authentication']->getUser()->getId()]); + $stmt->execute([':usr_id' => $this->app->getAuthenticatedUser()->getId()]); $row = $stmt->fetch(PDO::FETCH_ASSOC); $stmt->closeCursor(); @@ -216,7 +216,7 @@ class eventsmanager_broker $ret = []; $stmt = $this->app['phraseanet.appbox']->get_connection()->prepare($sql); - $stmt->execute([':usr_id' => $this->app['authentication']->getUser()->getId()]); + $stmt->execute([':usr_id' => $this->app->getAuthenticatedUser()->getId()]); $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); $stmt->closeCursor(); diff --git a/lib/classes/eventsmanager/notify/orderdeliver.php b/lib/classes/eventsmanager/notify/orderdeliver.php index 794a386526..4802294da5 100644 --- a/lib/classes/eventsmanager/notify/orderdeliver.php +++ b/lib/classes/eventsmanager/notify/orderdeliver.php @@ -50,7 +50,7 @@ class eventsmanager_notify_orderdeliver extends eventsmanager_notifyAbstract try { $repository = $this->app['repo.baskets']; - $basket = $repository->findUserBasket($ssel_id, $this->app['authentication']->getUser(), false); + $basket = $repository->findUserBasket($ssel_id, $this->app->getAuthenticatedUser(), false); } catch (\Exception $e) { return []; } diff --git a/lib/classes/eventsmanager/notify/validationdone.php b/lib/classes/eventsmanager/notify/validationdone.php index 4937eb0e04..e1a1fe675d 100644 --- a/lib/classes/eventsmanager/notify/validationdone.php +++ b/lib/classes/eventsmanager/notify/validationdone.php @@ -49,7 +49,7 @@ class eventsmanager_notify_validationdone extends eventsmanager_notifyAbstract try { $repository = $this->app['repo.baskets']; - $basket = $repository->findUserBasket($ssel_id, $this->app['authentication']->getUser(), false); + $basket = $repository->findUserBasket($ssel_id, $this->app->getAuthenticatedUser(), false); } catch (\Exception $e) { return []; } diff --git a/lib/classes/module/report.php b/lib/classes/module/report.php index 6b0de709c9..654a66a878 100644 --- a/lib/classes/module/report.php +++ b/lib/classes/module/report.php @@ -253,7 +253,7 @@ class module_report $this->dmax = $d2; $this->sbas_id = $sbas_id; $this->list_coll_id = $collist; - $this->user_id = $this->app['authentication']->getUser()->getId(); + $this->user_id = $this->app->getAuthenticatedUser()->getId(); $this->periode = sprintf( '%s - %s ', $this->app['date-formatter']->getPrettyString(new \DateTime($d1)), diff --git a/lib/classes/record/adapter.php b/lib/classes/record/adapter.php index 5ffce189b9..e9a3840329 100644 --- a/lib/classes/record/adapter.php +++ b/lib/classes/record/adapter.php @@ -1712,7 +1712,7 @@ class record_adapter implements RecordInterface, cache_cacheableInterface throw new Exception('This record is not a grouping'); } - if ($this->app['authentication']->getUser()) { + if ($this->app->getAuthenticatedUser()) { $sql = 'SELECT record_id FROM regroup g INNER JOIN (record r @@ -1728,7 +1728,7 @@ class record_adapter implements RecordInterface, cache_cacheableInterface $params = [ ':site' => $this->app['conf']->get(['main', 'key']), - ':usr_id' => $this->app['authentication']->getUser()->getId(), + ':usr_id' => $this->app->getAuthenticatedUser()->getId(), ':record_id' => $this->get_record_id(), ]; } else { @@ -1780,7 +1780,7 @@ class record_adapter implements RecordInterface, cache_cacheableInterface $stmt = $this->get_databox()->get_connection()->prepare($sql); $stmt->execute([ ':site' => $this->app['conf']->get(['main', 'key']), - ':usr_id' => $this->app['authentication']->getUser()->getId(), + ':usr_id' => $this->app->getAuthenticatedUser()->getId(), ':record_id' => $this->get_record_id(), ]); $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); diff --git a/lib/classes/record/exportElement.php b/lib/classes/record/exportElement.php index 1aca6c3a27..0b8ad494d6 100644 --- a/lib/classes/record/exportElement.php +++ b/lib/classes/record/exportElement.php @@ -102,17 +102,17 @@ class record_exportElement extends record_adapter 'thumbnail' => true ]; - if ($this->app['acl']->get($this->app['authentication']->getUser())->has_right_on_base($this->get_base_id(), 'candwnldhd')) { + if ($this->app['acl']->get($this->app->getAuthenticatedUser())->has_right_on_base($this->get_base_id(), 'candwnldhd')) { $go_dl['document'] = true; } - if ($this->app['acl']->get($this->app['authentication']->getUser())->has_right_on_base($this->get_base_id(), 'candwnldpreview')) { + if ($this->app['acl']->get($this->app->getAuthenticatedUser())->has_right_on_base($this->get_base_id(), 'candwnldpreview')) { $go_dl['preview'] = true; } - if ($this->app['acl']->get($this->app['authentication']->getUser())->has_hd_grant($this)) { + if ($this->app['acl']->get($this->app->getAuthenticatedUser())->has_hd_grant($this)) { $go_dl['document'] = true; $go_dl['preview'] = true; } - if ($this->app['acl']->get($this->app['authentication']->getUser())->has_preview_grant($this)) { + if ($this->app['acl']->get($this->app->getAuthenticatedUser())->has_preview_grant($this)) { $go_dl['preview'] = true; } @@ -122,14 +122,14 @@ class record_exportElement extends record_adapter ->who_have_right(['order_master']) ->execute()->get_results(); - $go_cmd = (count($masters) > 0 && $this->app['acl']->get($this->app['authentication']->getUser())->has_right_on_base($this->base_id, 'cancmd')); + $go_cmd = (count($masters) > 0 && $this->app['acl']->get($this->app->getAuthenticatedUser())->has_right_on_base($this->base_id, 'cancmd')); $orderable['document'] = false; $downloadable['document'] = false; if (isset($sd['document']) && is_file($sd['document']->get_pathfile())) { if ($go_dl['document'] === true) { - if ($this->app['acl']->get($this->app['authentication']->getUser())->is_restricted_download($this->base_id)) { + if ($this->app['acl']->get($this->app->getAuthenticatedUser())->is_restricted_download($this->base_id)) { $this->remain_hd --; if ($this->remain_hd >= 0) { $localizedLabel = $this->app->trans('document original'); @@ -183,7 +183,7 @@ class record_exportElement extends record_adapter if (isset($sd[$name]) && $sd[$name]->is_physically_present()) { if ($class == 'document') { - if ($this->app['acl']->get($this->app['authentication']->getUser())->is_restricted_download($this->base_id)) { + if ($this->app['acl']->get($this->app->getAuthenticatedUser())->is_restricted_download($this->base_id)) { $this->remain_hd --; if ($this->remain_hd >= 0) $downloadable[$name] = [ diff --git a/lib/classes/record/preview.php b/lib/classes/record/preview.php index 1b50e3e569..218fa252fb 100644 --- a/lib/classes/record/preview.php +++ b/lib/classes/record/preview.php @@ -139,7 +139,7 @@ class record_preview extends record_adapter break; case "BASK": $Basket = $app['converter.basket']->convert($contId); - $app['acl.basket']->hasAccess($Basket, $app['authentication']->getUser()); + $app['acl.basket']->hasAccess($Basket, $app->getAuthenticatedUser()); /* @var $Basket Basket */ $this->container = $Basket; @@ -325,7 +325,7 @@ class record_preview extends record_adapter $tab = []; - $report = $this->app['acl']->get($this->app['authentication']->getUser())->has_right_on_base($this->get_base_id(), 'canreport'); + $report = $this->app['acl']->get($this->app->getAuthenticatedUser())->has_right_on_base($this->get_base_id(), 'canreport'); $databox = $this->app->findDataboxById($this->get_sbas_id()); $connsbas = $databox->get_connection(); @@ -338,7 +338,7 @@ class record_preview extends record_adapter if (! $report) { $sql .= ' AND ((l.usrid = :usr_id AND l.site= :site) OR action="add")'; - $params[':usr_id'] = $this->app['authentication']->getUser()->getId(); + $params[':usr_id'] = $this->app->getAuthenticatedUser()->getId(); $params[':site'] = $this->app['conf']->get(['main', 'key']); } @@ -401,7 +401,7 @@ class record_preview extends record_adapter return $this->view_popularity; } - $report = $this->app['acl']->get($this->app['authentication']->getUser())->has_right_on_base( + $report = $this->app['acl']->get($this->app->getAuthenticatedUser())->has_right_on_base( $this->get_base_id(), 'canreport'); if ( ! $report && ! $this->app['conf']->get(['registry', 'webservices', 'google-charts-enabled'])) { @@ -491,7 +491,7 @@ class record_preview extends record_adapter return $this->refferer_popularity; } - $report = $this->app['acl']->get($this->app['authentication']->getUser())->has_right_on_base( + $report = $this->app['acl']->get($this->app->getAuthenticatedUser())->has_right_on_base( $this->get_base_id(), 'canreport'); if ( ! $report && ! $this->app['conf']->get(['registry', 'webservices', 'google-charts-enabled'])) { @@ -564,7 +564,7 @@ class record_preview extends record_adapter return $this->download_popularity; } - $report = $this->app['acl']->get($this->app['authentication']->getUser())->has_right_on_base($this->get_base_id(), 'canreport'); + $report = $this->app['acl']->get($this->app->getAuthenticatedUser())->has_right_on_base($this->get_base_id(), 'canreport'); $ret = false; if ( ! $report && ! $this->app['conf']->get(['registry', 'webservices', 'google-charts-enabled'])) { diff --git a/lib/classes/set/export.php b/lib/classes/set/export.php index 3a258a5857..5e1c67b585 100644 --- a/lib/classes/set/export.php +++ b/lib/classes/set/export.php @@ -49,7 +49,7 @@ class set_export extends set_abstract if ($storyWZid) { $repository = $app['repo.story-wz']; - $storyWZ = $repository->findByUserAndId($this->app, $app['authentication']->getUser(), $storyWZid); + $storyWZ = $repository->findByUserAndId($this->app, $app->getAuthenticatedUser(), $storyWZid); $lst = $storyWZ->getRecord($this->app)->get_serialize_key(); } @@ -58,7 +58,7 @@ class set_export extends set_abstract $repository = $app['repo.baskets']; /* @var $repository Alchemy\Phrasea\Model\Repositories\BasketRepository */ - $Basket = $repository->findUserBasket($sstid, $app['authentication']->getUser(), false); + $Basket = $repository->findUserBasket($sstid, $app->getAuthenticatedUser(), false); $this->exportName = str_replace([' ', '\\', '/'], '_', $Basket->getName()) . "_" . date("Y-n-d"); foreach ($Basket->getElements() as $basket_element) { @@ -66,8 +66,8 @@ class set_export extends set_abstract $record_id = $basket_element->getRecord($this->app)->get_record_id(); if (!isset($remain_hd[$base_id])) { - if ($app['acl']->get($app['authentication']->getUser())->is_restricted_download($base_id)) { - $remain_hd[$base_id] = $app['acl']->get($app['authentication']->getUser())->remaining_download($base_id); + if ($app['acl']->get($app->getAuthenticatedUser())->is_restricted_download($base_id)) { + $remain_hd[$base_id] = $app['acl']->get($app->getAuthenticatedUser())->remaining_download($base_id); } else { $remain_hd[$base_id] = false; } @@ -106,8 +106,8 @@ class set_export extends set_abstract $record_id = $child_basrec->get_record_id(); if (!isset($remain_hd[$base_id])) { - if ($app['acl']->get($app['authentication']->getUser())->is_restricted_download($base_id)) { - $remain_hd[$base_id] = $app['acl']->get($app['authentication']->getUser())->remaining_download($base_id); + if ($app['acl']->get($app->getAuthenticatedUser())->is_restricted_download($base_id)) { + $remain_hd[$base_id] = $app['acl']->get($app->getAuthenticatedUser())->remaining_download($base_id); } else { $remain_hd[$base_id] = false; } @@ -129,8 +129,8 @@ class set_export extends set_abstract $record_id = $record->get_record_id(); if (!isset($remain_hd[$base_id])) { - if ($app['acl']->get($app['authentication']->getUser())->is_restricted_download($base_id)) { - $remain_hd[$base_id] = $app['acl']->get($app['authentication']->getUser())->remaining_download($base_id); + if ($app['acl']->get($app->getAuthenticatedUser())->is_restricted_download($base_id)) { + $remain_hd[$base_id] = $app['acl']->get($app->getAuthenticatedUser())->remaining_download($base_id); } else { $remain_hd[$base_id] = false; } @@ -164,7 +164,7 @@ class set_export extends set_abstract $this->businessFieldsAccess = false; foreach ($this->elements as $download_element) { - if ($app['acl']->get($app['authentication']->getUser())->has_right_on_base($download_element->get_base_id(), 'canmodifrecord')) { + if ($app['acl']->get($app->getAuthenticatedUser())->has_right_on_base($download_element->get_base_id(), 'canmodifrecord')) { $this->businessFieldsAccess = true; } @@ -216,11 +216,11 @@ class set_export extends set_abstract $display_ftp = []; - $hasadminright = $app['acl']->get($app['authentication']->getUser())->has_right('addrecord') - || $app['acl']->get($app['authentication']->getUser())->has_right('deleterecord') - || $app['acl']->get($app['authentication']->getUser())->has_right('modifyrecord') - || $app['acl']->get($app['authentication']->getUser())->has_right('coll_manage') - || $app['acl']->get($app['authentication']->getUser())->has_right('coll_modify_struct'); + $hasadminright = $app['acl']->get($app->getAuthenticatedUser())->has_right('addrecord') + || $app['acl']->get($app->getAuthenticatedUser())->has_right('deleterecord') + || $app['acl']->get($app->getAuthenticatedUser())->has_right('modifyrecord') + || $app['acl']->get($app->getAuthenticatedUser())->has_right('coll_manage') + || $app['acl']->get($app->getAuthenticatedUser())->has_right('coll_modify_struct'); $this->ftp_datas = []; @@ -228,7 +228,7 @@ class set_export extends set_abstract $display_ftp = $display_download; $this->total_ftp = $this->total_download; - $lst_base_id = array_keys($app['acl']->get($app['authentication']->getUser())->get_granted_base()); + $lst_base_id = array_keys($app['acl']->get($app->getAuthenticatedUser())->get_granted_base()); if ($hasadminright) { $sql = "SELECT Users.id AS usr_id ,Users.login AS usr_login ,Users.email AS usr_mail, FtpCredential.* @@ -258,7 +258,7 @@ class set_export extends set_abstract ) ) GROUP BY Users.id "; - $params = [':usr_id' => $app['authentication']->getUser()->getId()]; + $params = [':usr_id' => $app->getAuthenticatedUser()->getId()]; } $datas[] = [ @@ -272,7 +272,7 @@ class set_export extends set_abstract 'prefix_folder' => 'Export_' . date("Y-m-d_H.i.s"), 'passive' => false, 'max_retry' => 5, - 'sendermail' => $app['authentication']->getUser()->getEmail() + 'sendermail' => $app->getAuthenticatedUser()->getEmail() ]; $stmt = $app['phraseanet.appbox']->get_connection()->prepare($sql); @@ -296,7 +296,7 @@ class set_export extends set_abstract 'passive' => !! $row['passive'], 'max_retry' => $row['max_retry'], 'usr_mail' => $row['usr_mail'], - 'sender_mail' => $app['authentication']->getUser()->getEmail() + 'sender_mail' => $app->getAuthenticatedUser()->getEmail() ]; } @@ -631,7 +631,7 @@ class set_export extends set_abstract $files[$id]["export_name"] = $tmp_name; if (in_array('caption', $subdefs)) { - $caption_dir = $this->app['tmp.caption.path'].'/'.time().$this->app['authentication']->getUser()->getId().'/'; + $caption_dir = $this->app['tmp.caption.path'].'/'.time().$this->app->getAuthenticatedUser()->getId().'/'; $filesystem->mkdir($caption_dir, 0750); @@ -652,7 +652,7 @@ class set_export extends set_abstract } if (in_array('caption-yaml', $subdefs)) { - $caption_dir = $this->app['tmp.caption.path'].'/'.time().$this->app['authentication']->getUser()->getId().'/'; + $caption_dir = $this->app['tmp.caption.path'].'/'.time().$this->app->getAuthenticatedUser()->getId().'/'; $filesystem->mkdir($caption_dir, 0750); @@ -775,8 +775,8 @@ class set_export extends set_abstract $log["poids"] = $obj["size"]; $log["shortXml"] = $app['serializer.caption']->serialize($record_object->get_caption(), CaptionSerializer::SERIALIZE_XML); $tmplog[$record_object->get_base_id()][] = $log; - if (!$anonymous && $o == 'document' && null !== $app['authentication']->getUser()) { - $app['acl']->get($app['authentication']->getUser())->remove_remaining($record_object->get_base_id()); + if (!$anonymous && $o == 'document' && null !== $app->getAuthenticatedUser()) { + $app['acl']->get($app->getAuthenticatedUser())->remove_remaining($record_object->get_base_id()); } } @@ -786,7 +786,7 @@ class set_export extends set_abstract $list_base = array_unique(array_keys($tmplog)); - if (!$anonymous && null !== $app['authentication']->getUser()) { + if (!$anonymous && null !== $app->getAuthenticatedUser()) { $sql = "UPDATE basusr SET remain_dwnld = :remain_dl WHERE base_id = :base_id AND usr_id = :usr_id"; @@ -794,11 +794,11 @@ class set_export extends set_abstract $stmt = $app['phraseanet.appbox']->get_connection()->prepare($sql); foreach ($list_base as $base_id) { - if ($app['acl']->get($app['authentication']->getUser())->is_restricted_download($base_id)) { + if ($app['acl']->get($app->getAuthenticatedUser())->is_restricted_download($base_id)) { $params = [ - ':remain_dl' => $app['acl']->get($app['authentication']->getUser())->remaining_download($base_id) + ':remain_dl' => $app['acl']->get($app->getAuthenticatedUser())->remaining_download($base_id) , ':base_id' => $base_id - , ':usr_id' => $app['acl']->get($app['authentication']->getUser())->getId() + , ':usr_id' => $app['acl']->get($app->getAuthenticatedUser())->getId() ]; $stmt->execute($params); diff --git a/lib/classes/set/exportftp.php b/lib/classes/set/exportftp.php index 0539bedf41..0136dec37b 100644 --- a/lib/classes/set/exportftp.php +++ b/lib/classes/set/exportftp.php @@ -39,7 +39,7 @@ class set_exportftp extends set_export $text_mail_receiver = "Bonjour,\n" . "L'utilisateur " - . $this->app['authentication']->getUser()->getDisplayName() . " (login : " . $this->app['authentication']->getUser()->getLogin() . ") " + . $this->app->getAuthenticatedUser()->getDisplayName() . " (login : " . $this->app->getAuthenticatedUser()->getLogin() . ") " . "a fait un transfert FTP sur le serveur ayant comme adresse \"" . $host . "\" avec le login \"" . $login . "\" " . "et pour repertoire de destination \"" @@ -58,10 +58,10 @@ class set_exportftp extends set_export ->setMail($email_dest) ->setLogfile($logfile) ->setFoldertocreate($makedirectory) - ->setUser($this->app['authentication']->getUser()) + ->setUser($this->app->getAuthenticatedUser()) ->setTextMailSender($text_mail_sender) ->setTextMailReceiver($text_mail_receiver) - ->setSendermail($this->app['authentication']->getUser()->getEmail()) + ->setSendermail($this->app->getAuthenticatedUser()->getEmail()) ->setDestfolder($destfolder) ->setPassif($passif == '1') ->setPwd($password) diff --git a/lib/classes/set/selection.php b/lib/classes/set/selection.php index 1e44a5dfa6..09d88ca689 100644 --- a/lib/classes/set/selection.php +++ b/lib/classes/set/selection.php @@ -57,26 +57,26 @@ class set_selection extends set_abstract $sbas_id = $record->get_sbas_id(); $record_id = $record->get_record_id(); if (! $rights) { - if ($this->app['acl']->get($this->app['authentication']->getUser())->has_hd_grant($record)) { + if ($this->app['acl']->get($this->app->getAuthenticatedUser())->has_hd_grant($record)) { continue; } - if ($this->app['acl']->get($this->app['authentication']->getUser())->has_preview_grant($record)) { + if ($this->app['acl']->get($this->app->getAuthenticatedUser())->has_preview_grant($record)) { continue; } - if ( ! $this->app['acl']->get($this->app['authentication']->getUser())->has_access_to_base($base_id)) { + if ( ! $this->app['acl']->get($this->app->getAuthenticatedUser())->has_access_to_base($base_id)) { $to_remove[] = $id; continue; } } else { foreach ($rights as $right) { - if ( ! $this->app['acl']->get($this->app['authentication']->getUser())->has_right_on_base($base_id, $right)) { + if ( ! $this->app['acl']->get($this->app->getAuthenticatedUser())->has_right_on_base($base_id, $right)) { $to_remove[] = $id; continue; } } foreach ($sbas_rights as $right) { - if ( ! $this->app['acl']->get($this->app['authentication']->getUser())->has_right_on_sbas($sbas_id, $right)) { + if ( ! $this->app['acl']->get($this->app->getAuthenticatedUser())->has_right_on_sbas($sbas_id, $right)) { $to_remove[] = $id; continue; } @@ -88,8 +88,8 @@ class set_selection extends set_abstract $sql = 'SELECT record_id FROM record - WHERE ((status ^ ' . $this->app['acl']->get($this->app['authentication']->getUser())->get_mask_xor($base_id) . ') - & ' . $this->app['acl']->get($this->app['authentication']->getUser())->get_mask_and($base_id) . ')=0 + WHERE ((status ^ ' . $this->app['acl']->get($this->app->getAuthenticatedUser())->get_mask_xor($base_id) . ') + & ' . $this->app['acl']->get($this->app->getAuthenticatedUser())->get_mask_and($base_id) . ')=0 AND record_id = :record_id'; $stmt = $connsbas->prepare($sql); diff --git a/templates/mobile/api/auth/end_user_authorization.html.twig b/templates/mobile/api/auth/end_user_authorization.html.twig index c4f018345d..2c7a960632 100644 --- a/templates/mobile/api/auth/end_user_authorization.html.twig +++ b/templates/mobile/api/auth/end_user_authorization.html.twig @@ -33,7 +33,7 @@

{{home_title}}

- {% if not app['authentication'].isAuthenticated() %} + {% if not app.getAuthenticator().isAuthenticated() %}
{% for key,value in auth.getParams %} @@ -54,8 +54,8 @@

{% else %} - {% if app['authentication'].getUser() is not none %} - {% set username = '' ~ app['authentication'].getUser().getDisplayName() ~ '' %} + {% if app.getAuthenticatedUser() is not none %} + {% set username = '' ~ app.getAuthenticatedUser().getDisplayName() ~ '' %}

{% trans with {'%username%' : username} %}Hello %username%{% endtrans %} diff --git a/templates/mobile/api/auth/native_app_access_token.html.twig b/templates/mobile/api/auth/native_app_access_token.html.twig index 1f14e59fcd..4f2e3106d7 100644 --- a/templates/mobile/api/auth/native_app_access_token.html.twig +++ b/templates/mobile/api/auth/native_app_access_token.html.twig @@ -37,8 +37,8 @@

{{ app['conf'].get(['registry', 'general', 'title']) }}

- {% if app['authentication'].getUser() is not none %} - {% set username = '' ~ app['authentication'].getUser().getDisplayName() ~ '' %} + {% if app.getAuthenticatedUser() is not none %} + {% set username = '' ~ app.getAuthenticatedUser().getDisplayName() ~ '' %}

{% trans with {'%username%' : username} %}Hello %username%{% endtrans %} diff --git a/templates/mobile/lightbox/basket_element.html.twig b/templates/mobile/lightbox/basket_element.html.twig index a4dafe5794..7c97c69bbf 100644 --- a/templates/mobile/lightbox/basket_element.html.twig +++ b/templates/mobile/lightbox/basket_element.html.twig @@ -36,11 +36,11 @@

{{ thumbnail.format100percent(record.get_preview()) }} {% if basket_element.getBasket().getValidation() %} - {% if basket_element.getBasket().getValidation().getParticipant(app['authentication'].getUser()).getCanAgree() %} + {% if basket_element.getBasket().getValidation().getParticipant(app.getAuthenticatedUser()).getCanAgree() %}
- + - +
{% endif %} diff --git a/templates/mobile/lightbox/note_form.html.twig b/templates/mobile/lightbox/note_form.html.twig index 0cedce20d1..318a632d81 100644 --- a/templates/mobile/lightbox/note_form.html.twig +++ b/templates/mobile/lightbox/note_form.html.twig @@ -19,7 +19,7 @@ + {% if basket_element.getUserValidationDatas(app.getAuthenticatedUser()).getNote() == '' %}placeholder="Note"{% endif %}>{{basket_element.getUserValidationDatas(app.getAuthenticatedUser()).getNote()}} diff --git a/templates/mobile/lightbox/sc_note.html.twig b/templates/mobile/lightbox/sc_note.html.twig index 0114bd0b9d..7e41144d3f 100644 --- a/templates/mobile/lightbox/sc_note.html.twig +++ b/templates/mobile/lightbox/sc_note.html.twig @@ -1,5 +1,5 @@ {% for validationDatas in basket_element.getValidationDatas() %} - {% set is_mine = validationDatas.getParticipant().getUser().getId() == app['authentication'].getUser().getId() %} + {% set is_mine = validationDatas.getParticipant().getUser().getId() == app.getAuthenticatedUser().getId() %} {% if validationDatas.getNote() != '' or (validationDatas.getAgreement() is not null and is_mine) %}
  • diff --git a/templates/mobile/lightbox/validate.html.twig b/templates/mobile/lightbox/validate.html.twig index 5a6dc9463a..38019c8f0b 100644 --- a/templates/mobile/lightbox/validate.html.twig +++ b/templates/mobile/lightbox/validate.html.twig @@ -4,7 +4,7 @@ {% block javascript %} @@ -30,8 +30,8 @@
      {% for basket_element in basket.getElements() %}
    • - {% if basket_element.getBasket().getValidation() and basket_element.getBasket().getValidation().getParticipant(app['authentication'].getUser()).getCanAgree() %} -
      + {% if basket_element.getBasket().getValidation() and basket_element.getBasket().getValidation().getParticipant(app.getAuthenticatedUser()).getCanAgree() %} +
      {% endif %} @@ -43,7 +43,7 @@

  • - {% if basket.getValidation() and basket.getValidation().getParticipant(app['authentication'].getUser()).getCanAgree() %} + {% if basket.getValidation() and basket.getValidation().getParticipant(app.getAuthenticatedUser()).getCanAgree() %} {% endif%} - {% elseif app['acl'].get(app['authentication'].getUser()).has_right_on_base(bas_id, 'manage') %} + {% elseif app.getAclForUser(app.getAuthenticatedUser()).has_right_on_base(bas_id, 'manage') %} {{ 'admin::base:collection: aucun fichier (minilogo, watermark ...)' | trans }}
    @@ -168,7 +168,7 @@
    {{ "Watermark" | trans }}
    {% if collection.getWatermark(bas_id) is not empty %}
    {{ collection.getWatermark(bas_id)| raw }}
    - {% if app['acl'].get(app['authentication'].getUser()).has_right_on_base(bas_id, 'manage') %} + {% if app.getAclForUser(app.getAuthenticatedUser()).has_right_on_base(bas_id, 'manage') %} {% endif%} - {% elseif app['acl'].get(app['authentication'].getUser()).has_right_on_base(bas_id, 'manage') %} + {% elseif app.getAclForUser(app.getAuthenticatedUser()).has_right_on_base(bas_id, 'manage') %} {{ 'admin::base:collection: aucun fichier (minilogo, watermark ...)' | trans }}
    @@ -193,7 +193,7 @@
    {{ "Stamp logo" | trans }}
    {% if collection.getStamp(bas_id) is not empty %}
    {{ collection.getStamp(bas_id)| raw }}
    - {% if app['acl'].get(app['authentication'].getUser()).has_right_on_base(bas_id, 'manage') %} + {% if app.getAclForUser(app.getAuthenticatedUser()).has_right_on_base(bas_id, 'manage') %} {% endif%} - {% elseif app['acl'].get(app['authentication'].getUser()).has_right_on_base(bas_id, 'manage') %} + {% elseif app.getAclForUser(app.getAuthenticatedUser()).has_right_on_base(bas_id, 'manage') %} {{ 'admin::base:collection: aucun fichier (minilogo, watermark ...)' | trans }}
    diff --git a/templates/web/admin/collection/create.html.twig b/templates/web/admin/collection/create.html.twig index 07f696d8d5..36cdca68b0 100644 --- a/templates/web/admin/collection/create.html.twig +++ b/templates/web/admin/collection/create.html.twig @@ -32,10 +32,10 @@
    - {% if app['acl'].get(app['authentication'].getUser()).get_granted_base(["canadmin"]) | length > 0 %} + {% if app.getAclForUser(app.getAuthenticatedUser()).get_granted_base(["canadmin"]) | length > 0 %} diff --git a/templates/web/admin/connected-users.html.twig b/templates/web/admin/connected-users.html.twig index 5127129db3..17478b3dc9 100644 --- a/templates/web/admin/connected-users.html.twig +++ b/templates/web/admin/connected-users.html.twig @@ -24,7 +24,7 @@ {{ 'admin::monitor: bases sur lesquelles l\'utilisateur est connecte :' | trans }} : - {% for databox in app['acl'].get(user).get_granted_sbas() %} + {% for databox in app.getAclForUser(user).get_granted_sbas() %} {{ databox.get_label(app['locale']) }} diff --git a/templates/web/admin/databases.html.twig b/templates/web/admin/databases.html.twig index d1e6798221..4afb2a3d7f 100644 --- a/templates/web/admin/databases.html.twig +++ b/templates/web/admin/databases.html.twig @@ -43,7 +43,7 @@
    -{% if app['acl'].get(app['authentication'].getUser()).is_admin() %} +{% if app.getAclForUser(app.getAuthenticatedUser()).is_admin() %}

    {{ 'admin::base: Version' | trans }}

    diff --git a/templates/web/admin/databox/databox.html.twig b/templates/web/admin/databox/databox.html.twig index 4a1a6e362f..8419a177fd 100644 --- a/templates/web/admin/databox/databox.html.twig +++ b/templates/web/admin/databox/databox.html.twig @@ -30,7 +30,7 @@
  • {{ 'admin::base: Alias' | trans }} : {{ databox.get_label(app['locale']) }} - {% if app['acl'].get(app['authentication'].getUser()).has_right_on_sbas(databox.get_sbas_id(), "bas_manage") %} + {% if app.getAclForUser(app.getAuthenticatedUser()).has_right_on_sbas(databox.get_sbas_id(), "bas_manage") %}
  • -{% if app['acl'].get(app['authentication'].getUser()).has_right_on_sbas(databox.get_sbas_id(), "bas_manage") %} +{% if app.getAclForUser(app.getAuthenticatedUser()).has_right_on_sbas(databox.get_sbas_id(), "bas_manage") %}
    {% endif %} {% else %} - {% if class != 'checked' and type == 'base' and app['acl'].get(admin).has_right_on_base(id, name) is empty %} + {% if class != 'checked' and type == 'base' and app.getAclForUser(admin).has_right_on_base(id, name) is empty %}
    - {% elseif class != 'checked' and type == 'sbas' and app['acl'].get(admin).has_right_on_sbas(id, name) is empty %} + {% elseif class != 'checked' and type == 'sbas' and app.getAclForUser(admin).has_right_on_sbas(id, name) is empty %}
    {% else %} @@ -322,16 +322,16 @@
    - {{_self.format_checkbox(app['authentication'].getUser(), rights, 'bas_chupub', users, 'sbas')}} + {{_self.format_checkbox(app.getAuthenticatedUser(), rights, 'bas_chupub', users, 'sbas')}} - {{_self.format_checkbox(app['authentication'].getUser(), rights, 'bas_modif_th', users, 'sbas')}} + {{_self.format_checkbox(app.getAuthenticatedUser(), rights, 'bas_modif_th', users, 'sbas')}} - {{_self.format_checkbox(app['authentication'].getUser(), rights, 'bas_manage', users, 'sbas')}} + {{_self.format_checkbox(app.getAuthenticatedUser(), rights, 'bas_manage', users, 'sbas')}} - {{_self.format_checkbox(app['authentication'].getUser(), rights, 'bas_modify_struct', users, 'sbas')}} + {{_self.format_checkbox(app.getAuthenticatedUser(), rights, 'bas_modify_struct', users, 'sbas')}} @@ -341,25 +341,25 @@ {{rights['base_id']|bas_labels(app)}} - {{_self.format_checkbox(app['authentication'].getUser(), rights, 'access', users, 'base')}} + {{_self.format_checkbox(app.getAuthenticatedUser(), rights, 'access', users, 'base')}} - {{_self.format_checkbox(app['authentication'].getUser(), rights, 'actif', users, 'base')}} + {{_self.format_checkbox(app.getAuthenticatedUser(), rights, 'actif', users, 'base')}} - {{_self.format_checkbox(app['authentication'].getUser(), rights, 'canputinalbum', users, 'base')}} + {{_self.format_checkbox(app.getAuthenticatedUser(), rights, 'canputinalbum', users, 'base')}} - {{_self.format_checkbox(app['authentication'].getUser(), rights, 'candwnldpreview', users, 'base')}} + {{_self.format_checkbox(app.getAuthenticatedUser(), rights, 'candwnldpreview', users, 'base')}} - {{_self.format_checkbox(app['authentication'].getUser(), rights, 'nowatermark', users, 'base')}} + {{_self.format_checkbox(app.getAuthenticatedUser(), rights, 'nowatermark', users, 'base')}} - {{_self.format_checkbox(app['authentication'].getUser(), rights, 'candwnldhd', users, 'base')}} + {{_self.format_checkbox(app.getAuthenticatedUser(), rights, 'candwnldhd', users, 'base')}} - {{_self.format_checkbox(app['authentication'].getUser(), rights, 'cancmd', users, 'base')}} + {{_self.format_checkbox(app.getAuthenticatedUser(), rights, 'cancmd', users, 'base')}}
    @@ -395,34 +395,34 @@ - {{_self.format_checkbox(app['authentication'].getUser(), rights, 'canaddrecord', users, 'base')}} + {{_self.format_checkbox(app.getAuthenticatedUser(), rights, 'canaddrecord', users, 'base')}} - {{_self.format_checkbox(app['authentication'].getUser(), rights, 'canmodifrecord', users, 'base')}} + {{_self.format_checkbox(app.getAuthenticatedUser(), rights, 'canmodifrecord', users, 'base')}} - {{_self.format_checkbox(app['authentication'].getUser(), rights, 'chgstatus', users, 'base')}} + {{_self.format_checkbox(app.getAuthenticatedUser(), rights, 'chgstatus', users, 'base')}} - {{_self.format_checkbox(app['authentication'].getUser(), rights, 'candeleterecord', users, 'base')}} + {{_self.format_checkbox(app.getAuthenticatedUser(), rights, 'candeleterecord', users, 'base')}} - {{_self.format_checkbox(app['authentication'].getUser(), rights, 'imgtools', users, 'base')}} + {{_self.format_checkbox(app.getAuthenticatedUser(), rights, 'imgtools', users, 'base')}} - {{_self.format_checkbox(app['authentication'].getUser(), rights, 'canadmin', users, 'base')}} + {{_self.format_checkbox(app.getAuthenticatedUser(), rights, 'canadmin', users, 'base')}} - {{_self.format_checkbox(app['authentication'].getUser(), rights, 'canreport', users, 'base')}} + {{_self.format_checkbox(app.getAuthenticatedUser(), rights, 'canreport', users, 'base')}} - {{_self.format_checkbox(app['authentication'].getUser(), rights, 'canpush', users, 'base')}} + {{_self.format_checkbox(app.getAuthenticatedUser(), rights, 'canpush', users, 'base')}} - {{_self.format_checkbox(app['authentication'].getUser(), rights, 'manage', users, 'base')}} + {{_self.format_checkbox(app.getAuthenticatedUser(), rights, 'manage', users, 'base')}} - {{_self.format_checkbox(app['authentication'].getUser(), rights, 'modify_struct', users, 'base')}} + {{_self.format_checkbox(app.getAuthenticatedUser(), rights, 'modify_struct', users, 'base')}} diff --git a/templates/web/admin/index.html.twig b/templates/web/admin/index.html.twig index 0969a4f937..a43f2fe9f6 100644 --- a/templates/web/admin/index.html.twig +++ b/templates/web/admin/index.html.twig @@ -58,7 +58,7 @@ {% endblock %} {% block content %} -
    +
    diff --git a/templates/web/admin/publications/fiche.html.twig b/templates/web/admin/publications/fiche.html.twig index b3f950d723..131ceb4d66 100644 --- a/templates/web/admin/publications/fiche.html.twig +++ b/templates/web/admin/publications/fiche.html.twig @@ -6,7 +6,7 @@ {% if error %}
    {{ error }}
    {% endif %} - {% if feed.isOwner(app['authentication'].getUser()) %} + {% if feed.isOwner(app.getAuthenticatedUser()) %}

    {{ 'Edition' | trans }}

    @@ -101,7 +101,7 @@
    - {% for databox in app['acl'].get(app['authentication'].getUser()).get_granted_sbas('bas_chupub') %} + {% for databox in app.getAclForUser(app.getAuthenticatedUser()).get_granted_sbas('bas_chupub') %} {% for collection in databox.get_collections() %} @@ -90,7 +90,7 @@ {% endif %} - {% if feed.isOwner(app['authentication'].getUser()) %} + {% if feed.isOwner(app.getAuthenticatedUser()) %} diff --git a/templates/web/admin/tree.html.twig b/templates/web/admin/tree.html.twig index 977e167187..884da5578a 100644 --- a/templates/web/admin/tree.html.twig +++ b/templates/web/admin/tree.html.twig @@ -2,7 +2,7 @@
    - {% if not app['authentication'].isAuthenticated() %} + {% if not app.getAuthenticator().isAuthenticated() %}
    {% for key,value in auth.getParams %} @@ -56,7 +56,7 @@
    {% else %} {% if user is not none %} - {% set username = '' ~ app['authentication'].getUser().getDisplayName() ~ '' %} + {% set username = '' ~ app.getAuthenticatedUser().getDisplayName() ~ '' %}

    {{ app['conf'].get(['registry', 'general', 'title']) }}

    - {% if app['authentication'].getUser() is not none %} - {% set username = '' ~ app['authentication'].getUser().getDisplayName() ~ '' %} + {% if app.getAuthenticatedUser() is not none %} + {% set username = '' ~ app.getAuthenticatedUser().getDisplayName() ~ '' %}
    - {% if total_baskets > 0 and (app['acl'].get(app['authentication'].getUser()).has_right("candwnldhd") or app['acl'].get(app['authentication'].getUser()).has_right("candwnldpreview") or app['acl'].get(app['authentication'].getUser()).has_right("cancmd") > 0) %} + {% if total_baskets > 0 and (app.getAclForUser(app.getAuthenticatedUser()).has_right("candwnldhd") or app.getAclForUser(app.getAuthenticatedUser()).has_right("candwnldpreview") or app.getAclForUser(app.getAuthenticatedUser()).has_right("cancmd") > 0) %}
    {% endif %} @@ -113,10 +113,10 @@ onclick="evt_del_in_chutier({{ element.getId() }});" title="{{ 'action : supprimer' | trans }}">
    - {% if app['acl'].get(app['authentication'].getUser()).has_right_on_base(record.get_base_id(), 'candwnldhd') - or app['acl'].get(app['authentication'].getUser()).has_right_on_base(record.get_base_id(), 'candwnldpreview') - or app['acl'].get(app['authentication'].getUser()).has_right_on_base(record.get_base_id(), 'cancmd') - or app['acl'].get(app['authentication'].getUser()).has_preview_grant(record) %} + {% if app.getAclForUser(app.getAuthenticatedUser()).has_right_on_base(record.get_base_id(), 'candwnldhd') + or app.getAclForUser(app.getAuthenticatedUser()).has_right_on_base(record.get_base_id(), 'candwnldpreview') + or app.getAclForUser(app.getAuthenticatedUser()).has_right_on_base(record.get_base_id(), 'cancmd') + or app.getAclForUser(app.getAuthenticatedUser()).has_preview_grant(record) %}
    {% endif %}
    diff --git a/templates/web/client/index.html.twig b/templates/web/client/index.html.twig index dc99e89678..3b01ca5224 100644 --- a/templates/web/client/index.html.twig +++ b/templates/web/client/index.html.twig @@ -461,7 +461,7 @@ dataType: 'json', data: { app : 2, - usr : {{ app['authentication'].getUser().getId() }} + usr : {{ app.getAuthenticatedUser().getId() }} }, error: function(){ window.setTimeout("pollNotifications();", 10000); diff --git a/templates/web/common/HTML5Video.html.twig b/templates/web/common/HTML5Video.html.twig index 2ac4377d14..dd48d28c0f 100644 --- a/templates/web/common/HTML5Video.html.twig +++ b/templates/web/common/HTML5Video.html.twig @@ -20,7 +20,7 @@ {% set s_width = subdef.get_width() %} {% set s_height = subdef.get_height() %} {% endif %} - {% if app['authentication'].isAuthenticated() == true %} + {% if app.getAuthenticator().isAuthenticated() == true %} {% set url = subdef.get_url() %} {% else %} {% set url = subdef.get_permalink().get_url() %} diff --git a/templates/web/common/dialog_export.html.twig b/templates/web/common/dialog_export.html.twig index 1e1740dca5..71011cd739 100644 --- a/templates/web/common/dialog_export.html.twig +++ b/templates/web/common/dialog_export.html.twig @@ -78,7 +78,7 @@
    {% endmacro %} -{% if app['conf'].get(['registry', 'actions', 'auth-required-for-export']) and app['authentication'].getUser().isGuest() %} +{% if app['conf'].get(['registry', 'actions', 'auth-required-for-export']) and app.getAuthenticatedUser().isGuest() %} {% endblock %} diff --git a/templates/web/prod/Story/Create.html.twig b/templates/web/prod/Story/Create.html.twig index c22fafb4a4..0e72228fd5 100644 --- a/templates/web/prod/Story/Create.html.twig +++ b/templates/web/prod/Story/Create.html.twig @@ -2,7 +2,7 @@ diff --git a/templates/web/prod/Tooltip/User.html.twig b/templates/web/prod/Tooltip/User.html.twig index 00d814f107..e3a6f54678 100644 --- a/templates/web/prod/Tooltip/User.html.twig +++ b/templates/web/prod/Tooltip/User.html.twig @@ -1,7 +1,7 @@ {% extends 'prod/Tooltip/Tooltip.html.twig' %} {% set title %} - app['authentication'].getUser().getDisplayName() + app.getAuthenticatedUser().getDisplayName() {% endset %} {% set width = 300 %} {% set maxwidth = null %} @@ -12,12 +12,12 @@
    -

    {{ app['authentication'].getUser().getDisplayName() }}

    +

    {{ app.getAuthenticatedUser().getDisplayName() }}

      -
    • {{ app['authentication'].getUser().getEmail() }}
    • -
    • {{ app['authentication'].getUser().getCompany() }}
    • -
    • {{ app['authentication'].getUser().getJob() }}
    • -
    • {{ app['authentication'].getUser().getActivity() }}
    • +
    • {{ app.getAuthenticatedUser().getEmail() }}
    • +
    • {{ app.getAuthenticatedUser().getCompany() }}
    • +
    • {{ app.getAuthenticatedUser().getJob() }}
    • +
    • {{ app.getAuthenticatedUser().getActivity() }}
    diff --git a/templates/web/prod/WorkZone/Basket.html.twig b/templates/web/prod/WorkZone/Basket.html.twig index 266e810f60..78090606c5 100644 --- a/templates/web/prod/WorkZone/Basket.html.twig +++ b/templates/web/prod/WorkZone/Basket.html.twig @@ -11,36 +11,36 @@ - {% if app['acl'].get(app['authentication'].getUser()).has_right('modifyrecord') %} + {% if app.getAclForUser(app.getAuthenticatedUser()).has_right('modifyrecord') %} {% endif %} - {% if app['acl'].get(app['authentication'].getUser()).has_right('changestatus') %} + {% if app.getAclForUser(app.getAuthenticatedUser()).has_right('changestatus') %} {% endif %} - {% if app['acl'].get(app['authentication'].getUser()).has_right('deleterecord') and app['acl'].get(app['authentication'].getUser()).has_right('addrecord') %} + {% if app.getAclForUser(app.getAuthenticatedUser()).has_right('deleterecord') and app.getAclForUser(app.getAuthenticatedUser()).has_right('addrecord') %} {% endif %} - {% if app['acl'].get(app['authentication'].getUser()).has_right('push') %} + {% if app.getAclForUser(app.getAuthenticatedUser()).has_right('push') %} {% endif %} - {% if app['acl'].get(app['authentication'].getUser()).has_right('push') %} + {% if app.getAclForUser(app.getAuthenticatedUser()).has_right('push') %} {% endif %} - {% if app['acl'].get(app['authentication'].getUser()).has_right('bas_chupub') %} + {% if app.getAclForUser(app.getAuthenticatedUser()).has_right('bas_chupub') %} @@ -49,7 +49,7 @@ {% endif %} - {% if app['acl'].get(app['authentication'].getUser()).has_right('doctools') %} + {% if app.getAclForUser(app.getAuthenticatedUser()).has_right('doctools') %} diff --git a/templates/web/prod/WorkZone/Browser/Basket.html.twig b/templates/web/prod/WorkZone/Browser/Basket.html.twig index 834a5602f2..a056305bf7 100644 --- a/templates/web/prod/WorkZone/Browser/Basket.html.twig +++ b/templates/web/prod/WorkZone/Browser/Basket.html.twig @@ -11,7 +11,7 @@

    - {% if Basket.getValidation() is empty or Basket.getValidation().isInitiator(app['authentication'].getUser()) %} + {% if Basket.getValidation() is empty or Basket.getValidation().isInitiator(app.getAuthenticatedUser()) %} diff --git a/templates/web/prod/WorkZone/Browser/Results.html.twig b/templates/web/prod/WorkZone/Browser/Results.html.twig index fdcd3f9f98..6ced50f002 100644 --- a/templates/web/prod/WorkZone/Browser/Results.html.twig +++ b/templates/web/prod/WorkZone/Browser/Results.html.twig @@ -50,7 +50,7 @@

    - {% if Basket.getValidation() is empty or Basket.getValidation().isInitiator(app['authentication'].getUser()) %} + {% if Basket.getValidation() is empty or Basket.getValidation().isInitiator(app.getAuthenticatedUser()) %} diff --git a/templates/web/prod/WorkZone/Macros.html.twig b/templates/web/prod/WorkZone/Macros.html.twig index e47b199579..a1e63b2dae 100644 --- a/templates/web/prod/WorkZone/Macros.html.twig +++ b/templates/web/prod/WorkZone/Macros.html.twig @@ -48,7 +48,7 @@ onclick="downloadThis('ssel={{basket.getId()}}');">{{ 'action::exporter' | trans }}

    - {% if app['acl'].get(app['authentication'].getUser()).has_right('modifyrecord') %} + {% if app.getAclForUser(app.getAuthenticatedUser()).has_right('modifyrecord') %} - {% if app['acl'].get(app['authentication'].getUser()).has_right('modifyrecord') %} + {% if app.getAclForUser(app.getAuthenticatedUser()).has_right('modifyrecord') %}