|
@@ -88,9 +88,7 @@ class AccessRepository extends ServiceEntityRepository implements UserLoaderInte
|
|
|
* @param bool $ignoreLoginEnabled Retourne aussi les access dont la propriété loginEnabled est False
|
|
* @param bool $ignoreLoginEnabled Retourne aussi les access dont la propriété loginEnabled est False
|
|
|
*/
|
|
*/
|
|
|
public function findAllValidAccesses(
|
|
public function findAllValidAccesses(
|
|
|
- Access $access,
|
|
|
|
|
- bool $ignoreNetworkOrganizationEndDate = false,
|
|
|
|
|
- bool $ignoreLoginEnabled = false,
|
|
|
|
|
|
|
+ Access $access
|
|
|
): mixed {
|
|
): mixed {
|
|
|
$datetime = new \DateTime();
|
|
$datetime = new \DateTime();
|
|
|
$today = $datetime->format('Y-m-d');
|
|
$today = $datetime->format('Y-m-d');
|
|
@@ -103,23 +101,13 @@ class AccessRepository extends ServiceEntityRepository implements UserLoaderInte
|
|
|
->innerJoin('organization.networkOrganizations', 'networkOrganizations')
|
|
->innerJoin('organization.networkOrganizations', 'networkOrganizations')
|
|
|
->where('access.person = :person')
|
|
->where('access.person = :person')
|
|
|
->andWhere('networkOrganizations.startDate <= :today')
|
|
->andWhere('networkOrganizations.startDate <= :today')
|
|
|
|
|
+ ->andWhere(
|
|
|
|
|
+ "networkOrganizations.endDate >= :today
|
|
|
|
|
+ OR networkOrganizations.endDate = '0000-00-00'
|
|
|
|
|
+ OR networkOrganizations.endDate IS NULL")
|
|
|
->setParameter('person', $access->getPerson())
|
|
->setParameter('person', $access->getPerson())
|
|
|
->setParameter('today', $today);
|
|
->setParameter('today', $today);
|
|
|
|
|
|
|
|
- if (!$ignoreLoginEnabled) {
|
|
|
|
|
- $q
|
|
|
|
|
- ->andWhere('access.loginEnabled = :loginEnabled')
|
|
|
|
|
- ->setParameter('loginEnabled', true);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- if (!$ignoreNetworkOrganizationEndDate) {
|
|
|
|
|
- $q->andWhere(
|
|
|
|
|
- "networkOrganizations.endDate >= :today
|
|
|
|
|
- OR networkOrganizations.endDate = '0000-00-00'
|
|
|
|
|
- OR networkOrganizations.endDate IS NULL"
|
|
|
|
|
- );
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
return $q->getQuery()->getResult();
|
|
return $q->getQuery()->getResult();
|
|
|
} finally {
|
|
} finally {
|
|
|
$this->filtersConfigurationService->restoreTimeConstraintFilters();
|
|
$this->filtersConfigurationService->restoreTimeConstraintFilters();
|