mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
fix: Fix bug reported by the tests.
This commit is contained in:
parent
c1a4454a08
commit
11ad94ee09
@ -87,8 +87,7 @@ class TimelineReportProvider implements TimelineProviderInterface
|
|||||||
$report = $this->em->getClassMetadata(Report::class);
|
$report = $this->em->getClassMetadata(Report::class);
|
||||||
$person = $this->em->getClassMetadata(Person::class);
|
$person = $this->em->getClassMetadata(Person::class);
|
||||||
$role = new Role('CHILL_REPORT_SEE');
|
$role = new Role('CHILL_REPORT_SEE');
|
||||||
$reachableCenters = $this->helper->getReachableCenters($this->security->getUser(),
|
$reachableCenters = $this->helper->getReachableCenters($this->security->getUser(), $role->getRole());
|
||||||
$role);
|
|
||||||
$reportPersonId = $report->getAssociationMapping('person')['joinColumns'][0]['name'];
|
$reportPersonId = $report->getAssociationMapping('person')['joinColumns'][0]['name'];
|
||||||
$reportScopeId = $report->getAssociationMapping('scope')['joinColumns'][0]['name'];
|
$reportScopeId = $report->getAssociationMapping('scope')['joinColumns'][0]['name'];
|
||||||
$personCenterId = $person->getAssociationMapping('center')['joinColumns'][0]['name'];
|
$personCenterId = $person->getAssociationMapping('center')['joinColumns'][0]['name'];
|
||||||
@ -111,8 +110,7 @@ class TimelineReportProvider implements TimelineProviderInterface
|
|||||||
$parameters[] = $center->getId();
|
$parameters[] = $center->getId();
|
||||||
// loop over scopes
|
// loop over scopes
|
||||||
$scopeIds = [];
|
$scopeIds = [];
|
||||||
foreach ($this->helper->getReachableScopes($this->security->getUser(),
|
foreach ($this->helper->getReachableScopes($this->security->getUser(), $role->getRole(), $center) as $scope) {
|
||||||
$role, $center) as $scope) {
|
|
||||||
if (\in_array($scope->getId(), $scopeIds)) {
|
if (\in_array($scope->getId(), $scopeIds)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -158,8 +156,7 @@ class TimelineReportProvider implements TimelineProviderInterface
|
|||||||
// this is the final clause that we are going to fill
|
// this is the final clause that we are going to fill
|
||||||
$clause = "{report}.{person_id} = ? AND {report}.{scopes_id} IN ({scopes_ids})";
|
$clause = "{report}.{person_id} = ? AND {report}.{scopes_id} IN ({scopes_ids})";
|
||||||
// iterate over reachable scopes
|
// iterate over reachable scopes
|
||||||
$scopes = $this->helper->getReachableScopes($this->security->getUser(), $role,
|
$scopes = $this->helper->getReachableScopes($this->security->getUser(), $role->getRole(), $args['person']->getCenter());
|
||||||
$args['person']->getCenter());
|
|
||||||
|
|
||||||
foreach ($scopes as $scope) {
|
foreach ($scopes as $scope) {
|
||||||
if (\in_array($scope->getId(), $parameters)) {
|
if (\in_array($scope->getId(), $parameters)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user