mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-10 11:33:17 +00:00
Add user repository as a service
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
@@ -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++;
|
||||
}
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -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));
|
||||
}
|
||||
|
@@ -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);
|
||||
}
|
||||
|
||||
|
@@ -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));
|
||||
}
|
||||
|
||||
|
@@ -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));
|
||||
}
|
||||
|
||||
|
@@ -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();
|
||||
|
@@ -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++;
|
||||
|
@@ -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]));
|
||||
|
@@ -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());
|
||||
|
@@ -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'));
|
||||
|
@@ -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'));
|
||||
|
@@ -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'
|
||||
|
@@ -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()) {
|
||||
|
@@ -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);
|
||||
|
||||
|
@@ -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);
|
||||
|
||||
|
@@ -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) {
|
||||
|
||||
|
@@ -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)
|
||||
|
@@ -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']);
|
||||
}
|
||||
}
|
||||
|
@@ -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']);
|
||||
}
|
||||
}
|
||||
|
@@ -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()) {
|
||||
|
@@ -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();
|
||||
|
||||
|
@@ -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) {
|
||||
|
@@ -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);
|
||||
}
|
||||
}
|
||||
|
@@ -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'];
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
|
@@ -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'];
|
||||
|
@@ -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']);
|
||||
|
@@ -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;
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
|
@@ -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;
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
|
@@ -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 [];
|
||||
}
|
||||
|
||||
|
@@ -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 [];
|
||||
}
|
||||
|
||||
|
@@ -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 [];
|
||||
}
|
||||
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
|
@@ -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 [];
|
||||
}
|
||||
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
|
@@ -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 [];
|
||||
}
|
||||
|
||||
|
@@ -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));
|
||||
}
|
||||
|
@@ -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("<error>Wrong user !</error>");
|
||||
|
||||
return 1;
|
||||
|
@@ -81,7 +81,7 @@ class module_console_systemMailCheck extends Command
|
||||
$id = $dialog->ask($output, '<question>Which id ?</question>', '');
|
||||
|
||||
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');
|
||||
|
@@ -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);
|
||||
|
||||
|
@@ -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')
|
||||
|
@@ -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') {
|
||||
|
@@ -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') {
|
||||
|
@@ -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') {
|
||||
|
@@ -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') {
|
||||
|
@@ -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();
|
||||
}
|
||||
|
@@ -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
|
||||
];
|
||||
}
|
||||
|
||||
|
@@ -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();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user