diff --git a/lib/Alchemy/Phrasea/Model/Repositories/RegistrationRepository.php b/lib/Alchemy/Phrasea/Model/Repositories/RegistrationRepository.php index 5e27bfd4de..c6fab6453c 100644 --- a/lib/Alchemy/Phrasea/Model/Repositories/RegistrationRepository.php +++ b/lib/Alchemy/Phrasea/Model/Repositories/RegistrationRepository.php @@ -84,7 +84,7 @@ class RegistrationRepository extends EntityRepository $data = []; $rsm = $this->createResultSetMappingBuilder('d'); $rsm->addScalarResult('sbas_id','sbas_id'); - $rsm->addScalarResult('bas_id','bas_id'); + $rsm->addScalarResult('base_id','base_id'); $rsm->addScalarResult('dbname','dbname'); $rsm->addScalarResult('time_limited', 'time_limited'); $rsm->addScalarResult('limited_from', 'limited_from'); @@ -96,22 +96,20 @@ class RegistrationRepository extends EntityRepository UNIX_TIMESTAMP( limited_from ) AS limited_from, UNIX_TIMESTAMP( limited_to ) AS limited_to, bas.server_coll_id, Users.id, basusr.actif, - bas.base_id AS bas_id , " . $rsm->generateSelectClause(['d' => 'd',]) . " + bas.base_id, " . $rsm->generateSelectClause(['d' => 'd',]) . " FROM (Users, bas, sbas) LEFT JOIN basusr ON ( Users.id = basusr.usr_id AND bas.base_id = basusr.base_id ) LEFT JOIN Registrations d ON ( d.user_id = Users.id AND bas.base_id = d.base_id ) - WHERE bas.active = 1 AND bas.sbas_id = sbas.sbas_id - AND Users.id = ? - AND model_of = 0"; + WHERE basusr.actif = 1 AND bas.sbas_id = sbas.sbas_id + AND Users.id = ?"; $query = $this->_em->createNativeQuery($sql, $rsm); $query->setParameter(1, $user->getId()); foreach ($query->getResult() as $row) { $registrationEntity = $row[0]; - - $data[$row['sbas_id']][$row['bas_id']] = [ - 'base-id' => $row['bas_id'], + $data[$row['sbas_id']][$row['base_id']] = [ + 'base-id' => $row['base_id'], 'db-name' => $row['dbname'], 'active' => (Boolean) $row['actif'], 'time-limited' => (Boolean) $row['time_limited'], @@ -122,4 +120,4 @@ class RegistrationRepository extends EntityRepository return $data; } -} +} \ No newline at end of file diff --git a/templates/web/account/access.html.twig b/templates/web/account/access.html.twig index 928153a67a..d420fdeaba 100644 --- a/templates/web/account/access.html.twig +++ b/templates/web/account/access.html.twig @@ -15,14 +15,16 @@   {% for sbasId, baseInfo in inscriptions %} + {% set sbasName = sbasId | sbas_labels(app) %} - - -

{{ sbasName }}

- - + {% set private = 0 %} {% if baseInfo["registrations"]["by-type"]["accepted"]|length > 0 %} + + +

{{ sbasName }}

+ + {{ "Allowed access to the following collections" | trans }} @@ -44,8 +46,12 @@ - {% endif %} - {% if baseInfo["registrations"]["by-type"]["rejected"]|length > 0 %} + {% elseif baseInfo["registrations"]["by-type"]["rejected"]|length > 0 %} + + +

{{ sbasName }}

+ + {{ "Rejected access to the following collections" | trans }} @@ -67,8 +73,12 @@ - {% endif %} - {% if baseInfo["registrations"]["by-type"]["pending"]|length > 0 %} + {% elseif baseInfo["registrations"]["by-type"]["pending"]|length > 0 %} + + +

{{ sbasName }}

+ + {{ "Pending access to the following collections" | trans }} @@ -88,8 +98,12 @@ - {% endif %} - {% if baseInfo["registrations"]["by-type"]["in-time"]|length > 0 %} + {% elseif baseInfo["registrations"]["by-type"]["in-time"]|length > 0 %} + + +

{{ sbasName }}

+ + {{ "Temporary access to the following collections" | trans }} @@ -109,8 +123,12 @@ - {% endif %} - {% if baseInfo["registrations"]["by-type"]["out-dated"]|length > 0 %} + {% elseif baseInfo["registrations"]["by-type"]["out-dated"]|length > 0 %} + + +

{{ sbasName }}

+ + {{ "Outdated access to the following collections" | trans }} @@ -130,8 +148,12 @@ - {% endif %} - {% if baseInfo["registrations"]["by-type"]["inactive"]|length > 0 %} + {% elseif baseInfo["registrations"]["by-type"]["inactive"]|length > 0 %} + + +

{{ sbasName }}

+ + {{ "Suspended access to the following collections" | trans }} @@ -151,9 +173,11 @@ + {% else %} + {% set private = 1 %} {% endif %} - {% if attribute(baseInfo["config"]["cgu"], app['locale']) is defined %} + {% if attribute(baseInfo["config"]["cgu"], app['locale']) is defined and private == 0 %} {% set TOU = attribute(baseInfo["config"]["cgu"], app['locale']) %} @@ -166,7 +190,7 @@ {% endif %} {% for collInfo in baseInfo["config"]["collections"] if (collInfo['registration'] is none and collInfo['can-register']) %} - {% if collInfo["cgu"] is not none %} + {% if collInfo["cgu"] is not none and private == 0 %} {{ "login::register: L\'acces aux bases ci-dessous implique l\'acceptation des Conditions Generales d\'Utilisation (CGU) suivantes" | trans }}