diff --git a/lib/Alchemy/Phrasea/Application.php b/lib/Alchemy/Phrasea/Application.php index 4d8e721ba2..7920b641bf 100644 --- a/lib/Alchemy/Phrasea/Application.php +++ b/lib/Alchemy/Phrasea/Application.php @@ -780,7 +780,7 @@ class Application extends SilexApplication */ public function isGuestAllowed() { - if (null === $user = $this['manipulator.user']->getRepository()->findByLogin(User::USER_GUEST)) { + if (null === $user = $this['repo.users']->findByLogin(User::USER_GUEST)) { return false; } diff --git a/lib/Alchemy/Phrasea/Authentication/AccountCreator.php b/lib/Alchemy/Phrasea/Authentication/AccountCreator.php index baa59a1a23..a0e8a323a3 100644 --- a/lib/Alchemy/Phrasea/Authentication/AccountCreator.php +++ b/lib/Alchemy/Phrasea/Authentication/AccountCreator.php @@ -71,11 +71,11 @@ class AccountCreator $login = $id; $n = 1; - if (null !== $email && null !== $app['manipulator.user']->getRepository()->findByEmail($email)) { + if (null !== $email && null !== $app['repo.users']->findByEmail($email)) { throw new InvalidArgumentException('Provided email already exist in account base.'); } - while (null !== $app['manipulator.user']->getRepository()->findByLogin($login)) { + while (null !== $app['repo.users']->findByLogin($login)) { $login = $id . '#' . $n; $n++; } diff --git a/lib/Alchemy/Phrasea/Authentication/Authenticator.php b/lib/Alchemy/Phrasea/Authentication/Authenticator.php index 3cafbc0bb9..33510e639f 100644 --- a/lib/Alchemy/Phrasea/Authentication/Authenticator.php +++ b/lib/Alchemy/Phrasea/Authentication/Authenticator.php @@ -143,7 +143,7 @@ class Authenticator public function reinitUser() { if ($this->isAuthenticated()) { - $this->user = $this->app['manipulator.user']->getRepository()->find($this->session->get('usr_id')); + $this->user = $this->app['repo.users']->find($this->session->get('usr_id')); } else { $this->user = null; } diff --git a/lib/Alchemy/Phrasea/Command/CreateCollection.php b/lib/Alchemy/Phrasea/Command/CreateCollection.php index 320c98f5cd..e69e59a406 100644 --- a/lib/Alchemy/Phrasea/Command/CreateCollection.php +++ b/lib/Alchemy/Phrasea/Command/CreateCollection.php @@ -60,7 +60,7 @@ class CreateCollection extends Command } $app = $this->container; - $this->container['manipulator.acl']->resetAdminRights($this->container['manipulator.user']->getRepository()->findAdmins()); + $this->container['manipulator.acl']->resetAdminRights($this->container['repo.users']->findAdmins()); $this->container['dispatcher']->dispatch(PhraseaEvents::COLLECTION_CREATE, new CollectionCreateEvent($new_collection)); } diff --git a/lib/Alchemy/Phrasea/Command/Developer/RegenerateSqliteDb.php b/lib/Alchemy/Phrasea/Command/Developer/RegenerateSqliteDb.php index 591b9b7f7c..e4c45ccf19 100644 --- a/lib/Alchemy/Phrasea/Command/Developer/RegenerateSqliteDb.php +++ b/lib/Alchemy/Phrasea/Command/Developer/RegenerateSqliteDb.php @@ -335,7 +335,7 @@ class RegenerateSqliteDb extends Command private function getUser() { - if (null === $user = $this->container['manipulator.user']->getRepository()->findByLogin('test_phpunit')) { + if (null === $user = $this->container['repo.users']->findByLogin('test_phpunit')) { $user = $this->container['manipulator.user']->createUser('test_phpunit', \random::generatePassword(), 'noone@example.com', true); } @@ -344,7 +344,7 @@ class RegenerateSqliteDb extends Command private function getUserAlt1() { - if (null === $user = $this->container['manipulator.user']->getRepository()->findByLogin('test_phpunit_alt1')) { + if (null === $user = $this->container['repo.users']->findByLogin('test_phpunit_alt1')) { $user = $this->container['manipulator.user']->createUser('test_phpunit_alt1', \random::generatePassword(), 'noonealt1@example.com', false); } @@ -353,7 +353,7 @@ class RegenerateSqliteDb extends Command private function getUserAlt2() { - if (null === $user = $this->container['manipulator.user']->getRepository()->findByLogin('test_phpunit_alt2')) { + if (null === $user = $this->container['repo.users']->findByLogin('test_phpunit_alt2')) { $user = $this->container['manipulator.user']->createUser('test_phpunit_alt2', \random::generatePassword(), 'noonealt2@example.com', false); } @@ -362,7 +362,7 @@ class RegenerateSqliteDb extends Command public function getUserNotAdmin() { - if (null === $user = $this->container['manipulator.user']->getRepository()->findByLogin('test_phpunit_not_admin')) { + if (null === $user = $this->container['repo.users']->findByLogin('test_phpunit_not_admin')) { $user = $this->container['manipulator.user']->createUser('test_phpunit_not_admin', \random::generatePassword(), 'noone_not_admin@example.com', false); } @@ -371,7 +371,7 @@ class RegenerateSqliteDb extends Command public function getUserGuest() { - if (null === $user = $this->container['manipulator.user']->getRepository()->findByLogin(User::USER_GUEST)) { + if (null === $user = $this->container['repo.users']->findByLogin(User::USER_GUEST)) { $user = $this->container['manipulator.user']->createUser(User::USER_GUEST, User::USER_GUEST); } diff --git a/lib/Alchemy/Phrasea/Controller/Admin/Collection.php b/lib/Alchemy/Phrasea/Controller/Admin/Collection.php index f6a3dc3792..09469e9045 100644 --- a/lib/Alchemy/Phrasea/Controller/Admin/Collection.php +++ b/lib/Alchemy/Phrasea/Controller/Admin/Collection.php @@ -187,7 +187,7 @@ class Collection implements ControllerProviderInterface } $admins = array_map(function ($usrId) use ($app) { - if (null === $user = $app['manipulator.user']->getRepository()->find($usrId)) { + if (null === $user = $app['repo.users']->find($usrId)) { throw new RuntimeException(sprintf('Invalid usrId %s provided.', $usrId)); } diff --git a/lib/Alchemy/Phrasea/Controller/Admin/Dashboard.php b/lib/Alchemy/Phrasea/Controller/Admin/Dashboard.php index b3d4c5060b..cb604fa485 100644 --- a/lib/Alchemy/Phrasea/Controller/Admin/Dashboard.php +++ b/lib/Alchemy/Phrasea/Controller/Admin/Dashboard.php @@ -70,7 +70,7 @@ class Dashboard implements ControllerProviderInterface $parameters = [ 'cache_flushed' => $request->query->get('flush_cache') === 'ok', - 'admins' => $app['manipulator.user']->getRepository()->findAdmins(), + 'admins' => $app['repo.users']->findAdmins(), 'email_status' => $emailStatus, ]; @@ -133,7 +133,7 @@ class Dashboard implements ControllerProviderInterface */ public function resetAdminRights(Application $app, Request $request) { - $app['manipulator.acl']->resetAdminRights($app['manipulator.user']->getRepository()->findAdmins()); + $app['manipulator.acl']->resetAdminRights($app['repo.users']->findAdmins()); return $app->redirectPath('admin_dashbord'); } @@ -156,7 +156,7 @@ class Dashboard implements ControllerProviderInterface } $admins = array_map(function ($usrId) use ($app) { - if (null === $user = $app['manipulator.user']->getRepository()->find($usrId)) { + if (null === $user = $app['repo.users']->find($usrId)) { throw new RuntimeException(sprintf('Invalid usrId %s provided.', $usrId)); } diff --git a/lib/Alchemy/Phrasea/Controller/Admin/Publications.php b/lib/Alchemy/Phrasea/Controller/Admin/Publications.php index 9a20c361a3..ca97fa7fc7 100644 --- a/lib/Alchemy/Phrasea/Controller/Admin/Publications.php +++ b/lib/Alchemy/Phrasea/Controller/Admin/Publications.php @@ -193,7 +193,7 @@ class Publications implements ControllerProviderInterface $error = ''; try { $request = $app['request']; - $user = $app['manipulator.user']->getRepository()->find($request->request->get('usr_id')); + $user = $app['repo.users']->find($request->request->get('usr_id')); $feed = $app["EM"]->find('Phraseanet:Feed', $id); $publisher = new FeedPublisher(); diff --git a/lib/Alchemy/Phrasea/Controller/Admin/Users.php b/lib/Alchemy/Phrasea/Controller/Admin/Users.php index 47b882328a..6b4db74bdb 100644 --- a/lib/Alchemy/Phrasea/Controller/Admin/Users.php +++ b/lib/Alchemy/Phrasea/Controller/Admin/Users.php @@ -356,7 +356,7 @@ class Users implements ControllerProviderInterface $controllers->get('/registrations/', function (Application $app) { $app['manipulator.registration']->deleteOldRegistrations(); - $models = $app['manipulator.user']->getRepository()->findTemplateOwner($app['authentication']->getUser()); + $models = $app['repo.users']->findTemplateOwner($app['authentication']->getUser()); $userRegistrations = []; foreach ($app['manipulator.registration']->getRepository()->getUserRegistrations( @@ -422,12 +422,12 @@ class Users implements ControllerProviderInterface $cacheToUpdate = $done = []; foreach ($templates as $usr => $template_id) { - if (null === $user = $app['manipulator.user']->getRepository()->find($usr)) { + if (null === $user = $app['repo.users']->find($usr)) { $app->abort(400, srpintf("User with id % in provided in 'template' request variable could not be found", $usr)); } $cacheToUpdate[$usr] = $user; - $user_template = $app['manipulator.user']->getRepository()->find($template_id); + $user_template = $app['repo.users']->find($template_id); $collections = $app['acl']->get($user_template)->get_granted_base(); $baseIds = array_keys($collections); @@ -441,7 +441,7 @@ class Users implements ControllerProviderInterface } foreach ($deny as $usr => $bases) { - if (null === $user = $app['manipulator.user']->getRepository()->find($usr)) { + if (null === $user = $app['repo.users']->find($usr)) { $app->abort(400, srpintf("User with id % in provided in 'deny' request variable could not be found", $usr)); } $cacheToUpdate[$usr] = $user; @@ -457,7 +457,7 @@ class Users implements ControllerProviderInterface } foreach ($accept as $usr => $bases) { - if (null === $user = $app['manipulator.user']->getRepository()->find($usr)) { + if (null === $user = $app['repo.users']->find($usr)) { $app->abort(400, srpintf("User with id % in provided in 'accept' request variable could not be found", $usr)); } $cacheToUpdate[$usr] = $user; @@ -482,7 +482,7 @@ class Users implements ControllerProviderInterface unset ($cacheToUpdate); foreach ($done as $usr => $bases) { - $user = $app['manipulator.user']->getRepository()->find($usr); + $user = $app['repo.users']->find($usr); $acceptColl = $denyColl = []; foreach ($bases as $bas => $isok) { @@ -599,7 +599,7 @@ class Users implements ControllerProviderInterface } elseif (in_array($loginToAdd, $loginNew)) { $out['errors'][] = $app->trans("Login %login% is already defined in the file at line %line%", ['%login%' => $loginToAdd, '%line%' => $nbLine]); } else { - if (null !== $app['manipulator.user']->getRepository()->findByLogin($loginToAdd)) { + if (null !== $app['repo.users']->findByLogin($loginToAdd)) { $out['errors'][] = $app->trans("Login %login% already exists in database", ['%login%' => $loginToAdd]); } else { $loginValid = true; @@ -612,7 +612,7 @@ class Users implements ControllerProviderInterface if ($mailToAdd === "") { $out['errors'][] = $app->trans("Mail line %line% is empty", ['%line%' => $nbLine + 1]); - } elseif (null !== $app['manipulator.user']->getRepository()->findByEmail($mailToAdd)) { + } elseif (null !== $app['repo.users']->findByEmail($mailToAdd)) { $out['errors'][] = $app->trans("Email '%email%' for login '%login%' already exists in database", ['%email%' => $mailToAdd, '%login%' => $loginToAdd]); } else { $mailValid = true; @@ -727,8 +727,8 @@ class Users implements ControllerProviderInterface if (isset($curUser['usr_login']) && trim($curUser['usr_login']) !== '' && isset($curUser['usr_password']) && trim($curUser['usr_password']) !== '' && isset($curUser['usr_mail']) && trim($curUser['usr_mail']) !== '') { - if (null === $app['manipulator.user']->getRepository()->findByLogin($curUser['usr_login']) - && false === $app['manipulator.user']->getRepository()->findByEmail($curUser['usr_mail'])) { + if (null === $app['repo.users']->findByLogin($curUser['usr_login']) + && false === $app['repo.users']->findByEmail($curUser['usr_mail'])) { $newUser = $app['manipulator.user']->createUser($curUser['usr_login'], $curUser['usr_password'], $curUser['usr_mail']); @@ -782,7 +782,7 @@ class Users implements ControllerProviderInterface } $app['acl']->get($newUser)->apply_model( - $app['manipulator.user']->getRepository()->find($model), array_keys($app['acl']->get($app['authentication']->getUser())->get_granted_base(['manage'])) + $app['repo.users']->find($model), array_keys($app['acl']->get($app['authentication']->getUser())->get_granted_base(['manage'])) ); $nbCreation++; diff --git a/lib/Alchemy/Phrasea/Controller/Api/Oauth2.php b/lib/Alchemy/Phrasea/Controller/Api/Oauth2.php index fe8692cd49..522f736626 100644 --- a/lib/Alchemy/Phrasea/Controller/Api/Oauth2.php +++ b/lib/Alchemy/Phrasea/Controller/Api/Oauth2.php @@ -91,7 +91,7 @@ class Oauth2 implements ControllerProviderInterface return $app->redirectPath('oauth2_authorize', ['error' => 'account-locked']); } - $app['authentication']->openAccount($app['manipulator.user']->getRepository()->find($usr_id)); + $app['authentication']->openAccount($app['repo.users']->find($usr_id)); } return new Response($app['twig']->render($template, ["auth" => $oauth2_adapter])); diff --git a/lib/Alchemy/Phrasea/Controller/Api/V1.php b/lib/Alchemy/Phrasea/Controller/Api/V1.php index 6b998834f2..17119cb068 100644 --- a/lib/Alchemy/Phrasea/Controller/Api/V1.php +++ b/lib/Alchemy/Phrasea/Controller/Api/V1.php @@ -274,7 +274,7 @@ class V1 implements ControllerProviderInterface { $ret = array_map(function (Task $task) use ($app) { return $this->list_task($app, $task); - }, $app['manipulator.task']->getRepository()->findAll()); + }, $app['repo.tasks']->findAll()); return Result::create($request, ['tasks' => $ret])->createResponse(); } @@ -786,7 +786,7 @@ class V1 implements ControllerProviderInterface $lazaretFiles = []; if (count($baseIds) > 0) { - $lazaretRepository = $app['EM']->getRepository('Phraseanet:LazaretFile'); + $lazaretRepository = $app['repo.lazaret-files']; $lazaretFiles = iterator_to_array($lazaretRepository->findPerPage($baseIds, $offset_start, $per_page)); } @@ -1201,7 +1201,7 @@ class V1 implements ControllerProviderInterface */ private function list_baskets(Application $app) { - $repo = $app['EM']->getRepository('Phraseanet:Basket'); + $repo = $app['repo.baskets']; /* @var $repo BasketRepository */ return array_map(function (Basket $basket) use ($app) { @@ -1375,7 +1375,7 @@ class V1 implements ControllerProviderInterface public function search_publications(Application $app, Request $request) { $user = $app['authentication']->getUser(); - $coll = $app['EM']->getRepository('Phraseanet:Feed')->getAllForUser($app['acl']->get($user)); + $coll = $app['repo.feeds']->getAllForUser($app['acl']->get($user)); $datas = array_map(function ($feed) use ($user) { return $this->list_publication($feed, $user); @@ -1395,7 +1395,7 @@ class V1 implements ControllerProviderInterface public function get_publication(Application $app, Request $request, $feed_id) { $user = $app['authentication']->getUser(); - $feed = $app['EM']->getRepository('Phraseanet:Feed')->find($feed_id); + $feed = $app['repo.feeds']->find($feed_id); if (!$feed->isAccessible($user, $app)) { return Result::create($request, [])->createResponse(); @@ -1439,7 +1439,7 @@ class V1 implements ControllerProviderInterface public function get_feed_entry(Application $app, Request $request, $entry_id) { $user = $app['authentication']->getUser(); - $entry = $app['EM']->getRepository('Phraseanet:FeedEntry')->find($entry_id); + $entry = $app['repo.feed-entries']->find($entry_id); $collection = $entry->getFeed()->getCollection($app); if (null !== $collection && !$app['acl']->get($user)->has_access_to_base($collection->get_base_id())) { @@ -1970,7 +1970,7 @@ class V1 implements ControllerProviderInterface return Result::createError($request, 403, 'The use of Office Plugin is not allowed.')->createResponse(); } - $user = $app['manipulator.user']->getRepository()->find($oauth2_adapter->get_usr_id()); + $user = $app['repo.users']->find($oauth2_adapter->get_usr_id()); $app['authentication']->openAccount($user); $oauth2_adapter->remember_this_ses_id($app['session']->get('session_id')); $app['dispatcher']->dispatch(PhraseaEvents::API_OAUTH2_END, new ApiOAuth2EndEvent()); diff --git a/lib/Alchemy/Phrasea/Controller/Lightbox.php b/lib/Alchemy/Phrasea/Controller/Lightbox.php index e198cda1ce..67dd6f1032 100644 --- a/lib/Alchemy/Phrasea/Controller/Lightbox.php +++ b/lib/Alchemy/Phrasea/Controller/Lightbox.php @@ -44,7 +44,7 @@ class Lightbox implements ControllerProviderInterface return $app->redirectPath('homepage'); } - $app['authentication']->openAccount($app['manipulator.user']->getRepository()->find($usr_id)); + $app['authentication']->openAccount($app['repo.users']->find($usr_id)); try { $datas = $app['tokens']->helloToken($request->query->get('LOG')); diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Push.php b/lib/Alchemy/Phrasea/Controller/Prod/Push.php index c249d73bef..b3cd531d57 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/Push.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/Push.php @@ -177,7 +177,7 @@ class Push implements ControllerProviderInterface foreach ($receivers as $receiver) { try { - $user_receiver = $app['manipulator.user']->getRepository()->find($receiver['usr_id']); + $user_receiver = $app['repo.users']->find($receiver['usr_id']); } catch (\Exception $e) { throw new ControllerException($app->trans('Unknown user %user_id%', ['%user_id%' => $receiver['usr_id']])); } @@ -358,7 +358,7 @@ class Push implements ControllerProviderInterface } try { - $participant_user = $app['manipulator.user']->getRepository()->find($participant['usr_id']); + $participant_user = $app['repo.users']->find($participant['usr_id']); } catch (\Exception $e) { throw new ControllerException($app->trans('Unknown user %usr_id%', ['%usr_id%' => $participant['usr_id']])); } @@ -532,7 +532,7 @@ class Push implements ControllerProviderInterface $email = $request->request->get('email'); try { - $user = $app['manipulator.user']->getRepository()->findByEmail($email); + $user = $app['repo.users']->findByEmail($email); $result['message'] = $app->trans('User already exists'); $result['success'] = true; @@ -545,7 +545,7 @@ class Push implements ControllerProviderInterface try { $password = \random::generatePassword(); - $user = $app['manipulator.user']->getRepository()->createUser($email, $password, $email); + $user = $app['repo.users']->createUser($email, $password, $email); $user->setFirstName($request->request->get('firstname')) ->setLastName($request->request->get('lastname')); diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Tooltip.php b/lib/Alchemy/Phrasea/Controller/Prod/Tooltip.php index aff22b4728..ff06b8c1b3 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/Tooltip.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/Tooltip.php @@ -89,7 +89,7 @@ class Tooltip implements ControllerProviderInterface public function displayUserBadge(Application $app, $usr_id) { - $user = $app['manipulator.user']->getRepository()->find($usr_id); + $user = $app['repo.users']->find($usr_id); return $app['twig']->render( 'prod/Tooltip/User.html.twig' diff --git a/lib/Alchemy/Phrasea/Controller/Prod/UsrLists.php b/lib/Alchemy/Phrasea/Controller/Prod/UsrLists.php index 78e32df93a..77b1dbfc27 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/UsrLists.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/UsrLists.php @@ -370,7 +370,7 @@ class UsrLists implements ControllerProviderInterface $inserted_usr_ids = []; foreach ($request->request->get('usr_ids') as $usr_id) { - $user_entry = $app['manipulator.user']->getRepository()->find($usr_id); + $user_entry = $app['repo.users']->find($usr_id); if ($list->has($user_entry)) continue; @@ -461,7 +461,7 @@ class UsrLists implements ControllerProviderInterface throw new ControllerException($app->trans('You are not authorized to do this')); } - $new_owner = $app['manipulator.user']->getRepository()->find($usr_id); + $new_owner = $app['repo.users']->find($usr_id); if ($list->hasAccess($new_owner)) { if ($new_owner->getId() == $app['authentication']->getUser()->getId()) { diff --git a/lib/Alchemy/Phrasea/Controller/Root/Account.php b/lib/Alchemy/Phrasea/Controller/Root/Account.php index 9135575be3..a72b992caf 100644 --- a/lib/Alchemy/Phrasea/Controller/Root/Account.php +++ b/lib/Alchemy/Phrasea/Controller/Root/Account.php @@ -173,7 +173,7 @@ class Account implements ControllerProviderInterface if (null !== $token = $request->query->get('token')) { try { $datas = $app['tokens']->helloToken($token); - $user = $app['manipulator.user']->getRepository()->find((int) $datas['usr_id']); + $user = $app['repo.users']->find((int) $datas['usr_id']); $user->setEmail($datas['datas']); $app['tokens']->removeToken($token); diff --git a/lib/Alchemy/Phrasea/Controller/Root/Login.php b/lib/Alchemy/Phrasea/Controller/Root/Login.php index 9969c2ffc8..6a04fddafc 100644 --- a/lib/Alchemy/Phrasea/Controller/Root/Login.php +++ b/lib/Alchemy/Phrasea/Controller/Root/Login.php @@ -387,7 +387,7 @@ class Login implements ControllerProviderInterface $registrationsOK = []; if ($app['conf']->get(['registry', 'registration', 'auto-register-enabled'])) { - $template_user = $app['manipulator.user']->getRepository()->findByLogin(User::USER_AUTOREGISTER); + $template_user = $app['repo.users']->findByLogin(User::USER_AUTOREGISTER); $app['acl']->get($user)->apply_model($template_user, array_keys($inscOK)); } @@ -476,7 +476,7 @@ class Login implements ControllerProviderInterface $app->abort(400, 'Missing usr_id parameter.'); } - if (null === $user = $app['manipulator.user']->getRepository()->find((int) $usrId)) { + if (null === $user = $app['repo.users']->find((int) $usrId)) { $app->addFlash('error', $app->trans('Invalid link.')); return $app->redirectPath('homepage'); @@ -539,7 +539,7 @@ class Login implements ControllerProviderInterface return $app->redirectPath('homepage'); } - if (null === $user = $app['manipulator.user']->getRepository()->find((int) $datas['usr_id'])) { + if (null === $user = $app['repo.users']->find((int) $datas['usr_id'])) { $app->addFlash('error', _('Invalid unlock link.')); return $app->redirectPath('homepage'); @@ -602,7 +602,7 @@ class Login implements ControllerProviderInterface $datas = $app['tokens']->helloToken($token); - $user = $app['manipulator.user']->getRepository()->find($datas['usr_id']); + $user = $app['repo.users']->find($datas['usr_id']); $app['manipulator.user']->setPassword($user, $data['password']); $app['tokens']->removeToken($token); @@ -640,7 +640,7 @@ class Login implements ControllerProviderInterface if ($form->isValid()) { $data = $form->getData(); - if (null === $user = $app['manipulator.user']->getRepository()->findByEmail($data['email'])) { + if (null === $user = $app['repo.users']->findByEmail($data['email'])) { throw new FormProcessingException(_('phraseanet::erreur: Le compte n\'a pas ete trouve')); } @@ -785,7 +785,7 @@ class Login implements ControllerProviderInterface $app['dispatcher']->dispatch(PhraseaEvents::PRE_AUTHENTICATE, new PreAuthenticate($request, $context)); $user = $app['manipulator.user']->createUser(uniqid('guest'), \random::generatePassword(24)); - $invite_user = $app['manipulator.user']->getRepository()->findByLogin(User::USER_GUEST); + $invite_user = $app['repo.users']->findByLogin(User::USER_GUEST); $usr_base_ids = array_keys($app['acl']->get($user)->get_granted_base()); $app['acl']->get($user)->revoke_access_from_bases($usr_base_ids); @@ -1021,7 +1021,7 @@ class Login implements ControllerProviderInterface throw new AuthenticationException(call_user_func($redirector, $params)); } - $user = $app['manipulator.user']->getRepository()->find($usr_id); + $user = $app['repo.users']->find($usr_id); $session = $this->postAuthProcess($app, $user); diff --git a/lib/Alchemy/Phrasea/Core/Provider/AuthenticationManagerServiceProvider.php b/lib/Alchemy/Phrasea/Core/Provider/AuthenticationManagerServiceProvider.php index ff01ca97e6..2008549513 100644 --- a/lib/Alchemy/Phrasea/Core/Provider/AuthenticationManagerServiceProvider.php +++ b/lib/Alchemy/Phrasea/Core/Provider/AuthenticationManagerServiceProvider.php @@ -45,7 +45,7 @@ class AuthenticationManagerServiceProvider implements ServiceProviderInterface }); $app['authentication.suggestion-finder'] = $app->share(function (Application $app) { - return new SuggestionFinder($app['manipulator.user']->getRepository()); + return new SuggestionFinder($app['repo.users']); }); $app['authentication.providers.factory'] = $app->share(function (Application $app) { @@ -57,11 +57,11 @@ class AuthenticationManagerServiceProvider implements ServiceProviderInterface $templates = array_filter(array_map(function ($templateId) use ($app) { try { if (is_int($templateId) || ctype_digit($templateId)) { - return $app['manipulator.user']->getRepository()->find($templateId); + return $app['repo.users']->find($templateId); } if (false !== $templateId) { - return $app['manipulator.user']->getRepository()->find($templateId); + return $app['repo.users']->find($templateId); } } catch (\Exception $e) { diff --git a/lib/Alchemy/Phrasea/Core/Provider/ORMServiceProvider.php b/lib/Alchemy/Phrasea/Core/Provider/ORMServiceProvider.php index 0985d294de..00a279d280 100644 --- a/lib/Alchemy/Phrasea/Core/Provider/ORMServiceProvider.php +++ b/lib/Alchemy/Phrasea/Core/Provider/ORMServiceProvider.php @@ -183,6 +183,10 @@ class ORMServiceProvider implements ServiceProviderInterface $app['EM.native-query'] = $app->share(function ($app) { return new NativeQueryProvider($app['EM']); }); + + $app['repo.users'] = $app->share(function (PhraseaApplication $app) { + return $app['EM']->getRepository('Phraseanet:User'); + }); } public function boot(Application $app) diff --git a/lib/Alchemy/Phrasea/Form/Constraint/NewEmail.php b/lib/Alchemy/Phrasea/Form/Constraint/NewEmail.php index 7a903708b6..a6cfc01318 100644 --- a/lib/Alchemy/Phrasea/Form/Constraint/NewEmail.php +++ b/lib/Alchemy/Phrasea/Form/Constraint/NewEmail.php @@ -33,6 +33,6 @@ class NewEmail extends Constraint public static function create(Application $app) { - return new static($app['manipulator.user']->getRepository()); + return new static($app['repo.users']); } } diff --git a/lib/Alchemy/Phrasea/Form/Constraint/NewLogin.php b/lib/Alchemy/Phrasea/Form/Constraint/NewLogin.php index 1d77801fee..781cb90235 100644 --- a/lib/Alchemy/Phrasea/Form/Constraint/NewLogin.php +++ b/lib/Alchemy/Phrasea/Form/Constraint/NewLogin.php @@ -33,6 +33,6 @@ class NewLogin extends Constraint public static function create(Application $app) { - return new static($app['manipulator.user']->getRepository()); + return new static($app['repo.users']); } } diff --git a/lib/Alchemy/Phrasea/Helper/User/Edit.php b/lib/Alchemy/Phrasea/Helper/User/Edit.php index a66ef6b4ec..8990473b87 100644 --- a/lib/Alchemy/Phrasea/Helper/User/Edit.php +++ b/lib/Alchemy/Phrasea/Helper/User/Edit.php @@ -64,7 +64,7 @@ class Edit extends \Alchemy\Phrasea\Helper\Helper if ($this->app['authentication']->getUser()->getId() === (int) $usr_id) { continue; } - $user = $this->app['manipulator.user']->getRepository()->find($usr_id); + $user = $this->app['repo.users']->find($usr_id); $this->delete_user($user); } @@ -181,7 +181,7 @@ class Edit extends \Alchemy\Phrasea\Helper\Helper if (count($this->users) == 1) { $usr_id = array_pop($this->users); - $out['main_user'] = $this->app['manipulator.user']->getRepository()->find($usr_id); + $out['main_user'] = $this->app['repo.users']->find($usr_id); } return $out; @@ -532,7 +532,7 @@ class Edit extends \Alchemy\Phrasea\Helper\Helper try { $this->app['phraseanet.appbox']->get_connection()->beginTransaction(); - $user = $this->app['manipulator.user']->getRepository()->find($usr_id); + $user = $this->app['repo.users']->find($usr_id); $this->app['acl']->get($user)->revoke_access_from_bases($delete) ->give_access_to_base($create) @@ -567,7 +567,7 @@ class Edit extends \Alchemy\Phrasea\Helper\Helper $users = $this->users; - $user = $this->app['manipulator.user']->getRepository()->find(array_pop($users)); + $user = $this->app['repo.users']->find(array_pop($users)); if ($user->isTemplate() || $user->isSpecial()) { return $this; @@ -642,7 +642,7 @@ class Edit extends \Alchemy\Phrasea\Helper\Helper public function apply_template() { - $template = $this->app['manipulator.user']->getRepository()->find($this->request->get('template')); + $template = $this->app['repo.users']->find($this->request->get('template')); if (null === $template->getTemplateOwner() || $template->getTemplateOwner()->getId() !== $this->app['authentication']->getUser()->getId()) { throw new AccessDeniedHttpException('You are not the owner of the template'); @@ -651,7 +651,7 @@ class Edit extends \Alchemy\Phrasea\Helper\Helper $base_ids = array_keys($this->app['acl']->get($this->app['authentication']->getUser())->get_granted_base(['canadmin'])); foreach ($this->users as $usr_id) { - $user = $this->app['manipulator.user']->getRepository()->find($usr_id); + $user = $this->app['repo.users']->find($usr_id); if ($user->isTemplate()) { continue; @@ -668,7 +668,7 @@ class Edit extends \Alchemy\Phrasea\Helper\Helper $this->base_id = (int) $this->request->get('base_id'); foreach ($this->users as $usr_id) { - $user = $this->app['manipulator.user']->getRepository()->find($usr_id); + $user = $this->app['repo.users']->find($usr_id); if ($this->request->get('quota')) $this->app['acl']->get($user)->set_quotas_on_base($this->base_id, $this->request->get('droits'), $this->request->get('restes')); else @@ -689,7 +689,7 @@ class Edit extends \Alchemy\Phrasea\Helper\Helper if ($vand_and && $vand_or && $vxor_and && $vxor_or) { foreach ($this->users as $usr_id) { - $user = $this->app['manipulator.user']->getRepository()->find($usr_id); + $user = $this->app['repo.users']->find($usr_id); $this->app['acl']->get($user)->set_masks_on_base($this->base_id, $vand_and, $vand_or, $vxor_and, $vxor_or); } @@ -711,7 +711,7 @@ class Edit extends \Alchemy\Phrasea\Helper\Helper $base_ids = array_keys($this->app['acl']->get($this->app['authentication']->getUser())->get_granted_base(['canadmin'])); foreach ($this->users as $usr_id) { - $user = $this->app['manipulator.user']->getRepository()->find($usr_id); + $user = $this->app['repo.users']->find($usr_id); if ($this->base_id > 0) { $this->app['acl']->get($user)->set_limits($this->base_id, $activate, $dmin, $dmax); @@ -730,7 +730,7 @@ class Edit extends \Alchemy\Phrasea\Helper\Helper $base_ids = array_keys($this->app['acl']->get($this->app['authentication']->getUser())->get_granted_base(['canadmin'])); foreach ($this->users as $usr_id) { - $user = $this->app['manipulator.user']->getRepository()->find($usr_id); + $user = $this->app['repo.users']->find($usr_id); $ACL = $this->app['acl']->get($user); if ($user->isTemplate()) { diff --git a/lib/Alchemy/Phrasea/Helper/User/Manage.php b/lib/Alchemy/Phrasea/Helper/User/Manage.php index bdbad630b7..b99bd0325c 100644 --- a/lib/Alchemy/Phrasea/Helper/User/Manage.php +++ b/lib/Alchemy/Phrasea/Helper/User/Manage.php @@ -111,11 +111,11 @@ class Manage extends Helper ->limit($offset_start, $results_quantity) ->execute(); - if (null === $invite = $this->app['manipulator.user']->getRepository()->findByLogin(User::USER_GUEST)) { + if (null === $invite = $this->app['repo.users']->findByLogin(User::USER_GUEST)) { $invite = $this->app['manipulator.user']->createUser(User::USER_GUEST, User::USER_GUEST); } - if (null == $autoregister = $this->app['manipulator.user']->getRepository()->findByLogin(User::USER_AUTOREGISTER)) { + if (null == $autoregister = $this->app['repo.users']->findByLogin(User::USER_AUTOREGISTER)) { $autoregister = $this->app['manipulator.user']->createUser(User::USER_AUTOREGISTER, User::USER_AUTOREGISTER); } @@ -146,7 +146,7 @@ class Manage extends Helper throw new \Exception_InvalidArgument('Invalid mail address'); } - if (null === $createdUser = $this->app['manipulator.user']->getRepository()->findByEmail($email)) { + if (null === $createdUser = $this->app['repo.users']->findByEmail($email)) { $sendCredentials = !!$this->request->get('send_credentials', false); $validateMail = !!$this->request->get('validate_mail', false); @@ -197,7 +197,7 @@ class Manage extends Helper throw new \Exception_InvalidArgument('Invalid template name'); } - $created_user = $this->app['manipulator.user']->getRepository()->find($name, \random::generatePassword(16)); + $created_user = $this->app['repo.users']->find($name, \random::generatePassword(16)); $created_user->setTemplateOwner($this->app['authentication']->getUser()); $this->usr_id = $this->app['authentication']->getUser()->getId(); diff --git a/lib/Alchemy/Phrasea/SearchEngine/Phrasea/PhraseaEngineSubscriber.php b/lib/Alchemy/Phrasea/SearchEngine/Phrasea/PhraseaEngineSubscriber.php index 0f49bb180d..1b627be423 100644 --- a/lib/Alchemy/Phrasea/SearchEngine/Phrasea/PhraseaEngineSubscriber.php +++ b/lib/Alchemy/Phrasea/SearchEngine/Phrasea/PhraseaEngineSubscriber.php @@ -48,7 +48,7 @@ class PhraseaEngineSubscriber implements EventSubscriberInterface $initialized = false; foreach ($rows as $row) { - $user = $this->app['manipulator.user']->getRepository()->find($row['usr_id']); + $user = $this->app['repo.users']->find($row['usr_id']); $this->app['acl']->get($user)->inject_rights(); if (null !== $row['session_id']) { if (!$initialized) { diff --git a/lib/Alchemy/Phrasea/Vocabulary/ControlProvider/UserProvider.php b/lib/Alchemy/Phrasea/Vocabulary/ControlProvider/UserProvider.php index e9dfe3e400..17db8c19a7 100644 --- a/lib/Alchemy/Phrasea/Vocabulary/ControlProvider/UserProvider.php +++ b/lib/Alchemy/Phrasea/Vocabulary/ControlProvider/UserProvider.php @@ -82,7 +82,7 @@ class UserProvider implements ControlProviderInterface */ public function validate($id) { - return (Boolean) $this->app['manipulator.user']->getRepository()->find($id); + return (Boolean) $this->app['repo.users']->find($id); } /** @@ -92,7 +92,7 @@ class UserProvider implements ControlProviderInterface */ public function getValue($id) { - $user = $this->app['manipulator.user']->getRepository()->find($id); + $user = $this->app['repo.users']->find($id); if (null === $user) { throw new \Exception('User unknown'); @@ -108,6 +108,6 @@ class UserProvider implements ControlProviderInterface */ public function getRessource($id) { - return $this->app['manipulator.user']->getRepository()->find($id); + return $this->app['repo.users']->find($id); } } diff --git a/lib/classes/API/OAuth2/Account.php b/lib/classes/API/OAuth2/Account.php index c20ae3d263..b38bffa05e 100644 --- a/lib/classes/API/OAuth2/Account.php +++ b/lib/classes/API/OAuth2/Account.php @@ -84,7 +84,7 @@ class API_OAuth2_Account $stmt->closeCursor(); $this->application_id = (int) $row['application_id']; - $this->user = $app['manipulator.user']->getRepository()->find($row['usr_id']); + $this->user = $app['repo.users']->find($row['usr_id']); $this->api_version = $row['api_version']; $this->revoked = ! ! $row['revoked']; diff --git a/lib/classes/API/OAuth2/Adapter.php b/lib/classes/API/OAuth2/Adapter.php index 6a2bda20e7..71fcb719a6 100644 --- a/lib/classes/API/OAuth2/Adapter.php +++ b/lib/classes/API/OAuth2/Adapter.php @@ -521,7 +521,7 @@ class API_OAuth2_Adapter extends OAuth2 */ private function createAccount($usr_id) { - $user = $this->app['manipulator.user']->getRepository()->find($usr_id); + $user = $this->app['repo.users']->find($usr_id); return API_OAuth2_Account::create($this->app, $user, $this->client); } @@ -794,7 +794,7 @@ class API_OAuth2_Adapter extends OAuth2 return false; } - if (null === $user = $this->app['manipulator.user']->getRepository()->find($usr_id)) { + if (null === $user = $this->app['repo.users']->find($usr_id)) { return false; } diff --git a/lib/classes/API/OAuth2/Application.php b/lib/classes/API/OAuth2/Application.php index 59e60c1e46..26af702f4a 100644 --- a/lib/classes/API/OAuth2/Application.php +++ b/lib/classes/API/OAuth2/Application.php @@ -146,7 +146,7 @@ class API_OAuth2_Application $row = $stmt->fetch(PDO::FETCH_ASSOC); $stmt->closeCursor(); - $this->creator = ! $row['creator'] ? null : $this->app['manipulator.user']->getRepository()->find($row['creator']); + $this->creator = ! $row['creator'] ? null : $this->app['repo.users']->find($row['creator']); $this->type = $row['type']; $this->name = $row['name']; $this->description = $row['description']; diff --git a/lib/classes/Bridge/Account.php b/lib/classes/Bridge/Account.php index 8035596148..ac0548d620 100644 --- a/lib/classes/Bridge/Account.php +++ b/lib/classes/Bridge/Account.php @@ -95,7 +95,7 @@ class Bridge_Account throw new Bridge_Exception_AccountNotFound('Account Not Found'); $this->dist_id = $row['dist_id']; - $this->user = $this->app['manipulator.user']->getRepository()->find($row['usr_id']); + $this->user = $this->app['repo.users']->find($row['usr_id']); $this->name = $row['name']; $this->updated_on = new DateTime($row['updated_on']); $this->created_on = new DateTime($row['created_on']); diff --git a/lib/classes/User/Query.php b/lib/classes/User/Query.php index 72e4c8cfba..34a427aadb 100644 --- a/lib/classes/User/Query.php +++ b/lib/classes/User/Query.php @@ -512,7 +512,7 @@ class User_Query implements User_QueryInterface $users = new ArrayCollection(); foreach ($rs as $row) { - $users[] = $this->app['manipulator.user']->getRepository()->find($row['id']); + $users[] = $this->app['repo.users']->find($row['id']); } $this->results = $users; diff --git a/lib/classes/eventsmanager/notify/autoregister.php b/lib/classes/eventsmanager/notify/autoregister.php index 3f9720c633..8a409d8544 100644 --- a/lib/classes/eventsmanager/notify/autoregister.php +++ b/lib/classes/eventsmanager/notify/autoregister.php @@ -89,7 +89,7 @@ class eventsmanager_notify_autoregister extends eventsmanager_notifyAbstract $datas = $dom_xml->saveXml(); - if (null === $registered_user = $this->app['manipulator.user']->getRepository()->find($params['usr_id'])) { + if (null === $registered_user = $this->app['repo.users']->find($params['usr_id'])) { return; } @@ -98,7 +98,7 @@ class eventsmanager_notify_autoregister extends eventsmanager_notifyAbstract $mailed = false; if ($this->shouldSendNotificationFor($usr_id)) { - if (null === $admin_user = $this->app['manipulator.user']->getRepository()->find($usr_id)) { + if (null === $admin_user = $this->app['repo.users']->find($usr_id)) { continue; } @@ -124,7 +124,7 @@ class eventsmanager_notify_autoregister extends eventsmanager_notifyAbstract $usr_id = (string) $sx->usr_id; - if (null === $user = $this->app['manipulator.user']->getRepository()->find($usr_id)) { + if (null === $user = $this->app['repo.users']->find($usr_id)) { return []; } @@ -197,7 +197,7 @@ class eventsmanager_notify_autoregister extends eventsmanager_notifyAbstract return false; } - if (null === $user = $this->app['manipulator.user']->getRepository()->find($usr_id)) { + if (null === $user = $this->app['repo.users']->find($usr_id)) { return false; } diff --git a/lib/classes/eventsmanager/notify/bridgeuploadfail.php b/lib/classes/eventsmanager/notify/bridgeuploadfail.php index ccfd61979a..bd8245141e 100644 --- a/lib/classes/eventsmanager/notify/bridgeuploadfail.php +++ b/lib/classes/eventsmanager/notify/bridgeuploadfail.php @@ -79,7 +79,7 @@ class eventsmanager_notify_bridgeuploadfail extends eventsmanager_notifyAbstract $readyToSend = false; try { - $user = $this->app['manipulator.user']->getRepository()->find($params['usr_id']); + $user = $this->app['repo.users']->find($params['usr_id']); $account = Bridge_Account::load_account($this->app, $params['account_id']); $receiver = Receiver::fromUser($user); $readyToSend = true; diff --git a/lib/classes/eventsmanager/notify/order.php b/lib/classes/eventsmanager/notify/order.php index 9c1700ee09..5561e4027b 100644 --- a/lib/classes/eventsmanager/notify/order.php +++ b/lib/classes/eventsmanager/notify/order.php @@ -92,7 +92,7 @@ class eventsmanager_notify_order extends eventsmanager_notifyAbstract $datas = $dom_xml->saveXml(); - if (null === $orderInitiator = $this->app['manipulator.user']->getRepository()->find($params['usr_id'])) { + if (null === $orderInitiator = $this->app['repo.users']->find($params['usr_id'])) { return; } @@ -136,7 +136,7 @@ class eventsmanager_notify_order extends eventsmanager_notifyAbstract $usr_id = (string) $sx->usr_id; $order_id = (string) $sx->order_id; - if (null === $user = $this->app['manipulator.user']->getRepository()->find($usr_id)) { + if (null === $user = $this->app['repo.users']->find($usr_id)) { return []; } @@ -178,7 +178,7 @@ class eventsmanager_notify_order extends eventsmanager_notifyAbstract */ public function is_available($usr_id) { - if (null === $user = $this->app['manipulator.user']->getRepository()->find($usr_id)) { + if (null === $user = $this->app['repo.users']->find($usr_id)) { return false; } diff --git a/lib/classes/eventsmanager/notify/orderdeliver.php b/lib/classes/eventsmanager/notify/orderdeliver.php index 580e052112..95632f556d 100644 --- a/lib/classes/eventsmanager/notify/orderdeliver.php +++ b/lib/classes/eventsmanager/notify/orderdeliver.php @@ -92,8 +92,8 @@ class eventsmanager_notify_orderdeliver extends eventsmanager_notifyAbstract if ($this->shouldSendNotificationFor($params['to'])) { $readyToSend = false; try { - $user_from = $this->app['manipulator.user']->getRepository()->find($params['from']); - $user_to = $this->app['manipulator.user']->getRepository()->find($params['to']); + $user_from = $this->app['repo.users']->find($params['from']); + $user_to = $this->app['repo.users']->find($params['to']); $receiver = Receiver::fromUser($user_to); $emitter = Emitter::fromUser($user_from); @@ -144,7 +144,7 @@ class eventsmanager_notify_orderdeliver extends eventsmanager_notifyAbstract $ssel_id = (string) $sx->ssel_id; $n = (int) $sx->n; - if (null === $user= $this->app['manipulator.user']->getRepository()->find(($from))) { + if (null === $user= $this->app['repo.users']->find(($from))) { return []; } diff --git a/lib/classes/eventsmanager/notify/ordernotdelivered.php b/lib/classes/eventsmanager/notify/ordernotdelivered.php index 5c88ea52ad..fbe510d232 100644 --- a/lib/classes/eventsmanager/notify/ordernotdelivered.php +++ b/lib/classes/eventsmanager/notify/ordernotdelivered.php @@ -75,8 +75,8 @@ class eventsmanager_notify_ordernotdelivered extends eventsmanager_notifyAbstrac $readyToSend = false; try { - $user_from = $this->app['manipulator.user']->getRepository()->find($params['from']); - $user_to = $this->app['manipulator.user']->getRepository()->find($params['to']); + $user_from = $this->app['repo.users']->find($params['from']); + $user_to = $this->app['repo.users']->find($params['to']); $receiver = Receiver::fromUser($user_to); $emitter = Emitter::fromUser($user_from); @@ -107,7 +107,7 @@ class eventsmanager_notify_ordernotdelivered extends eventsmanager_notifyAbstrac $from = (string) $sx->from; $n = (int) $sx->n; - if (null === $user = $this->app['manipulator.user']->getRepository()->find($from)) { + if (null === $user = $this->app['repo.users']->find($from)) { return []; } diff --git a/lib/classes/eventsmanager/notify/push.php b/lib/classes/eventsmanager/notify/push.php index a9faa1ea28..540e0673fe 100644 --- a/lib/classes/eventsmanager/notify/push.php +++ b/lib/classes/eventsmanager/notify/push.php @@ -83,8 +83,8 @@ class eventsmanager_notify_push extends eventsmanager_notifyAbstract $repository = $this->app['EM']->getRepository('Phraseanet:Basket'); $basket = $repository->find($params['ssel_id']); - $user_from = $this->app['manipulator.user']->getRepository()->find($params['from']); - $user_to = $this->app['manipulator.user']->getRepository()->find($params['to']); + $user_from = $this->app['repo.users']->find($params['from']); + $user_to = $this->app['repo.users']->find($params['to']); $receiver = Receiver::fromUser($user_to); $emitter = Emitter::fromUser($user_from); @@ -119,7 +119,7 @@ class eventsmanager_notify_push extends eventsmanager_notifyAbstract $from = (string) $sx->from; - if (null === $user = $this->app['manipulator.user']->getRepository()->find($from)) { + if (null === $user = $this->app['repo.users']->find($from)) { return []; } diff --git a/lib/classes/eventsmanager/notify/register.php b/lib/classes/eventsmanager/notify/register.php index f686d30e16..70a209f4d2 100644 --- a/lib/classes/eventsmanager/notify/register.php +++ b/lib/classes/eventsmanager/notify/register.php @@ -89,7 +89,7 @@ class eventsmanager_notify_register extends eventsmanager_notifyAbstract $datas = $dom_xml->saveXml(); - if (null === $registeredUser = $this->app['manipulator.user']->getRepository()->find($params['usr_id'])) { + if (null === $registeredUser = $this->app['repo.users']->find($params['usr_id'])) { return; } @@ -99,7 +99,7 @@ class eventsmanager_notify_register extends eventsmanager_notifyAbstract if ($this->shouldSendNotificationFor($usr_id)) { $readyToSend = false; try { - $admin_user = $this->app['manipulator.user']->getRepository()->find($usr_id); + $admin_user = $this->app['repo.users']->find($usr_id); $receiver = Receiver::fromUser($admin_user); $readyToSend = true; } catch (\Exception $e) { @@ -134,7 +134,7 @@ class eventsmanager_notify_register extends eventsmanager_notifyAbstract $usr_id = (string) $sx->usr_id; - if (null === $user = $this->app['manipulator.user']->getRepository()->find($usr_id)) { + if (null === $user = $this->app['repo.users']->find($usr_id)) { return []; } @@ -177,7 +177,7 @@ class eventsmanager_notify_register extends eventsmanager_notifyAbstract return false; } - if (null === $user = $this->app['manipulator.user']->getRepository()->find($usr_id)) { + if (null === $user = $this->app['repo.users']->find($usr_id)) { return false; } diff --git a/lib/classes/eventsmanager/notify/uploadquarantine.php b/lib/classes/eventsmanager/notify/uploadquarantine.php index a5d2ea32bd..e9e5c5b1c5 100644 --- a/lib/classes/eventsmanager/notify/uploadquarantine.php +++ b/lib/classes/eventsmanager/notify/uploadquarantine.php @@ -183,7 +183,7 @@ class eventsmanager_notify_uploadquarantine extends eventsmanager_notifyAbstract */ public function is_available($usr_id) { - if (null === $user = $this->app['manipulator.user']->getRepository()->find($usr_id)) { + if (null === $user = $this->app['repo.users']->find($usr_id)) { return false; } diff --git a/lib/classes/eventsmanager/notify/validate.php b/lib/classes/eventsmanager/notify/validate.php index 2433f494bd..2b1c072a3d 100644 --- a/lib/classes/eventsmanager/notify/validate.php +++ b/lib/classes/eventsmanager/notify/validate.php @@ -93,8 +93,8 @@ class eventsmanager_notify_validate extends eventsmanager_notifyAbstract $readyToSend = false; try { - $user_from = $this->app['manipulator.user']->getRepository()->find($params['from']); - $user_to = $this->app['manipulator.user']->getRepository()->find($params['to']); + $user_from = $this->app['repo.users']->find($params['from']); + $user_to = $this->app['repo.users']->find($params['to']); $basket = $this->app['EM'] ->getRepository('Phraseanet:Basket') @@ -137,7 +137,7 @@ class eventsmanager_notify_validate extends eventsmanager_notifyAbstract $from = (string) $sx->from; $ssel_id = (string) $sx->ssel_id; - if (null === $user = $this->app['manipulator.user']->getRepository()->find($from)) { + if (null === $user = $this->app['repo.users']->find($from)) { return []; } diff --git a/lib/classes/eventsmanager/notify/validationdone.php b/lib/classes/eventsmanager/notify/validationdone.php index 91c84e3d8e..07951beb5b 100644 --- a/lib/classes/eventsmanager/notify/validationdone.php +++ b/lib/classes/eventsmanager/notify/validationdone.php @@ -88,8 +88,8 @@ class eventsmanager_notify_validationdone extends eventsmanager_notifyAbstract if ($this->shouldSendNotificationFor($params['to'])) { $readyToSend = false; try { - $user_from = $this->app['manipulator.user']->getRepository()->find($params['from']); - $user_to = $this->app['manipulator.user']->getRepository()->find($params['to']); + $user_from = $this->app['repo.users']->find($params['from']); + $user_to = $this->app['repo.users']->find($params['to']); $basket = $this->app['EM'] ->getRepository('Phraseanet:Basket') @@ -131,7 +131,7 @@ class eventsmanager_notify_validationdone extends eventsmanager_notifyAbstract $from = (string) $sx->from; $ssel_id = (string) $sx->ssel_id; - if (null === $registered_user = $this->app['manipulator.user']->getRepository()->find($from)) { + if (null === $registered_user = $this->app['repo.users']->find($from)) { return []; } @@ -181,7 +181,7 @@ class eventsmanager_notify_validationdone extends eventsmanager_notifyAbstract */ public function is_available($usr_id) { - if (null === $user = $this->app['manipulator.user']->getRepository()->find($usr_id)) { + if (null === $user = $this->app['repo.users']->find($usr_id)) { return false; } diff --git a/lib/classes/eventsmanager/notify/validationreminder.php b/lib/classes/eventsmanager/notify/validationreminder.php index 1611579753..100fc04f42 100644 --- a/lib/classes/eventsmanager/notify/validationreminder.php +++ b/lib/classes/eventsmanager/notify/validationreminder.php @@ -86,8 +86,8 @@ class eventsmanager_notify_validationreminder extends eventsmanager_notifyAbstra $mailed = false; - $user_from = $this->app['manipulator.user']->getRepository()->find($params['from']); - $user_to = $this->app['manipulator.user']->getRepository()->find($params['to']); + $user_from = $this->app['repo.users']->find($params['from']); + $user_to = $this->app['repo.users']->find($params['to']); if (null === $user_from || null === $user_to) { return false; @@ -136,7 +136,7 @@ class eventsmanager_notify_validationreminder extends eventsmanager_notifyAbstra $from = (string) $sx->from; $ssel_id = (string) $sx->ssel_id; - if (null === $user = $this->app['manipulator.user']->getRepository()->find($from)) { + if (null === $user = $this->app['repo.users']->find($from)) { return []; } diff --git a/lib/classes/eventsmanager/notifyAbstract.php b/lib/classes/eventsmanager/notifyAbstract.php index 5e7e9385a5..aaa2c3008c 100644 --- a/lib/classes/eventsmanager/notifyAbstract.php +++ b/lib/classes/eventsmanager/notifyAbstract.php @@ -34,7 +34,7 @@ abstract class eventsmanager_notifyAbstract extends eventsmanager_eventAbstract protected function shouldSendNotificationFor($usrId) { - $user = $this->app['manipulator.user']->getRepository()->find($usrId); + $user = $this->app['repo.users']->find($usrId); return $this->app['settings']->getUserNotificationSetting($user, get_class($this)); } diff --git a/lib/classes/module/console/checkExtension.php b/lib/classes/module/console/checkExtension.php index 993c8812eb..9ccfc60470 100644 --- a/lib/classes/module/console/checkExtension.php +++ b/lib/classes/module/console/checkExtension.php @@ -41,7 +41,7 @@ class module_console_checkExtension extends Command $usrId = $input->getArgument('usr_id'); - if (null === $TestUser = $this->container['manipulator.user']->getRepository()->find($usrId)) { + if (null === $TestUser = $this->container['repo.users']->find($usrId)) { $output->writeln("Wrong user !"); return 1; diff --git a/lib/classes/module/console/systemMailCheck.php b/lib/classes/module/console/systemMailCheck.php index d3cec60c4b..72b8171f03 100644 --- a/lib/classes/module/console/systemMailCheck.php +++ b/lib/classes/module/console/systemMailCheck.php @@ -81,7 +81,7 @@ class module_console_systemMailCheck extends Command $id = $dialog->ask($output, 'Which id ?', ''); try { - $tmp_user = $this->container['manipulator.user']->getRepository()->find($id); + $tmp_user = $this->container['repo.users']->find($id); if ($tmp_user->getEmail() != $email) { throw new Exception('Invalid user'); diff --git a/lib/classes/module/report/activity.php b/lib/classes/module/report/activity.php index 2062b5e729..dffa49eee6 100644 --- a/lib/classes/module/report/activity.php +++ b/lib/classes/module/report/activity.php @@ -295,7 +295,7 @@ class module_report_activity extends module_report $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); $stmt->closeCursor(); - $login = $this->app['manipulator.user']->getRepository()->find($usr)->getDisplayName(); + $login = $this->app['repo.users']->find($usr)->getDisplayName(); $this->setChamp($rs); diff --git a/lib/classes/module/report/add.php b/lib/classes/module/report/add.php index 2835f20e91..2b31ccdf49 100644 --- a/lib/classes/module/report/add.php +++ b/lib/classes/module/report/add.php @@ -77,7 +77,7 @@ class module_report_add extends module_report $value = $row['val']; $caption = $value; if ($field == "getter") { - if (null !== $user = $this->app['manipulator.user']->getRepository()->find($value)) { + if (null !== $user = $this->app['repo.users']->find($value)) { $caption = $user->getDisplayName(); } } elseif ($field == 'date') diff --git a/lib/classes/module/report/edit.php b/lib/classes/module/report/edit.php index 97b94320de..b435af72db 100644 --- a/lib/classes/module/report/edit.php +++ b/lib/classes/module/report/edit.php @@ -77,7 +77,7 @@ class module_report_edit extends module_report $value = $row['val']; $caption = $value; if ($field == "getter") { - if (null !== $user = $this->app['manipulator.user']->getRepository()->find($value)) { + if (null !== $user = $this->app['repo.users']->find($value)) { $caption = $user->getDisplayName(); } } elseif ($field == 'date') { diff --git a/lib/classes/module/report/push.php b/lib/classes/module/report/push.php index fdae8ecc96..e38fa5f48f 100644 --- a/lib/classes/module/report/push.php +++ b/lib/classes/module/report/push.php @@ -78,7 +78,7 @@ class module_report_push extends module_report $value = $row['val']; $caption = $value; if ($field == "getter") { - if (null !== $user = $this->app['manipulator.user']->getRepository()->find($value)) { + if (null !== $user = $this->app['repo.users']->find($value)) { $caption = $user->getDisplayName(); } } elseif ($field == 'date') { diff --git a/lib/classes/module/report/sent.php b/lib/classes/module/report/sent.php index 539841519b..f330210a86 100644 --- a/lib/classes/module/report/sent.php +++ b/lib/classes/module/report/sent.php @@ -78,7 +78,7 @@ class module_report_sent extends module_report $value = $row['val']; $caption = $value; if ($field == "getter") { - if (null !== $user = $this->app['manipulator.user']->getRepository()->find($value)) { + if (null !== $user = $this->app['repo.users']->find($value)) { $caption = $user->getDisplayName(); } } elseif ($field == 'date') { diff --git a/lib/classes/module/report/validate.php b/lib/classes/module/report/validate.php index 6063552db4..86fda43a3e 100644 --- a/lib/classes/module/report/validate.php +++ b/lib/classes/module/report/validate.php @@ -78,7 +78,7 @@ class module_report_validate extends module_report $value = $row['val']; $caption = $value; if ($field == "getter") { - if (null !== $user = $this->app['manipulator.user']->getRepository()->find($value)) { + if (null !== $user = $this->app['repo.users']->find($value)) { $caption = $user->getDisplayName(); } } elseif ($field == 'date') { diff --git a/lib/classes/record/orderElement.php b/lib/classes/record/orderElement.php index 1b372d7dda..50293eb1ff 100644 --- a/lib/classes/record/orderElement.php +++ b/lib/classes/record/orderElement.php @@ -52,7 +52,7 @@ class record_orderElement extends record_adapter public function get_order_master_name() { if ($this->order_master_id) { - $user = $this->app['manipulator.user']->getRepository()->find($this->order_master_id); + $user = $this->app['repo.users']->find($this->order_master_id); return $user->getDisplayName(); } diff --git a/lib/classes/record/preview.php b/lib/classes/record/preview.php index 87f4cace36..eec7a3c7d2 100644 --- a/lib/classes/record/preview.php +++ b/lib/classes/record/preview.php @@ -371,7 +371,7 @@ class record_preview extends record_adapter [ 'final' => [] , 'comment' => [] - , 'user' => $row['usr_id'] ? $this->app['manipulator.user']->getRepository()->find($row['usr_id']) : null + , 'user' => $row['usr_id'] ? $this->app['repo.users']->find($row['usr_id']) : null ]; } diff --git a/lib/classes/set/exportftp.php b/lib/classes/set/exportftp.php index a667d4a498..b396955ee6 100644 --- a/lib/classes/set/exportftp.php +++ b/lib/classes/set/exportftp.php @@ -33,7 +33,7 @@ class set_exportftp extends set_export { $email_dest = ''; if ($usr_to) { - $user_t = $this->app['manipulator.user']->getRepository()->find($usr_to); + $user_t = $this->app['repo.users']->find($usr_to); $email_dest = $user_t->getEmail(); }