diff --git a/lib/Alchemy/Phrasea/Command/User/UserListCommand.php b/lib/Alchemy/Phrasea/Command/User/UserListCommand.php
index 6fe659223c..bf3f87e478 100644
--- a/lib/Alchemy/Phrasea/Command/User/UserListCommand.php
+++ b/lib/Alchemy/Phrasea/Command/User/UserListCommand.php
@@ -30,7 +30,7 @@ class UserListCommand extends Command
{
parent::__construct('user:list');
- $this->setDescription('List of all user')
+ $this->setDescription('List of all user (experimental)')
->addOption('user_id', null, InputOption::VALUE_OPTIONAL, ' The id of user export only info this user ')
->addOption('user_email', null, InputOption::VALUE_OPTIONAL, 'The mail of user export only info this user .')
->addOption('database_id', null, InputOption::VALUE_OPTIONAL, 'Id of database.')
@@ -42,6 +42,7 @@ class UserListCommand extends Command
->addOption('application', null, InputOption::VALUE_NONE, 'List application of user work only if --user_id is set')
->addOption('right', null, InputOption::VALUE_NONE, 'Show right information')
->addOption('adress', null, InputOption::VALUE_NONE, 'Show adress information')
+ ->addOption('models', null, InputOption::VALUE_NONE, "Show only defined models, if --user_id is set with --models it's the template owner")
->addOption('jsonformat', null, InputOption::VALUE_NONE, 'Output in json format')
->setHelp('');
@@ -62,6 +63,7 @@ class UserListCommand extends Command
$created = $input->getOption('created');
$updated = $input->getOption('updated');
$withRight = $input->getOption('right');
+ $models = $input->getOption('models');
$jsonformat = $input->getOption('jsonformat');
$query = $this->container['phraseanet.user-query'];
@@ -70,18 +72,26 @@ class UserListCommand extends Command
if($collectionId) $query->on_sbas_ids([$collectionId]);
if($created) $this->addFilterDate($created,'created',$query);
if($updated) $this->addFilterDate($updated,'updated',$query);
- if($userId) $query->addSqlFilter('Users.id = ?' ,[$userId]);
- if($userEmail) $query->addSqlFilter('Users.email = ?' ,[$userEmail]);
- if($lockStatus) $query->addSqlFilter('Users.mail_locked = 1');
- if($guest) $query->include_invite(true)->addSqlFilter('Users.guest = 1');
+ if($userId && !$models) $query->addSqlFilter('Users.id = ?' ,[$userId]);
+ if($userEmail && !$models) $query->addSqlFilter('Users.email = ?' ,[$userEmail]);
+ if($lockStatus && !$models) $query->addSqlFilter('Users.mail_locked = 1');
+ if($guest && !$models) $query->include_invite(true)->addSqlFilter('Users.guest = 1');
if ($application and !$userId) {
$output->writeln('You must provide --user_id when using --application option');
return 0;
}
- $users = $query
- ->execute()->get_results();
+ /** @var UserRepository $userRepository */
+ $userRepository = $this->container['repo.users'];
+
+ if ($models && $userId) {
+ $users = $userRepository->findBy(['templateOwner' => $userId]);
+ } elseif ($models) {
+ $users = $userRepository->findTemplate();
+ } else {
+ $users = $query->execute()->get_results();
+ }
$userList = [];
$showApplication = false;
diff --git a/lib/Alchemy/Phrasea/Controller/Api/V1Controller.php b/lib/Alchemy/Phrasea/Controller/Api/V1Controller.php
index 9b8f4ed04d..42339169d6 100644
--- a/lib/Alchemy/Phrasea/Controller/Api/V1Controller.php
+++ b/lib/Alchemy/Phrasea/Controller/Api/V1Controller.php
@@ -1573,9 +1573,9 @@ class V1Controller extends Controller
$options->setFirstResult((int)($request->get('offset_start') ?: 0));
$options->setMaxResults((int)$request->get('per_page') ?: 10);
- $this->getSearchEngine()->resetCache();
+ $searchEngine = $this->getSearchEngine();
- $search_result = $this->getSearchEngine()->query((string)$request->get('query'), $options);
+ $search_result = $searchEngine->query((string)$request->get('query'), $options);
$this->getUserManipulator()->logQuery($this->getAuthenticatedUser(), $search_result->getQueryText());
@@ -1583,12 +1583,12 @@ class V1Controller extends Controller
$collectionsReferencesByDatabox = $options->getCollectionsReferencesByDatabox();
foreach ($collectionsReferencesByDatabox as $sbid => $references) {
$databox = $this->findDataboxById($sbid);
- $collectionsIds = array_map(function(CollectionReference $ref){return $ref->getCollectionId();}, $references);
+ $collectionsIds = array_map(function (CollectionReference $ref) {
+ return $ref->getCollectionId();
+ }, $references);
$this->getSearchEngineLogger()->log($databox, $search_result->getQueryText(), $search_result->getTotal(), $collectionsIds);
}
- $this->getSearchEngine()->clearCache();
-
return $search_result;
}
diff --git a/lib/Alchemy/Phrasea/Core/MetaProvider/DatabaseMetaProvider.php b/lib/Alchemy/Phrasea/Core/MetaProvider/DatabaseMetaProvider.php
index 206efee9b2..8a463c2868 100644
--- a/lib/Alchemy/Phrasea/Core/MetaProvider/DatabaseMetaProvider.php
+++ b/lib/Alchemy/Phrasea/Core/MetaProvider/DatabaseMetaProvider.php
@@ -84,10 +84,14 @@ class DatabaseMetaProvider implements ServiceProviderInterface
$service = $app['phraseanet.cache-service'];
$config->setMetadataCacheImpl(
- $service->factory('ORM_metadata', $app['orm.cache.driver'], $app['orm.cache.options'])
+ $app['orm.cache.factory.filesystem'](array(
+ 'path' => $app['cache.path'].'/doctrine/metadata',
+ ))
);
$config->setQueryCacheImpl(
- $service->factory('ORM_query', $app['orm.cache.driver'], $app['orm.cache.options'])
+ $app['orm.cache.factory.filesystem'](array(
+ 'path' => $app['cache.path'].'/doctrine/query',
+ ))
);
$config->setResultCacheImpl(
$service->factory('ORM_result', $app['orm.cache.driver'], $app['orm.cache.options'])
diff --git a/lib/Alchemy/Phrasea/Model/Repositories/UserRepository.php b/lib/Alchemy/Phrasea/Model/Repositories/UserRepository.php
index d122922091..e428f8554b 100644
--- a/lib/Alchemy/Phrasea/Model/Repositories/UserRepository.php
+++ b/lib/Alchemy/Phrasea/Model/Repositories/UserRepository.php
@@ -122,4 +122,15 @@ class UserRepository extends EntityRepository
{
return $this->findBy(['templateOwner' => $user->getId()]);
}
+
+ /**
+ * Finds all templates
+ */
+ public function findTemplate()
+ {
+ $qb = $this->createQueryBuilder('u');
+ $qb->where('u.templateOwner is NOT NULL');
+
+ return $qb->getQuery()->getResult();
+ }
}
diff --git a/package.json b/package.json
index 8ac01be75a..4a9f380dbe 100644
--- a/package.json
+++ b/package.json
@@ -65,7 +65,7 @@
"normalize-css": "^2.1.0",
"npm": "^6.0.0",
"npm-modernizr": "^2.8.3",
- "phraseanet-production-client": "0.34.139-d",
+ "phraseanet-production-client": "0.34.141-d",
"requirejs": "^2.3.5",
"tinymce": "^4.0.28",
"underscore": "^1.8.3",
diff --git a/templates/web/prod/index.html.twig b/templates/web/prod/index.html.twig
index 8636b09dc8..c2d5465183 100644
--- a/templates/web/prod/index.html.twig
+++ b/templates/web/prod/index.html.twig
@@ -183,6 +183,9 @@
{% if GV_thesaurus %}
+
+
+
diff --git a/yarn.lock b/yarn.lock
index 8eae8692f5..bc67e69c04 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -7577,10 +7577,10 @@ phraseanet-common@^0.4.5-d:
js-cookie "^2.1.0"
pym.js "^1.3.1"
-phraseanet-production-client@0.34.139-d:
- version "0.34.139-d"
- resolved "https://registry.yarnpkg.com/phraseanet-production-client/-/phraseanet-production-client-0.34.139-d.tgz#27edf283275c427ba226ff8b6c9461511dd6c827"
- integrity sha512-8lOeLbUpa2qBi08d4Tr3FbtKf4TmSvTWhPtwCm7bZxls14TMXnYl7JRFZoYEMGEB1n1tbYozrl/Oz4qV7Pn6Sg==
+phraseanet-production-client@0.34.141-d:
+ version "0.34.141-d"
+ resolved "https://registry.yarnpkg.com/phraseanet-production-client/-/phraseanet-production-client-0.34.141-d.tgz#25a137975af873c17837eaa0180ffe500c936f7f"
+ integrity sha512-cYRaVtJPh5poYqOruoBwapM7HMp5Bv9NvW9HkEqPYr5p2nfZMzgEjjpyOQHnNkaEI+6w2kDk8KGNYd37HnOTmw==
dependencies:
"@mapbox/mapbox-gl-language" "^0.9.2"
"@turf/turf" "^5.1.6"